Skip to content

feat(persona): wire PersonaCommandInboundPump into bootstrap — the install actually runs in prod now (task #222) - #1568

Merged
joelteply merged 1 commit into
canaryfrom
feat/wire-command-pump-into-bootstrap
Jun 9, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/wire-command-pump-into-bootstrap

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

What this PR does

The actual install. After this lands, every persona that boots via the production path (ipc::start_server → PersonaInstanceManagerModule::bootstrap_one → PersonaAircRuntime::bootstrap) has the command inbound pump installed by construction.

This is the second half of #1567. #1567 landed the install MODULE + a test that called spawn() directly. This PR is the bootstrap-wiring step: grep -rn PersonaCommandInboundPump::spawn now hits a real production call site in PersonaAircRuntime::bootstrap. Without this PR, ctm grid-smoke --peer <persona-uuid> against a real running substrate would time out — substrate isn't listening. With it, the substrate answers.

Joel's vision quote: "every continuum's commands can call worldwide another's commands." This is the wire underneath.

Changes

  • PersonaAircRuntime::bootstrap takes executor: Arc<CommandExecutor>: after room join, calls PersonaCommandInboundPump::spawn(...).await. Subscribe failure → PersonaAircRuntimeError::CommandPumpInstall { agent_name, source } per [[no-fallbacks-ever]]. Bootstrap only returns Ok when the pump is live.
  • PersonaAircRuntime::from_attached stays sync: pump install moves to a new opt-in async method install_command_pump(&mut self, executor). Demo binaries + test fixtures opt in.
  • Added has_command_pump(&self) -> bool: telemetry + tests can confirm install status.
  • Drop aborts the pump: added sync PersonaCommandInboundPump::abort(&self) for use in Drop. Clean shutdown still goes through shutdown(self).await.
  • PersonaInstanceManagerModule takes the executor: threads it to bootstrap. Single production construction site (ipc::start_server) passes crate::runtime::command_executor::executor() (process-global, already initialized by boot ordering).
  • 5 call sites updated: 1 production (ipc/mod.rs), 1 production-shape (spawner_module test that constructs unused PIM), 4 in-module tests + 1 legacy-path test in airc_runtime.rs.

Doctrinal alignment

  • [[headless-success-is-personas-talking-over-airc]] — feat(persona): PersonaCommandInboundPump — install step that makes a persona actually receive cross-grid commands #1567 + this PR together move the substrate from "tests prove the wire CAN work" to "production RUNS the install." ctm grid-smoke against a real running substrate is no longer theoretical.
  • [[personas-are-citizens-airc-is-identity-provider]] — each persona is individually addressable on the grid. 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. No "persona is ready but doesn't answer" mystery state.

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.96s)
  --test airc_remote_inference_end_to_end                                                        → 3/3 (0.91s)
  --test airc_remote_inference_roundtrip                                                         → 1/1 (0.85s)

Pre-existing canary vision_integration breakage NOT in scope (Box vs Arc on AdapterRegistry::register, present before this branch).

Closes

Net diff: +117 / −3 production, +65 test/wiring updates.

Generated with Claude Code

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
joelteply force-pushed the feat/wire-command-pump-into-bootstrap branch from 8664f71 to c2e7360 Compare June 9, 2026 03:59
…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
joelteply force-pushed the feat/wire-command-pump-into-bootstrap branch from c2e7360 to b676b5b Compare June 9, 2026 04:05
@joelteply
joelteply merged commit 577d423 into canary Jun 9, 2026
2 checks passed
@joelteply
joelteply deleted the feat/wire-command-pump-into-bootstrap branch June 9, 2026 04:13
joelteply added a commit that referenced this pull request Jun 9, 2026
…dule::install_executor (task #224) (#1569)

Stage A of the headless-Rust hygiene refactor Joel signed off on:
"do stage a, get everything merged then migrate commands we want to
keep, then build our node as thin and using the uniform client api."

## The disease this kills

`static GLOBAL_EXECUTOR: OnceLock<Arc<CommandExecutor>>` + the panic
accessor `runtime::executor()` made "is X initialized before Y" an
unsolvable-by-types property. PR #1568 round-1 BLOCK caught the exact
shape: PIM::new fetched the global eagerly at construction;
init_executor ran ~265 lines later in start_server; production boots
panicked.

Round-2 fixed PIM with a lazy lookup. This commit kills the global
entirely so the failure mode can't recur on any other module.

Also kills `runtime::command_executor::execute_ts*` free helpers — the
silent-fallback into the legacy TS bridge for unmigrated commands.
The bridge still exists (`executor.execute_ts_json` is a method on the
struct), but every call site is now an explicit
`executor.execute_ts_json(...)` — a legible smell that task #219's
per-command migration can pick off.

Per `[[no-fallbacks-ever]]` + `[[rust-is-the-core-node-is-the-shell]]`:
the type system now enforces "if you have Arc<CommandExecutor>, the
executor exists."

## The shape

1. `ServiceModule::install_executor(executor: Arc<CommandExecutor>)` —
   default-impl no-op on the trait. Modules that dispatch commands
   override to populate their own `OnceLock<Arc<CommandExecutor>>`
   field.

2. `ModuleRegistry::install_executor_on_all(executor)` — walks every
   registered module once at boot, calls `install_executor` on each.
   Modules that don't dispatch get the default no-op for free.

3. `start_server` boot sequence — builds the executor inline AFTER
   the registry is fully populated, then `install_executor_on_all`.
   No more boot-ordering oneshot gate (deleted alongside PR #1568's
   round-2 workaround — the gate is structurally unnecessary now).

## Per-module updates

Every consumer of the deleted globals now holds an
`Arc<CommandExecutor>` threaded in by construction or by
`install_executor`:

- ChannelModule, ChatModule, CognitionModule, AIProviderModule,
  GridModule, GridState, PersonaInstanceManagerModule, SentinelModule —
  store `OnceLock<Arc<CommandExecutor>>`, override `install_executor`.
- `cognition::vision_describe::describe_image` — takes
  `&Arc<CommandExecutor>` parameter; CognitionModule threads its
  installed executor through.
- `sentinel::PipelineContext` — gains an
  `executor: Option<&Arc<CommandExecutor>>` field; step functions
  (web_research, coding_agent, command, llm) consult
  `pipeline_ctx.executor` instead of the deleted free helper.
- `sentinel::executor::execute_pipeline` + `execute_pipeline_direct` —
  take `executor: Option<Arc<CommandExecutor>>` parameter;
  SentinelModule threads its installed executor through.
- `live::transport::livekit_agent::LiveKitAgent` + `LiveKitAgentManager`
  (the feature-gated legacy module) — gain executor field +
  install_executor, threaded through `connect` and
  `spawn_stt_listener`.

## New error variant

`PersonaAircRuntimeError::ExecutorNotInstalled { agent_name }` — what
PIM::bootstrap_one returns if dispatched somehow before install (a
structural impossibility today; named so future regressions surface
as typed errors, not panics).

## Verified

- `cargo check -p continuum-core --lib --features metal,accelerate`
  -> clean (32 pre-existing warnings, 0 errors).
- `cargo check -p continuum-core --tests --features metal,accelerate,test-fixtures`
  -> clean except the pre-existing canary breakage in
  `tests/vision_integration.rs:182` (E0308, Box vs Arc adapter — NOT
  in scope of this refactor).

## What's next (Stage B + C, separate PRs)

- Stage B: per-command migration off the `execute_ts*` legacy bridge —
  task #219. Every TS command we want to keep gets a Rust
  ServiceModule; the rest get deleted. Each migration is a small
  standalone PR.
- Stage C: thin Node client rebuilt on the uniform `Commands.execute`
  API (task #143 / #215).

## Doctrinal alignment

- `[[no-fallbacks-ever]]` — the global panic accessor + silent
  TS-bridge fallthrough were both fallbacks. Both gone. Failure now
  surfaces as typed errors at the call site.
- `[[rust-is-the-core-node-is-the-shell]]` — TS-bridge call sites are
  now individually visible; the per-command migration to pure Rust
  becomes mechanical.
- `[[commands-are-kernel-level-and-compose]]` — `CommandExecutor` is
  now a normal dependency-injected service, not a hidden global. Every
  module that composes commands holds its own handle, explicitly.

Co-authored-by: Claude Opus 4.7 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant