* docs(planning): HEADLESS-PERSONA-HOST-LOOP — slice 13 design
Captures the boot wire-up plan for #133 slice 13 before touching
the load-bearing `ipc::start_server` flow.
Documents:
- The "moment-of-truth" gap: composition pieces from slices 5-12
exist; nothing in continuum-core actually calls them at boot.
- Before/after of the IPC boot loop (~ipc/mod.rs:1024-1089).
- The cleanup model verified during PR #1508's slice-12 review:
.abort() → JoinHandle drop → conversation drop → EventStream drop
→ broadcast::Receiver drop auto-decrements subscriber count. Wire
subscriber is ref-counted across local subscribers; tears down
when runtime Arc reaches 0. No leak; no manual unsubscribe.
- Five open questions with recommendations:
1. Arc<Registry> for build_profile — add model_registry::global_arc()
2. HwCapabilityTier source — HostCapabilityProbe::detect_at_boot()
3. hosted_handles ownership — new PersonaSupervisor module
4. ResumeOrMintProvider role-mapping — slice 14 territory
5. BootSummary event for per-slot failures
- Test plan: PersonaBootstrapper trait split for stubbing.
- Explicit non-goals (shared-base / cross-grid / LoRA / role-aware).
- Doctrine memories worth refreshing on implementation.
Net-additive doc — no code changes. Slice 13 implementation lands
as a follow-up PR.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* docs(planning): rev HEADLESS-PERSONA-HOST-LOOP per PR #1510 review
PR #1510's adversarial reviewer caught 9 findings, 3 blocking.
Substantial revision addresses each:
Blockers:
- Finding #1 (cleanup model wrong): rewritten "Cleanup model" section.
`.abort()` alone is INSUFFICIENT — wire subscriber stays in
Arc<Airc>.inner.subscribers until registry-remove drops the Arc.
Supervisor shutdown path MUST: abort → await → registry.remove.
- Finding #2 (position-pairing broken): elevated to hard prereq P2.
scan_personas_dir sorts alphabetically; boot 2 yields persona
order != plan order on random-derived names. Slice 13 ships with
plan.len() <= 1 (Helper only); slice 14 lands role-in-seed.json
+ RoleAwareProvider before re-enabling Coder.
- Finding #3 (after-code reimplements existing fns): "after" rewrite
uses bootstrap_planned (slice 8) + materialize_adapters (slice 9)
as composition, not open-coded copies. Net-new code ~25 lines, not
~50.
Major:
- Finding #4 (PersonaSupervisor dup with PersonaAircRuntimeRegistry):
Q3 revised to EXTEND the registry — HostedPersonaRuntime owns both
airc_runtime + service_loop JoinHandle. registry.remove becomes
the natural shutdown path. One keyspace, one cleanup chain.
- Finding #5 (no Runtime::shutdown caller): elevated to hard prereq
P1. Slice 13 wires tokio::signal::ctrl_c -> runtime.shutdown.
- Finding #6 (no broker admission for N adapter spawns): elevated to
hard prereq P3. ResourceBroker.acquire before each
factory.build_adapter.
Moderate:
- Finding #7 (detect_host_capability already exists): Q2 restated to
call the existing free function at host_capability_probe.rs:87.
- Finding #8 (global_arc() cost inverted): Q1 recommendation flipped
to (B) — refactor bootstrap_planned to take &Registry. Singleton
storage migration would have touched every callsite of global().
Minor:
- Finding #9 (BootSummary venue): Q5 specifies
MessageBus::publish("persona:boot:summary", ...) with operator
scraping via events/recent; no declared subscribers in slice 13.
- Finding #10 (hot-reload undefined): added as Q6, declared
out-of-scope.
- Finding #11 (wire-subscription failure mid-boot): added as Q7,
supervisor polls JoinHandle::is_finished every 5s.
Plus added implementation checklist at end so slice 13 PR has a
sign-off surface.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* docs(planning): rev2 HEADLESS-PERSONA-HOST-LOOP — match shipped impl + correct cleanup model
PR #1510 re-review (after the first revision) caught:
1. **Cleanup model still wrong** — claimed `ensure_wire_subscriber`
/ `inner.subscribers` (was the 428f928 worktree I was reading,
not the pinned f6ed190). Real mechanism in f6ed190 is
`EventStream::EventStreamInner::Daemon` holding
`DaemonAttachGuard` (`stream.rs:25-68`). On `EventStream` drop,
guard drops, per-channel attach `JoinHandle`s abort.
**`.abort()` ALONE is sufficient** against the pinned rev. The
`shutdown_slot` registry-remove is for in-substrate Arc state
hygiene, not for daemon-side teardown. Section rewritten with
the correct mechanism, file:line cited.
2. **"Hard prerequisites" misrepresented impl scope** — listed
P1 (ctrl_c→shutdown), P3 (broker), Q5 (BootSummary publish),
Q7 (5s poller) as "MUST land" but the implementation explicitly
deferred all four. Restructured to "Slice 13 scope vs deferred
follow-ups" with honest splits: shipped vs deferred + why each
deferral is acceptable (single-persona LCD is in-budget;
`shutdown_slot` available via IPC commands; cleanup model now
shows `.abort()` is sufficient).
3. **"After" snippet didn't match impl** — used
`BootSummary::default()` / `bus.publish` / `summary.failed.push`,
but the impl uses `tracing::info!(hosted=N, failed=N)` counters.
Rewrote the snippet to match what shipped. Notes Q5
(BootSummary publish) as deferred.
Plus the implementation status section is now accurate:
- Q1, Q3, P2, Q2-partial: shipped ✅
- P1, P3, Q5, Q7, Q2-full: deferred to slice 13.5+ ❌
- Integration polish in #1511: room-name discovery + LCD model
registry entry + PersonaContext rename + RagInspectionRequest::
for_persona derivation site (the `&ctx` doctrine)
- Integration validation: Paige replied in continuum room
Co-Authored-By: Claude Opus 4.7 <[email protected]>
---------
Co-authored-by: Claude Opus 4.7 <[email protected]>
Summary
spawn_persona_service(hosted, runtime, opts, rt_handle) -> JoinHandle<Result<ServeOutcome, String>>— the composition seam between the substrate's planning surface (slices 5-11, merged in feat(persona): citizen substrate + cognition cache hierarchy foundation (slices 1-6) #1507) and the headless boot loop.crate::ipc::start_server's existing bootstrap loop. Slice 13 wires this helper into the boot path.Arc<Airc>toArc<dyn AircTranscriptReader>(zero-cost; impl atairc_source.rs:74), constructAircPersonaConversation,rt_handle.spawn(serve_persona_loop(...)).Doctrine
Arc<PersonaAircRuntime>+ airc-lib sockets — no stdin/stdout.Handle; no hidden thread spawns.JoinHandleresolves withErr(message)fromserve_persona_loopfailures; no implicit retry / no substitution.Why split helper from wire-up
The helper is a 3-line composition; the wire-up (slice 13) rewrites the IPC boot loop at
~ipc/mod.rs:1024to:bootstrap_one(&intent)succeeds, build the inference profile viabuild_profile(slice 5).LlamaCppPersonaAdapterFactory(slice 9).HostedPersona(slice 9).spawn_persona_service(this PR) to start hosting.JoinHandles for graceful shutdown.That's a load-bearing boot-flow rewrite. Splitting keeps each commit reviewable — this PR is the unit-testable composition seam; slice 13 is the consumer.
Reference docs
src/workers/continuum-core/src/persona/host.rs(new),src/workers/continuum-core/src/persona/mod.rs(registers the module)Test plan
cargo build --bin airc_chat_demo --no-default-features --features livekit-webrtc,accelerate,llama/mac-cpu-only,load-dynamic-ortpasses (verified locally before push)cargo test --lib persona::slice-related modules stay green (verified locally — service_loop, supervisor, spawner, spawner_module all pass)spawn_persona_serviceitself — composition is 3 lines, types check; integration test happens via slice 13's IPC boot pathpersona::allocator::test_allocate_no_keysfailure on canary is tracked separately (task Build(deps-dev): Bump @types/node from 22.14.0 to 24.7.0 #138), unrelated to this PR🤖 Generated with Claude Code