Repository navigation
Brain OS 0.4.0
"Wire the Pillars + Fix the Stubs" release. v0.3.0 → v0.4.0 promotes
every pillar crate shipped between v0.3.0 and this release from
"compiles and tests in isolation" to "wired into production startup."
The umbrella test build_processor_populates_every_injection_slot in
crates/cli/src/bootstrap.rs is the new contract — a new with_*
builder cannot land without a matching bootstrap call.
Workspace-locked: all 31 crates publish at 0.4.0 together.
Added
-
Pillar wiring — every
with_*injection slot now populated in
bootstrap (Issues 5–11, 18–19, 21, 29–30; Wave A). The eight
pillar crates shipped between v0.3.0 and v0.4.0 —brainos-observe,
brainos-identity,brainos-mcphost,brainos-terminal,
brainos-intent,brainos-reflex,brainos-resilience,
brainos-orchestrate— were compiled and unit-tested but
cli::{serve,bootstrap}.rsonly wiredwith_standing_approvals,
leaving every other guard likeif let Some(observer) = self.observer
silently inactive in production. v0.4.0 closes that gap.
BroadcastObserver,ConfigIdentityStore,RmcpHost(as default
MCP host wrapped inResilientMcpHost), Terminal Bridge (behind
--terminalserve flag),InMemoryToolRegistry+
DefaultIntentRouter+InMemoryCapabilityIndex,
FsReflex/CronReflex/SysStateReflexreflex sources, and the
BreakerRegistryare all now constructed in bootstrap and threaded
throughSignalProcessor. The compactor runs as a 24h reflection
task incli::serve. Terminal sessions mirror into the episodic
graph viaHippocampusTerminalSink.DualMemoryReaderis wired as
a first-class field onSignalProcessor. A DLQ drain task purges
the dead-letter queue periodically. New umbrella test
crates/cli/src/bootstrap.rs::build_processor_populates_every_injection_slot
is the new contract — a newwith_*builder cannot land without a
matching bootstrap call. -
Canonical verb vocabulary (Issue 158, v1.0.0 RFC §1).
Newintent::verbs::VERBSlists the 23 verbs the kernel addresses
(memory.store,shell.exec,mcp.mount, …) with namespace, action,
conservativeTierHint, and human summary. New helpers
intent::verbs::lookup(ns, action)andintent::verbs::namespaces()
give consumers a single source of truth for what the kernel can
authorize. Implemented as compile-time constants rather than a
separateverbs.tomlfile: the verb surface is kernel contract
(adding one requires a newIntentvariant + authz mapping +
handler), not config. Cross-check test
signal::authz::tests::every_static_verb_is_in_registryasserts
every typed-Intent → AuthorizationRequest verb resolves through
lookup, AND thattier_for_verbmatches each entry's
tier_hint— typos inintent_to_auththerefore fail the test
suite rather than the runtime.
Changed
-
Loop-detector hash switched to BLAKE3 (Issue 160, v1.0.0 RFC
§4).resilience::loop_detector::hash_callpreviously used
std::collections::hash_map::DefaultHasher(SipHash with per-process
seed). Same field separator (\x1f), same(tool_id, canonical_json)
inputs, sameu64storage shape — the change is keyless determinism
across process restarts, which is the prerequisite for any future
on-disk window persistence. Functionally equivalent within a single
process. Addsblake3 = "1"to workspace dependencies. -
Config hygiene (Issues 32, 36–41; Wave D).
default.yamlbrain.version bumped0.2.0→0.4.0(Issue 32).impl Default for BrainConfigproactivity fields synced with
default.yaml; newdefault_matches_yamlregression test
(Issue 36).storage.hnsw.{ef_construction,m,ef_search,max_elements}now
threaded intoRuVectorStore::openinstead of hardcoded
(Issue 37).cli::serverespectsadapters.{http,ws,grpc,mcp}.enabledflags
as a secondary filter after CLI flags (Issue 38).- Dead config fields removed:
adapters.mcp.{stdio,http}and
emptymemory.episodicstruct (Issues 39, 41). - Legacy
llm.providermarked#[deprecated]; startup warns when
both it andproviders[]are set (Issue 40).
-
Public surface shrunk (Issues 33–34, Wave E).
channel::CorrelatedCommandandchannel::RoutingDecisionare no
longer publicly re-exported.
Fixed
-
handle_prune_audithonoursolder_than(Issue 1, Wave B.1).
Now parses"30d"/"7d"/"24h"and passes the real duration to
audit.prune(...). Previously the parameter was silently ignored. -
handle_list_schedules/handle_cancel_scheduleactually
query (Issues 2–3, Waves B.2–B.3). Both intents now call into the
scheduled-intent store (list_scheduled_intents/cancel_scheduled_intent)
and format real results. Previously returned hardcoded placeholder
strings. -
handle_set_proactivitytoggles state (Issue 4, Wave B.4).
Simplified to a runtime-mutable toggle backed byRwLock. Full
windowed-mutation semantics deferred to v1.0. -
HTTP error responses can no longer panic (Issue 43, Wave C.1).
AllResponse::builder().unwrap()call sites replaced with
.map_err(...)returning a 500 fallback. -
External error messages sanitized (Issue 44, Wave C.2).
SignalError::to_public()returns a sanitizedPublicError; all
adapter error renderers use it. Internal stack-trace-grade details
no longer leak across the wire. -
ProjectInspectpath-sandboxed (Issue 119, Wave C.6).
handle_project_inspectcanonicalizes the requested path and
rejects anything outsideconfig.security.allowed_paths
(default:$HOME). Previously, an LLM-extracted path could read
arbitrary files. -
ActionDispatcher::execute_commandroutes through the sandbox
(Issue 121, Wave C.7). Replaced rawtokio::process::Commandwith
the wiredSandboxExecutor. Resource limits, allowlist, and
platform isolation now apply to dispatcher invocations. -
Adapter
enabledflags are a real gate (Issue 38, Wave D.4;
also listed under Changed). Settingadapters.http.enabled: false
now actually prevents the HTTP adapter from starting, instead of
being silently ignored.
Post-closeout soak fixes
- WebSocket chat confirmation reach. Each authenticated WS
connection now registers aWsChatTransportwith the
ChannelDispatcher(idws:<conn-uuid>) so confirmation prompts
and any other outboundDeliveryIntentreach the user on the same
socket they're chatting on. Inbound is a no-op — chat content
already flows throughprocess_text_frameinto the signal pipeline.
The connection handler callsunregister_transporton disconnect
so the router stops routing to dead handles.
ChannelDispatcher::unregister_transportand
ChannelRouter::unregisterare new (idempotent) and used only by
short-lived transports. The streaming response path was also
reshaped around a per-connectionmpsc<Message>fan-in so the
reader, writer, and BrainEvent broadcast subscriber don't fight
over the underlying sink. - Observability gap closed:
IntentClassified,
ConfirmationRequested,ConfirmationResolvednow actually
emit from the signal pipeline. Previously defined on the bus but
never published;brain tailand the WS event stream now surface
them in real time. Resolution decisions are tagged
approved/rejected/timed_out/aborted/error. - Late
RespondToApprovalswallowed silently. If the user's
chat client buffered anapprove <nonce>keystroke that lands
after the engine has already timed out / approved / rejected the
nonce (AlreadyResolved/NotFound), the pipeline now returns
an empty body so the renderer skips it. Previously it surfaced
"Approval already resolved" as a confusingBrain:error. - Terminal replay buffer closes late-attach race in
TerminalBridge
(commit 9868dd2). SignalReceivedpublished on streaming WS chat +brain tail
prints a connect line (commit 237dac1).brain tailreqwest no longer hangs on zero-duration timeout
(commit b5aaf0e).- Audit observer wired in bootstrap so
SqliteAuditTrailevents
reach the bus (commit 9708294). - Soak regressions fixed:
brain tailauth handshake, config
fallback path, terminal close error text (commit d8e0612).
Security
-
Per-client rate limiting on HTTP/WS/gRPC (Issue 51, Wave C.3).
ResilienceRateLimiterwired into the Tower stack on HTTP and WS
adapters; gRPC interceptor enforces the same. -
Webhook endpoint requires Bearer auth when verifier-less
(Issue 52, Wave C.4).POST /v1/webhooks/:idnow demands a Bearer
token whenever the configured transport hasverifier == None. -
Fail-closed on empty
api_keys(Issues 53–54, Wave C.5 + soak
hardening). Config validation returnsErrwhenaccess.api_keysis
empty —brain serve,brain start, and every other command that
loads config refuses to boot. TheAuthResult::Openenum variant
that previously let empty-keys silently fall through to "allow all"
has been removed;check_authnow returnsMissingKeyso adapters
fail closed even on direct calls. The original--no-authopt-in
flag from the first Wave C.5 patch was also removed — running
anonymously is no longer possible. Shell-mode allowlist bypass
remains documented in OPERATIONS.md. -
OAuth
audclaim validation at MCP mount time (Issue 163,
CVE-2025-6514 / confused-deputy via token passthrough). New
mcphost::aud_check::validate_token_auddecodes the persisted
access token (JWT format only — opaque tokens skip validation) and
rejects a mount when the token'saudclaim does not include the
configured RFC 8707resourceindicator.mcphost::manager_from_vault
signature gainedexpected_resource+ anOption<Arc<dyn Observer>>;
RmcpHost::mount_httpdefaults the resource to the server URL
(canonical mapping for vanilla MCP deployments) and threads its
observer through. Mismatches surface as
BrainEvent::Error { source: "mcphost.oauth" }on the live event
bus AND fail the mount. Signature verification is intentionally
out of scope — vault + TLS to AS + PKCE are the trust boundary,
not in-band JWS verification. +9 unit tests covering string-aud
match, array-aud match, mismatch, missing-aud, opaque-token, and
malformed-JWT shapes. -
MCP tool descriptions treated as untrusted at the LLM boundary
(Issue 162). Newintent::sanitization::render_tool_description_for_prompt
fences every attacker-controllable description inside a labelled
~~~-delimited block, strips C0 control bytes + ANSI CSI escapes,
defangs any literal fence sentinel inside the body, and caps length
at 2 KiB on a UTF-8 char boundary.intent::ToolDescriptor.description
andmcphost::ToolDescriptor.descriptioncarry doc-comments marking
them untrusted; callers wiring descriptions into prompts must use
the sanitizer. Complements the hash-pin rug-pull detector in
mcphost::RmcpHost(which catches changes to descriptions);
the sanitizer is what stops a single hostile first-mount description
from landing as live system instructions.
Removed
-
Dead code cleanup (Issues 13–14, 16–17, 20, 23, 27–28; Wave E).
FORGET_REandSTORE_FACT_REregexes removed (shadowed by
classify_explicit).set_action_namespace()andrecall_memories()removed
(no callers).AckSignalHandlermoved into#[cfg(test)].AgentTask.credentials,Markdown::push_blank/Markdown::kv,
andextract::is_supportedremoved.
-
Dead config fields removed (Issues 18–19, 21; Wave A side-effects).
credential_vaultfield dropped,sandbox_executoraccessor
visibility downgraded,RelayConfig.api_keyremoved.
Deferred
-
Tower middleware exact ordering (Issue 154, RFC §4.2).
ResilientMcpHostremains a hand-rolled decorator. Swap to
tower::ServiceBuildercomposition deferred to v1.0.0 — security-
sensitive layer; must preserve semantics through the transition. -
Modifiers-based capability scoping (Issue 159, RFC §12 OQ#2).
Identity has path-scope (PR1) but not the full
AuthorizationRequest.modifiersper-principal allowlist. Wire
contract change deferred to v1.0.0. -
DualMemoryReader → RecallEngine composition. The reader is
wired as aSignalProcessorfield, but does NOT compose into
RecallEngine::recall.DualMemoryReaderonly exposes
read_by_id;RecallEngineis hybrid BM25+ANN. They don't compose
without graph-side FTS5 + ANN, which is out of v0.4.0 scope.
Reopens as a v0.5.0 slice when graph search lands. -
Structural follow-ups clustered for v0.5.0+: performance
(embedding cache, namespace scan, blocking std::fs in async, N+1
deletes, SqlitePool mutex serialization, HNSW preallocation, batch
embed clones); test coverage (vault, adapters, resilience, identity,
intent, plus benchmarks and fuzzing); async hygiene (blocking I/O
on async runtime, fire-and-forget spawns, std::sync::mpsc in async);
SOLID refactors (SignalProcessorfield reduction,pipeline.rs/
serve.rs/main.rssplits, large match-arm extraction); duplicate
consolidation (twoCircuitBreakerimpls, LLM message conversion
and HTTP error handling repeated across providers, embedding HTTP
client builder,identity::TiervsActionTier); workspace lintspublish = falseguards; CI matrix (macOS, Windows, MSRV) and
release automation; cross-platform (Linux protoc, Windows syscall
guards); medium-severity security hardening (gRPC message limits,
CORS exact-match, webhook replay protection, SSRF, vault passphrase
exposure, MCP arbitrary-mount risk); andbrain doctor --deep
system inspection.