Repository navigation
feat(persona): PersonaCommandInboundPump — install step that makes a persona actually receive cross-grid commands - #1567
Merged
Conversation
… command dispatch (install module; bootstrap wiring follows in #222) PR #1560 + #1563 proved the cross-grid command wire works end-to-end IN TESTS. Both tests constructed a CommandRequestHandler + spawned a subscribe loop INLINE. Production never installed the handler anywhere. `grep -rn CommandRequestHandler::new core/continuum-core/src/ | grep -v test` returns ZERO hits today. So a real running substrate SILENTLY ignores incoming AircCommandRequest envelopes — peer_b can dispatch `ai/generate` at peer_a, the envelope arrives, no one listens. This commit lands the install MODULE — `PersonaCommandInboundPump`. The bootstrap-wiring step (call `spawn()` from `PersonaAircRuntime::bootstrap`) is task #222 and is the remaining work before any real running substrate becomes addressable for commands. The commit DOES NOT claim to move the doctrine on its own: the test exercises the install path, but no production code path calls `PersonaCommandInboundPump::spawn` until #222 lands. Framing per R2 round-1 review of this PR: this is the install module, not the install. The doctrine moves when both this PR and #222 are merged. ## What lands PersonaCommandInboundPump — a per-persona tokio task that: - subscribes to the persona's own airc handle (broadcast: multiple subscribers see the same events, verified in PR #1563 R3 review + cross-referenced at airc-lib's messaging.rs:204-211) - filters for command-shaped envelopes (HEADER_CONTINUUM_BODY_HINT == COMMAND_REQUEST_BODY_HINT) — skips self-events + non-command envelopes so the chat pump's `body.as_text()` filter at airc_persona_conversation.rs:166 keeps owning text - hands matching envelopes to a CommandRequestHandler bound to the substrate's CommandExecutor — the SAME handler PR #1563's e2e test wires manually - returns `Result<Self, AircError>` from `spawn()` so subscribe failure surfaces at the CALL SITE (per R2 round-1: the previous shape logged `error!` + exited the task silently — "loud-once", which the doctrine says isn't loud enough) Subscribe is now synchronous in `spawn`: opens the EventStream before tokio::spawn, moves the stream into the task. Caller bails immediately on failure rather than declaring the persona ready while it's actually unaddressable. Per `[[personas-are-citizens-airc-is-identity-provider]]`: the substrate has no airc identity of its own — only personas do. So the pump binds to a persona's `Arc<Airc>`, not a substrate-level singleton. When peer_b dispatches `airc://<persona-uuid>/ai/generate`, THAT persona's pump receives the envelope. Two-task pattern (chat pump + command pump on the same airc handle) is doctrinally cleaner than splicing command dispatch into the chat loop: - separation of concerns — chat behavior + cognition / lag shouldn't tangle with command-envelope dispatch - composability — future per-persona inbound subscribers (event- subscribe responses, future bus shapes) add as more peer tasks, not as branches of an existing one - airc-lib does the broadcast fan-out for free ## What the integration test proves `tests/persona_command_inbound_pump.rs`: - sets up peer_a as a persona-shaped substrate (ModuleRegistry + TestInferenceModule wrapping HeuristicInferenceAdapter + CommandExecutor) - calls PersonaCommandInboundPump::spawn ONCE (the production-shape install path; the test never constructs CommandRequestHandler or spawns a manual subscribe loop) - peer_b dispatches ai/generate via AircRemoteInferenceAdapter + AircLiveTransport - asserts response.text starts with `[heuristic:` (signature prefix proves the substrate's FULL dispatch chain ran — pump -> CommandRequestHandler -> CommandExecutor -> TestInferenceModule -> HeuristicAdapter) - asserts the prompt echoed - asserts response.provider == "airc-remote" - calls pump.shutdown() to verify the clean-shutdown path The test pins the MODULE's contract. The PRODUCTION install lands in #222. ## What's deliberately deferred - Wiring PersonaCommandInboundPump::spawn() into PersonaAircRuntime::bootstrap. Filed as task #222. The actual install. Until #222 lands, no real running substrate is addressable for cross-grid commands — this PR's test is the only thing exercising the install path. - Promoting TestInferenceModule to a system fixture (task #221; third inline copy now lives in this PR's test). ## Verified cargo check -p continuum-core --features metal,accelerate --lib -> clean cargo test -p continuum-core --features metal,accelerate,test-fixtures --test persona_command_inbound_pump -> 1/1 (0.90s) Net diff (after R2 round-1 fixes): src/persona/command_inbound_pump.rs (NEW) +201 lines src/persona/mod.rs +1 line tests/persona_command_inbound_pump.rs (NEW) +191 lines ## Process note Original commit message overclaimed ("this IS the install step"). R2 round-1 called it out cleanly: the module is correct, but until #222 lands a real running substrate STILL silently ignores command envelopes — the exact gap the commit said it closed. This amendment softens the claim to match what actually shipped. The doctrine moves when #222 lands, not before. Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply
force-pushed
the
feat/substrate-command-handler-boot-wiring
branch
from
June 9, 2026 03:32
79ba92a to
155ce60
Compare
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
…stall actually runs in prod now (task #222) PR #1567 landed the install MODULE + a test that called `spawn()` directly. But no production code path called it. This commit closes that gap. After this lands, every persona that boots via `PersonaInstanceManagerModule::bootstrap_one` has the command inbound pump installed by construction. `grep -rn PersonaCommandInboundPump::spawn core/continuum-core/src/` now hits a production call site in `PersonaAircRuntime::bootstrap`. Joel's vision: "every continuum's commands can call worldwide another's commands." This is the wire underneath. ## What lands ### `PersonaAircRuntime::bootstrap` takes `executor: Arc<CommandExecutor>` After the room join, bootstrap calls `PersonaCommandInboundPump::spawn(persona_id, airc, executor).await`. Subscribe failure becomes `PersonaAircRuntimeError::CommandPumpInstall { agent_name, source }` — per `[[no-fallbacks-ever]]`, the substrate refuses to declare a silently-unaddressable persona ready. ### `PersonaAircRuntime::from_attached` stays sync; pump install is opt-in Async pump install can't run inside a sync constructor. Demo binaries + tests that call `from_attached` and want the persona addressable call the new `install_command_pump(&mut self, executor)` method afterwards. `has_command_pump(&self) -> bool` lets telemetry confirm install status. ### `PersonaInstanceManagerModule::bootstrap_one` resolves the executor LAZILY R1+R2 round-1 BLOCK on PR #1568 (this commit's previous version) caught a critical bug: the PR threaded the executor as a PIM field and looked it up eagerly at `start_server`. But `init_executor_with_interceptors` runs ~265 lines LATER in `start_server`, so production boots would have PANICked at PIM construction with "CommandExecutor not initialized." This version fixes that by resolving the executor LAZILY inside `bootstrap_one` (in PIM). `bootstrap_one` is reachable only via a dispatched command (`persona/instances/bootstrap`), and commands dispatch THROUGH the executor — so by the time `bootstrap_one` runs, `init_executor` is GUARANTEED to have completed. The ordering constraint is enforced by the dispatch path itself, not by call-site ordering in `start_server`. PIM keeps its pre-PR `new()` signature (5 args, no executor) so no callers needed signature updates beyond the few already there. ### Drop aborts the pump fire-and-forget Added sync `PersonaCommandInboundPump::abort(&self)` for use in `Drop`. Tokio reaps the aborted task. Clean shutdown callers still have `shutdown(self).await`. ### Callers updated `PersonaAircRuntime::bootstrap` is the only signature that grew. Its one production caller (`PIM::bootstrap_one`) + one in-module test (`legacy_persona_layout_hard_errors_with_mv_command`) were updated. All five `PIM::new` call sites are unchanged from canary (no breaking change to PIM). ## Doctrinal alignment - `[[headless-success-is-personas-talking-over-airc]]` — PR #1567 + this PR together complete the install path. Production substrate boots no longer silently ignore command envelopes. - `[[personas-are-citizens-airc-is-identity-provider]]` — each persona is individually addressable. N personas × N continuums × cross-continuum dispatch has a wire underneath. - `[[no-fallbacks-ever]]` — subscribe failure surfaces as bootstrap-failure with a typed error naming the agent + underlying AircError. No silent-skip path. ## Verified cargo check -p continuum-core --features metal,accelerate --lib -> clean cargo test -p continuum-core --features metal,accelerate,test-fixtures --test persona_command_inbound_pump -> 1/1 (0.89s) cargo test -p continuum-core --features metal,accelerate --lib persona::airc_runtime -> 7/7 Pre-existing canary `vision_integration` breakage NOT in scope. ## Process note R1+R2 round-1 caught the boot-order panic that this commit's previous version introduced. The fix (lazy executor lookup in PIM::bootstrap_one) keeps the architecture clean while removing the eager-lookup ordering dependency entirely. The lesson: type-system constraints on "executor is required" do not enforce "executor is initialized." The dispatch path's own ordering does. ## What this closes - Task #222 (the actual install) - "wire is proven but uninstalled" gap — gone now - Together with PR #1567, the headless-Rust install path is real ## Open follow-ups (filed) - Task #223: Poison-module test for handler-error tolerance Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
…stall actually runs in prod now (task #222) PR #1567 landed the install MODULE + a test that called `spawn()` directly. But no production code path called it. This commit closes that gap. After this lands, every persona that boots via `PersonaInstanceManagerModule::bootstrap_one` has the command inbound pump installed by construction. `grep -rn PersonaCommandInboundPump::spawn core/continuum-core/src/` now hits a production call site in `PersonaAircRuntime::bootstrap`. Joel's vision: "every continuum's commands can call worldwide another's commands." This is the wire underneath. ## What lands ### `PersonaAircRuntime::bootstrap` takes `executor: Arc<CommandExecutor>` After the room join, bootstrap calls `PersonaCommandInboundPump::spawn(persona_id, airc, executor).await`. Subscribe failure becomes `PersonaAircRuntimeError::CommandPumpInstall { agent_name, source }` — per `[[no-fallbacks-ever]]`, the substrate refuses to declare a silently-unaddressable persona ready. ### `PersonaAircRuntime::from_attached` stays sync; pump install is opt-in Async pump install can't run inside a sync constructor. Demo binaries + tests that call `from_attached` and want the persona addressable call the new `install_command_pump(&mut self, executor)` method afterwards. `has_command_pump(&self) -> bool` lets telemetry confirm install status. ### `PersonaInstanceManagerModule::bootstrap_one` resolves the executor LAZILY R1+R2 round-1 BLOCK on PR #1568 (this commit's previous version) caught a critical bug: the PR threaded the executor as a PIM field and looked it up eagerly at `start_server`. But `init_executor_with_interceptors` runs ~265 lines LATER in `start_server`, so production boots would have PANICked at PIM construction with "CommandExecutor not initialized." This version fixes that by resolving the executor LAZILY inside `bootstrap_one` (in PIM). `bootstrap_one` is reachable only via a dispatched command (`persona/instances/bootstrap`), and commands dispatch THROUGH the executor — so by the time `bootstrap_one` runs, `init_executor` is GUARANTEED to have completed. The ordering constraint is enforced by the dispatch path itself, not by call-site ordering in `start_server`. PIM keeps its pre-PR `new()` signature (5 args, no executor) so no callers needed signature updates beyond the few already there. ### Drop aborts the pump fire-and-forget Added sync `PersonaCommandInboundPump::abort(&self)` for use in `Drop`. Tokio reaps the aborted task. Clean shutdown callers still have `shutdown(self).await`. ### Callers updated `PersonaAircRuntime::bootstrap` is the only signature that grew. Its one production caller (`PIM::bootstrap_one`) + one in-module test (`legacy_persona_layout_hard_errors_with_mv_command`) were updated. All five `PIM::new` call sites are unchanged from canary (no breaking change to PIM). ## Doctrinal alignment - `[[headless-success-is-personas-talking-over-airc]]` — PR #1567 + this PR together complete the install path. Production substrate boots no longer silently ignore command envelopes. - `[[personas-are-citizens-airc-is-identity-provider]]` — each persona is individually addressable. N personas × N continuums × cross-continuum dispatch has a wire underneath. - `[[no-fallbacks-ever]]` — subscribe failure surfaces as bootstrap-failure with a typed error naming the agent + underlying AircError. No silent-skip path. ## Verified cargo check -p continuum-core --features metal,accelerate --lib -> clean cargo test -p continuum-core --features metal,accelerate,test-fixtures --test persona_command_inbound_pump -> 1/1 (0.89s) cargo test -p continuum-core --features metal,accelerate --lib persona::airc_runtime -> 7/7 Pre-existing canary `vision_integration` breakage NOT in scope. ## Process note R1+R2 round-1 caught the boot-order panic that this commit's previous version introduced. The fix (lazy executor lookup in PIM::bootstrap_one) keeps the architecture clean while removing the eager-lookup ordering dependency entirely. The lesson: type-system constraints on "executor is required" do not enforce "executor is initialized." The dispatch path's own ordering does. ## What this closes - Task #222 (the actual install) - "wire is proven but uninstalled" gap — gone now - Together with PR #1567, the headless-Rust install path is real ## Open follow-ups (filed) - Task #223: Poison-module test for handler-error tolerance Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
…stall actually runs in prod now (task #222) (#1568) PR #1567 landed the install MODULE + a test that called `spawn()` directly. But no production code path called it. This commit closes that gap. After this lands, every persona that boots via `PersonaInstanceManagerModule::bootstrap_one` has the command inbound pump installed by construction. `grep -rn PersonaCommandInboundPump::spawn core/continuum-core/src/` now hits a production call site in `PersonaAircRuntime::bootstrap`. Joel's vision: "every continuum's commands can call worldwide another's commands." This is the wire underneath. ## What lands ### `PersonaAircRuntime::bootstrap` takes `executor: Arc<CommandExecutor>` After the room join, bootstrap calls `PersonaCommandInboundPump::spawn(persona_id, airc, executor).await`. Subscribe failure becomes `PersonaAircRuntimeError::CommandPumpInstall { agent_name, source }` — per `[[no-fallbacks-ever]]`, the substrate refuses to declare a silently-unaddressable persona ready. ### `PersonaAircRuntime::from_attached` stays sync; pump install is opt-in Async pump install can't run inside a sync constructor. Demo binaries + tests that call `from_attached` and want the persona addressable call the new `install_command_pump(&mut self, executor)` method afterwards. `has_command_pump(&self) -> bool` lets telemetry confirm install status. ### `PersonaInstanceManagerModule::bootstrap_one` resolves the executor LAZILY R1+R2 round-1 BLOCK on PR #1568 (this commit's previous version) caught a critical bug: the PR threaded the executor as a PIM field and looked it up eagerly at `start_server`. But `init_executor_with_interceptors` runs ~265 lines LATER in `start_server`, so production boots would have PANICked at PIM construction with "CommandExecutor not initialized." This version fixes that by resolving the executor LAZILY inside `bootstrap_one` (in PIM). `bootstrap_one` is reachable only via a dispatched command (`persona/instances/bootstrap`), and commands dispatch THROUGH the executor — so by the time `bootstrap_one` runs, `init_executor` is GUARANTEED to have completed. The ordering constraint is enforced by the dispatch path itself, not by call-site ordering in `start_server`. PIM keeps its pre-PR `new()` signature (5 args, no executor) so no callers needed signature updates beyond the few already there. ### Drop aborts the pump fire-and-forget Added sync `PersonaCommandInboundPump::abort(&self)` for use in `Drop`. Tokio reaps the aborted task. Clean shutdown callers still have `shutdown(self).await`. ### Callers updated `PersonaAircRuntime::bootstrap` is the only signature that grew. Its one production caller (`PIM::bootstrap_one`) + one in-module test (`legacy_persona_layout_hard_errors_with_mv_command`) were updated. All five `PIM::new` call sites are unchanged from canary (no breaking change to PIM). ## Doctrinal alignment - `[[headless-success-is-personas-talking-over-airc]]` — PR #1567 + this PR together complete the install path. Production substrate boots no longer silently ignore command envelopes. - `[[personas-are-citizens-airc-is-identity-provider]]` — each persona is individually addressable. N personas × N continuums × cross-continuum dispatch has a wire underneath. - `[[no-fallbacks-ever]]` — subscribe failure surfaces as bootstrap-failure with a typed error naming the agent + underlying AircError. No silent-skip path. ## Verified cargo check -p continuum-core --features metal,accelerate --lib -> clean cargo test -p continuum-core --features metal,accelerate,test-fixtures --test persona_command_inbound_pump -> 1/1 (0.89s) cargo test -p continuum-core --features metal,accelerate --lib persona::airc_runtime -> 7/7 Pre-existing canary `vision_integration` breakage NOT in scope. ## Process note R1+R2 round-1 caught the boot-order panic that this commit's previous version introduced. The fix (lazy executor lookup in PIM::bootstrap_one) keeps the architecture clean while removing the eager-lookup ordering dependency entirely. The lesson: type-system constraints on "executor is required" do not enforce "executor is initialized." The dispatch path's own ordering does. ## What this closes - Task #222 (the actual install) - "wire is proven but uninstalled" gap — gone now - Together with PR #1567, the headless-Rust install path is real ## Open follow-ups (filed) - Task #223: Poison-module test for handler-error tolerance Co-authored-by: Claude Opus 4.7 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR adds
The install step that makes a persona ACTUALLY receive cross-grid commands.
PR #1560 + #1563 proved the wire works in tests. Both tests constructed a
CommandRequestHandler+ spawned a subscribe loop inline. Production never installed the handler anywhere —grep -rn CommandRequestHandler::newminus tests returns zero hits. A real running substrate today silently ignores incomingAircCommandRequestenvelopes.This PR fills that gap with
PersonaCommandInboundPump— a per-persona tokio task that subscribes to the persona's airc handle, filters command-shaped envelopes, and dispatches them throughCommandRequestHandler→CommandExecutor.The pump's contract
Per
[[personas-are-citizens-airc-is-identity-provider]]: the substrate has no airc identity of its own — only personas do. So the pump binds to a persona'sArc<Airc>. When peer_b dispatchesairc://<persona-uuid>/ai/generate, THAT persona's pump receives the envelope.Two-task pattern (chat pump + command pump on the same airc handle):
subscribe()is broadcast-shape (verified in PR test(airc-remote): end-to-end integration through real substrate stack (task #118) #1563 R3 review) — every subscriber sees every event, no contentionPer
[[no-fallbacks-ever]]: subscribe failure surfaces loudly via tracing + the pump task exits. A persona that can't subscribe is unaddressable; we refuse to pretend it can.What the test proves
tests/persona_command_inbound_pump.rs:PersonaCommandInboundPump::spawn(...)— the ONLY production-shape install call; the test never constructsCommandRequestHandleror spawns a manual subscribe loopAircRemoteInferenceAdapter+AircLiveTransportresponse.text.starts_with("[heuristic:")(signature prefix — proves the substrate's FULL dispatch chain ran), prompt echoed,provider == "airc-remote"pump.shutdown()to verify clean-shutdownIf the pump's install path were wrong, the test fails by 30s timeout. If the pump silently dropped command envelopes (the old behavior), the test fails by timeout. Either way, regression is loud.
What's deliberately deferred
PersonaCommandInboundPump::spawn()intoPersonaAircRuntime::bootstrap. Small follow-up; deferred for separate review becausePersonaAircRuntimeowns more state than this PR should touch, and the CommandExecutor question (per-persona vs global) wants a doctrinal check before installing.TestInferenceModuleto a system fixture (task Feature/adaptive complexity phase3 cognition tools redo #221 covers this; third inline copy now lives in this PR's test).Verified
What this closes
[[headless-success-is-personas-talking-over-airc]]— this IS the install step the doctrine assumesNet diff: +190 lines (pump module) + +1 (mod re-export) + +179 (integration test). Zero production-code outside the pump touched.
Generated with Claude Code