Repository navigation
feat(ai): AircRemoteInferenceAdapter — cross-grid inference as first-class AIProviderAdapter (task #108 slice C) - #1560
Merged
Conversation
…t-class AIProviderAdapter (task #108 slice C) A persona on an Intel Mac can now register an adapter that dispatches inference at airc://<rtx5090>/ai/generate transparently. From the cognition path's perspective it's just another AIProviderAdapter; the inference happens on another machine but the substrate doesn't have to care. The Tron-grid frame ([[the-substrate-is-the-grid-tron-frame]]) becomes literal at the inference seam. What lands: core/continuum-core/src/ai/airc_remote_adapter.rs (NEW) pub struct AircRemoteInferenceAdapter { airc, target_peer, ... } pub const AIRC_REMOTE_PROVIDER_PREFIX = "airc-remote" impl AIProviderAdapter: provider_id() = "airc-remote/<peer-uuid>" name() = "airc-remote (cross-grid inference)" capabilities() = conservative text-only chat-only default; operator overrides via with_capabilities() once they know what the remote runs api_style() = ApiStyle::Local default_model() = constructor-supplied initialize/shutdown = no-op (remote owns model state) generate_text(request): serialize request → AircCommandRequest{path="ai/generate", kind=KIND_PEER, params=request_json} → stamp wire headers per continuum-airc-protocol → airc.request to MentionTarget::Peer → await_reply → decode AircCommandResponse → decode TextGenerationResponse create_embedding = NotImplemented (slice C follow-up at ai/embed) health_check = Healthy by construction (live probe deferred) get_available_models = conservative single-entry list (remote registry probe deferred) Builder: with_deadline(), with_capabilities() core/continuum-core/src/ai/mod.rs pub mod airc_remote_adapter core/continuum-core/tests/airc_remote_inference_roundtrip.rs (NEW) Live wire test using TwoAircLoopback: peer_a = "the 5090" — hosts substrate-equivalent ai/generate responder using REAL CommandRequestHandler::parse_envelope + send_reply (catches drift between adapter wire and substrate parser — same pattern as airc_ipc_roundtrip.rs). peer_b = "the Intel Mac" — has AircRemoteInferenceAdapter pointed at peer_a, calls .generate_text(request). Asserts: - wire envelope kind == KIND_PEER, path == "ai/generate", env == None - params decode as TextGenerationRequest on substrate side - typed TextGenerationResponse decodes correctly on adapter side - all fields round-trip (text, model, provider, usage, request_id) Verified: cargo test -p continuum-core --features metal,accelerate --lib ai::airc_remote_adapter → 2/2 unit (0.0s) --test airc_remote_inference_roundtrip → 1/1 integration (1.16s) Closes task #108 slice C (the adapter itself + first live test). Follow-up slices already named in task #108 sub-tasks: - #117 slice D: Production AircInferenceTransport (live airc daemon — same wire, but the remote responder is a REAL ai/generate handler dispatching through its CommandExecutor instead of a canned response) - #118 slice E: Peer-side handler — receive remote inference envelopes, route to local adapter (already exists today as CommandRequestHandler; slice E adds the inference-specific routing + per-persona auth gate) - Probe pings to refresh AdapterCapabilities + ModelInfo from the remote on a cadence (no more "conservative defaults") - Embedding support (ai/embed roundtrip via the same adapter) Co-Authored-By: Claude Opus 4.7 <[email protected]>
…lth-check lie, close drift coverage PR #1560 round 1 came back with three BLOCK verdicts: R1 (correctness + wire, 78 conf): health_check returns Healthy by construction, AdapterRegistry's selector then routes traffic to a dead remote R2 (architecture + compression): DUPLICATE adapter — I built core/continuum-core/src/ai/airc_remote_adapter.rs unaware that core/continuum-core/src/inference/airc_remote/{adapter,protocol, transport}.rs already existed (1098 lines, better-shaped via transport-trait injection). Two parallel implementations of the same concept violates compression principle + the no-backcompat- for-unmerged-code doctrine R3 (test coverage): 3 of 12 drift surfaces not caught — HEADER_COMMAND_PATH, HEADER_COMMAND_KIND (stamped but never asserted on the request), COMMAND_RESPONSE_BODY_HINT (not asserted on the reply) Round 2 (this commit) takes the elegant reconciliation: - DELETE my new duplicate `core/continuum-core/src/ai/airc_remote_ adapter.rs` (R2 fix). Keep the existing transport-trait abstraction in `core/continuum-core/src/inference/airc_remote/` — better- shaped because the adapter is a no-mechanics wrapper and the transport owns all the airc framing (testable without standing up an Airc). - ADD production transport `AircLiveTransport` to the existing `inference/airc_remote/transport.rs` (R2 fix). The missing piece that explains why a new file looked necessary in the first place — but it belongs IN the existing module as the live impl of the existing trait, not as a parallel adapter. Wraps Arc<Airc> + target PeerId + deadline; implements AircInferenceTransport by building AircCommandRequest{path=ai/generate, kind=KIND_PEER, params=text_request_json}, stamping headers per the airc-headers- are-the-routing-layer doctrine, dispatching via Airc::request + await_reply. Errors classify by airc-lib's message substring (timeout vs transport) so the coordinator's retry policy distinguishes them. Closes task #117 (production transport). - FIX health_check (R1 fix). Adapter now holds AtomicBool has_observed_success. health_check returns Unhealthy (not Healthy) until the first generate_text round-trip succeeds. Per the no-fallbacks-ever doctrine: lying Healthy on an unproven peer routes real traffic to a dead remote; pessimistic Unhealthy is the safe default. Once one round-trip succeeds, flips to Healthy. Two new unit tests pin both transitions. NOTE: HealthState has no Unknown variant; adding one is a wire change (TS binding consumer impact) and out of scope for this PR. Unhealthy is the closest existing semantic for "do not route here." A follow-up slice can add Unknown if the substrate's health surface grows that nuance. - CLOSE drift coverage in integration test (R3 fix). Three new explicit assertions: * HEADER_COMMAND_PATH on the outbound request envelope * HEADER_COMMAND_KIND on the outbound request envelope * COMMAND_RESPONSE_BODY_HINT + HEADER_COMMAND_STATUS on the substrate's reply (via a sniffer task on peer_b's inbound stream — peer_b's subscribe captures the substrate's reply headers without waiting for await_reply, so test can assert them after await_reply returns) Integration test now exercises ALL 12 drift surfaces. A refactor that drops any of the three previously-uncovered headers breaks loudly here. What the test file proves end-to-end (after this commit): Request side (caller -> substrate parse_envelope): - kind == KIND_PEER, path == ai/generate, env == None - HEADER_COMMAND_PATH stamps the path - HEADER_COMMAND_KIND stamps the kind - HEADER_CONTINUUM_BODY_HINT == COMMAND_REQUEST_BODY_HINT - params decode as TextGenerationRequest - messages survived round-trip Reply side (substrate send_reply -> caller decode): - reply body is Body::Json - HEADER_COMMAND_STATUS == ok - HEADER_CONTINUUM_BODY_HINT == COMMAND_RESPONSE_BODY_HINT - AircCommandResponse::Ok carries serialized TextGenerationResponse - All TextGenerationResponse fields round-trip Verified: cargo check -p continuum-core --features metal,accelerate -> clean cargo test -p continuum-core --features metal,accelerate --lib inference::airc_remote -> 28/28 unit (0.48s) --test airc_remote_inference_roundtrip -> 1/1 integration (0.95s) Net diff: -354 (deleted ai/airc_remote_adapter.rs) +212 (transport AircLiveTransport) +98 (adapter health_check + tests) +158 (test header assertions) +4 (mod re-exports) -1 (ai/mod.rs registration). Reviewers' BLOCKs addressed without losing what landed (live wire proof against substrate's real parse_envelope + send_reply, the same-command-across-the-wire architectural proof, conservative- defaults capability shape per the no-fallbacks-ever doctrine). Co-Authored-By: Claude Opus 4.7 <[email protected]>
2 of 4 tasks
…, harden integration test Three round-2 reviewers cleared the round-1 BLOCKs: R1 APPROVE (90 conf) — health-check lie genuinely fixed R2 LGTM-WITH-NOTES (84 conf) — duplicate gone; two doctrinal nits R3 LGTM-WITH-NOTES (82 conf) — drift coverage closed; flake + diagnostics nits Per [[agent-review-as-acceptable-approval]] that's approval. This commit applies the cheap doctrinal cleanups in-place so merge ships at the quality bar Joel set with "purist in every way." R2-N1: deduplicate `build_headers`. The new `AircLiveTransport::build_headers` in round 2 was 4 lines of `headers.insert()` calls that exactly mirror `routing::airc_transport::AircTransport::build_headers` (env=None on our envelopes, so the env-header branch of the canonical function is a no-op). R2's verdict: "the exact compression violation R1 BLOCK was about, re-introduced at a smaller scale within the fix commit." Fix: delete the duplicate, call the canonical `AircTransport::build_headers(&envelope)` at the one dispatch site. One logical decision in one place; if `AircCommandRequest` evolves, both call sites drift together by construction. R2-N2: stale mod-doc. `inference/airc_remote/mod.rs` still claimed the production transport was a "follow-up slice (task #108)" — but round 2 IS the production transport. Also `LocalAdapterTransport` re-exported but never mentioned in the module layout block. Replaced the stale bullet with explicit one-line summaries of all three transport impls: AircLiveTransport (production), LocalAdapterTransport (in-process passthrough for tests + replay), StubInferenceTransport (closure stub for error/correlation branches). R3-N1: convert filter to assert on HEADER_CONTINUUM_BODY_HINT. Round-2 test had: let hint = event.headers.get(HEADER_CONTINUUM_BODY_HINT)?; if hint != COMMAND_REQUEST_BODY_HINT { continue; } Drift in AircLiveTransport's hint stamping would silently skip the event, await_reply times out at 30s (DEFAULT_COMMAND_DEADLINE), test fails with a generic Timeout panic — not a named-surface assertion. Same diagnostic-only-vs-coverage shape R3 BLOCKed on in round 1, at smaller scale. Fix: keep the `continue` on absent hint (control frames + keepalives legitimately have no body_hint), but ASSERT the value matches COMMAND_REQUEST_BODY_HINT once a body_hint is present. Drift now fails with: "wire header HEADER_CONTINUUM_BODY_HINT must stamp COMMAND_REQUEST_BODY_HINT for ai/generate dispatch; got {hint}". R3-N4: replace 50ms sleep barrier with `tokio::sync::Notify`. The test had a `sleep(50ms)` to give the responder + sniffer time to install their `subscribe()` calls before the adapter dispatched. Flaky on loaded CI. Fix: each spawn function takes an `Arc<tokio::sync::Notify>` and signals it AFTER `peer.subscribe().await` returns. The test waits on both notifies before dispatch. Wall-clock faster too (no fixed 50ms floor) — test runs in 0.89s instead of 0.95s in the integration suite, deterministically. Deferred follow-up notes (filed in PR body as known follow-ups, not landed in this PR): R3-N2: correlation_id round-trip not explicitly asserted. Drift would cause 30s timeout, not a typed assertion. Follow-up: capture `pending.correlation_id` from a transport-side hook (or expose it to tests) and assert against the sniffed reply's HEADER_AIRC_CORRELATION_ID. R3-N3: AircCommandResponse::Error variant uncovered. The OK path is the only one wired in this test; if send_reply ever stamped "ok" unconditionally, this test passes. Follow-up: a second test method swapping `canned` for `AircCommandResponse::error(...)` closing the error-status-stamping integration gap. Unit test for the error variant exists in transport.rs::local_adapter_transport_ propagates_peer_adapter_errors; substrate's send_reply error-stamping path has no integration coverage. Verified after polish: cargo check -p continuum-core --features metal,accelerate -> clean cargo test -p continuum-core --features metal,accelerate --lib inference::airc_remote -> 28/28 unit (0.45s) --test airc_remote_inference_roundtrip -> 1/1 integration (0.89s, deterministic — no sleep) Net diff over 113b5f7: transport.rs: -15 (delete build_headers), +6 (import AircTransport + 1-line comment at call site) mod.rs: -4 (stale bullet), +11 (3 transport impls explicit) test: -3 (drop Duration import + 50ms sleep), +28 (Notify barriers + assert-on-hint) Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
…lth-check lie, close drift coverage PR #1560 round 1 came back with three BLOCK verdicts: R1 (correctness + wire, 78 conf): health_check returns Healthy by construction, AdapterRegistry's selector then routes traffic to a dead remote R2 (architecture + compression): DUPLICATE adapter — I built core/continuum-core/src/ai/airc_remote_adapter.rs unaware that core/continuum-core/src/inference/airc_remote/{adapter,protocol, transport}.rs already existed (1098 lines, better-shaped via transport-trait injection). Two parallel implementations of the same concept violates compression principle + the no-backcompat- for-unmerged-code doctrine R3 (test coverage): 3 of 12 drift surfaces not caught — HEADER_COMMAND_PATH, HEADER_COMMAND_KIND (stamped but never asserted on the request), COMMAND_RESPONSE_BODY_HINT (not asserted on the reply) Round 2 (this commit) takes the elegant reconciliation: - DELETE my new duplicate `core/continuum-core/src/ai/airc_remote_ adapter.rs` (R2 fix). Keep the existing transport-trait abstraction in `core/continuum-core/src/inference/airc_remote/` — better- shaped because the adapter is a no-mechanics wrapper and the transport owns all the airc framing (testable without standing up an Airc). - ADD production transport `AircLiveTransport` to the existing `inference/airc_remote/transport.rs` (R2 fix). The missing piece that explains why a new file looked necessary in the first place — but it belongs IN the existing module as the live impl of the existing trait, not as a parallel adapter. Wraps Arc<Airc> + target PeerId + deadline; implements AircInferenceTransport by building AircCommandRequest{path=ai/generate, kind=KIND_PEER, params=text_request_json}, stamping headers per the airc-headers- are-the-routing-layer doctrine, dispatching via Airc::request + await_reply. Errors classify by airc-lib's message substring (timeout vs transport) so the coordinator's retry policy distinguishes them. Closes task #117 (production transport). - FIX health_check (R1 fix). Adapter now holds AtomicBool has_observed_success. health_check returns Unhealthy (not Healthy) until the first generate_text round-trip succeeds. Per the no-fallbacks-ever doctrine: lying Healthy on an unproven peer routes real traffic to a dead remote; pessimistic Unhealthy is the safe default. Once one round-trip succeeds, flips to Healthy. Two new unit tests pin both transitions. NOTE: HealthState has no Unknown variant; adding one is a wire change (TS binding consumer impact) and out of scope for this PR. Unhealthy is the closest existing semantic for "do not route here." A follow-up slice can add Unknown if the substrate's health surface grows that nuance. - CLOSE drift coverage in integration test (R3 fix). Three new explicit assertions: * HEADER_COMMAND_PATH on the outbound request envelope * HEADER_COMMAND_KIND on the outbound request envelope * COMMAND_RESPONSE_BODY_HINT + HEADER_COMMAND_STATUS on the substrate's reply (via a sniffer task on peer_b's inbound stream — peer_b's subscribe captures the substrate's reply headers without waiting for await_reply, so test can assert them after await_reply returns) Integration test now exercises ALL 12 drift surfaces. A refactor that drops any of the three previously-uncovered headers breaks loudly here. What the test file proves end-to-end (after this commit): Request side (caller -> substrate parse_envelope): - kind == KIND_PEER, path == ai/generate, env == None - HEADER_COMMAND_PATH stamps the path - HEADER_COMMAND_KIND stamps the kind - HEADER_CONTINUUM_BODY_HINT == COMMAND_REQUEST_BODY_HINT - params decode as TextGenerationRequest - messages survived round-trip Reply side (substrate send_reply -> caller decode): - reply body is Body::Json - HEADER_COMMAND_STATUS == ok - HEADER_CONTINUUM_BODY_HINT == COMMAND_RESPONSE_BODY_HINT - AircCommandResponse::Ok carries serialized TextGenerationResponse - All TextGenerationResponse fields round-trip Verified: cargo check -p continuum-core --features metal,accelerate -> clean cargo test -p continuum-core --features metal,accelerate --lib inference::airc_remote -> 28/28 unit (0.48s) --test airc_remote_inference_roundtrip -> 1/1 integration (0.95s) Net diff: -354 (deleted ai/airc_remote_adapter.rs) +212 (transport AircLiveTransport) +98 (adapter health_check + tests) +158 (test header assertions) +4 (mod re-exports) -1 (ai/mod.rs registration). Reviewers' BLOCKs addressed without losing what landed (live wire proof against substrate's real parse_envelope + send_reply, the same-command-across-the-wire architectural proof, conservative- defaults capability shape per the no-fallbacks-ever doctrine). Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
…k (task #118) (#1563) * test(airc-remote): end-to-end integration through real substrate stack (task #118 slice E) Closes the load-bearing gap PR #1560's wire test left open. That test proved the wire SHAPE was correct (parse_envelope + send_reply accept the right envelope shapes + headers) but HAND-CANNED the response substrate-side. The substrate's actual CommandExecutor + ServiceModule + AIProviderAdapter dispatch chain was never exercised across the airc wire. This commit closes that gap with three integration tests that run peer_a as the FULL substrate stack: CommandRequestHandler::on_envelope -> parse_envelope [REAL] -> process_request_via(&executor) [REAL] -> CommandExecutor::execute_with_caller -> AuthPolicy::gate (AllowAll) [REAL] -> TestInferenceModule::handle_command -> {Heuristic|AlwaysFailing}InferenceAdapter::generate_text [REAL] -> AircCommandResponse::ok(result) or ::error(msg) -> send_reply [REAL] No canned responses. peer_b runs AircRemoteInferenceAdapter via AircLiveTransport and observes whatever the substrate actually produces. Three test cases: 1. end_to_end_heuristic_dispatch_through_substrate_stack — happy path. HeuristicInferenceAdapter answers; assert response.text starts with "[heuristic:" prefix (the adapter's deterministic signature, which no canned test stub can produce) AND contains the prompt ("hello grid") AND response.provider == "airc-remote" (added by the caller-side adapter layer). Proves a real adapter executed substrate-side end-to-end. 2. end_to_end_peer_adapter_failure_surfaces_as_typed_error — error path. AlwaysFailingAdapter returns Err substrate-side; AircCommandResponse::error propagates through; caller's AircLiveTransport classifies as RemoteInferenceError::PeerAdapterFailed. Closes task #218 (deferred from PR #1560 R3-N3 review). 3. end_to_end_missing_module_returns_typed_error — observability test. peer_a's executor has NO module registered. Surfaces what the substrate CURRENTLY does, which is to fall through to the legacy TypeScript bridge at /tmp/jtag-command-router.sock. The test pins THAT behavior so any future change is loud. The fall-through is itself a [[no-fallbacks-ever]] violation worth a dedicated slice (filed as task #219). Design notes captured in the test file doc-block: - Why a test-only ServiceModule (TestInferenceModule) instead of AIProviderModule: the latter uses a process-global AdapterRegistry that fights with multi-test parallelism. The substrate's wire path is module-agnostic, so any ServiceModule registered for "ai/generate" exercises the same dispatch chain. TestInferenceModule wraps an Arc<dyn AIProviderAdapter> directly so each test owns its own adapter instance, no global mutation, tests run in parallel. - Why TestInferenceModule and not just inline canned modules: gives the test access to the real AIProviderAdapter trait, which is what a production deployment uses. Swapping HeuristicInferenceAdapter for AlwaysFailingAdapter (in the same TestInferenceModule shape) keeps the per-test wiring identical and isolates the test variable to JUST the adapter behavior. - Why we clone the Arc<TranscriptEvent> at the on_envelope boundary: airc-lib's subscribe() yields broadcast-shape Arc<TranscriptEvent> so multiple subscribers see the same event. ConsumerAdapter::on_envelope takes by owned value, so we deref-clone. A productized dispatch loop does the same — the Arc only exists for fan-out, not for ownership transfer. Closes: - Task #118 (peer-side handler — receive remote inference envelopes, route to local adapter) - Task #218 (PR #1560 follow-up: AircCommandResponse::Error variant integration coverage) Surfaces (filed as follow-ups, not addressed here): - Task #219 (CommandExecutor TS-bridge fallback is a [[no-fallbacks-ever]] violation — should hard-error on missing module in headless-Rust deployments) Verified: cargo test -p continuum-core --features metal,accelerate,test-fixtures --test airc_remote_inference_end_to_end -> 3/3 passed (0.96s) Net diff: +405 lines new test file. Zero production-code changes — the proof that the wire is right is itself the new artifact. Co-Authored-By: Claude Opus 4.7 <[email protected]> * polish(test): R1 LGTM-WITH-NOTES on PR #1563 — tighten error-path + missing-module assertions R1 LGTM-WITH-NOTES (88 conf, round 1) on PR #1563 flagged two assertion shapes that gate less than declared: N1 (error path): `err.contains("peer adapter failed") OR "the model exploded"`. The first branch literally NEVER matches because the Display impl in `RemoteInferenceError::PeerAdapterFailed` is `"remote peer's adapter failed: ..."` (apostrophe-s). The test passed only via the message-passthrough branch, which means it gated "the error message propagated" but NOT "the typed variant was taken." A future change that surfaced "the model exploded" through a different variant (e.g. `Transport { message }` wrapping the substrate error) would pass too. Fix: AND-pin both `"peer's adapter failed"` (the correct apostrophe-s surface) AND `"the model exploded"`. Now the test fails loudly if either the variant changes OR the inner message gets swallowed/ rewritten. N2 (missing module): 5-branch OR including `"ai/generate"` matched almost any plausible error. Author explicitly noted the test was meant to pin TODAY's behavior so when task #219 lands (CommandExecutor hard-errors on missing module instead of falling through to TS bridge) the test SHOULD fail and force maintenance. As written it wouldn't — `"ai/generate"` matches even a silent 200-on-nothing if the success payload happened to include the path. Fix: pin EXACTLY the TS-bridge connect-failure surface (`"commandrouterserver"` OR `"jtag-command-router"`). When #219 lands the test fails loudly with a self-documenting panic message telling the maintainer exactly what changed and what to update. The looser branches removed: `"ai/generate"`, `"no handler"`, `"no module"`. Both findings are observability bugs in the test — the test author declared the test caught X but it actually caught X-or-Y. Per [[every-error-is-an-opportunity-to-battle-harden]] these tighten to catch exactly X. Verified: cargo test -p continuum-core --features metal,accelerate,test-fixtures --test airc_remote_inference_end_to_end -> 3/3 passed (0.94s) Net diff: 2 hunks, +30 / -15 in the existing test file. Same three tests; stricter pins per test. Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
…ode + docs Joel called this out: is 5090 coded into the repo? Yes — GPU-specific narrative and operator-personal labels leaked into substrate source, test fixtures, and doc-strings across today's PRs (#1560, #1561, #1563, #1564). None were load-bearing, but the repo should be hardware-agnostic. Replacements (one PR, surgical edits): core/continuum-core/src/inference/airc_remote/adapter.rs - doc: "route to Joel's 5090" -> generic remote-inference-peer description - test fixture: "joels-5090" -> "test-remote-peer" core/continuum-core/src/inference/airc_remote/transport.rs - test fixture: "joels-5090" (2 sites) -> "test-remote-peer" core/continuum-core/tests/airc_remote_inference_roundtrip.rs - doc: "airc://<rtx5090>/ai/generate" -> "airc://<remote-peer>/ai/generate" - peer labels generic: "remote inference host" / "local caller" - canned response: "pong from the remote peer" / "test-model" / "test-remote-llamacpp" apps/cli/src/main.rs - Generate doc: "(e.g., the operator's 5090)" -> generic GPU-rich grid host apps/cli/src/grid_smoke.rs - module doc + ai/generate row comment: "constrained-locally host dispatches at a GPU-rich peer" / "If the target is a GPU host running a real LLM" Out of scope: - Older codebase doctrine attributions ("Joel's never-swallow-errors") stay — those name doctrine origin, fine. - Task #85 mentioning 5090 stays — it's a real airc bug ticket about that hardware. Verified: grep -rn "5090|joels-" on touched files -> zero hits cargo check -p continuum-cli -> clean (1.94s) The pattern lesson: any hardware-specific identity is narrative scaffolding, not substrate truth. The substrate is hardware-agnostic; tests use neutral labels; docs describe categories, not specific units. Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
…ode + docs (#1565) Joel called this out: is 5090 coded into the repo? Yes — GPU-specific narrative and operator-personal labels leaked into substrate source, test fixtures, and doc-strings across today's PRs (#1560, #1561, #1563, #1564). None were load-bearing, but the repo should be hardware-agnostic. Replacements (one PR, surgical edits): core/continuum-core/src/inference/airc_remote/adapter.rs - doc: "route to Joel's 5090" -> generic remote-inference-peer description - test fixture: "joels-5090" -> "test-remote-peer" core/continuum-core/src/inference/airc_remote/transport.rs - test fixture: "joels-5090" (2 sites) -> "test-remote-peer" core/continuum-core/tests/airc_remote_inference_roundtrip.rs - doc: "airc://<rtx5090>/ai/generate" -> "airc://<remote-peer>/ai/generate" - peer labels generic: "remote inference host" / "local caller" - canned response: "pong from the remote peer" / "test-model" / "test-remote-llamacpp" apps/cli/src/main.rs - Generate doc: "(e.g., the operator's 5090)" -> generic GPU-rich grid host apps/cli/src/grid_smoke.rs - module doc + ai/generate row comment: "constrained-locally host dispatches at a GPU-rich peer" / "If the target is a GPU host running a real LLM" Out of scope: - Older codebase doctrine attributions ("Joel's never-swallow-errors") stay — those name doctrine origin, fine. - Task #85 mentioning 5090 stays — it's a real airc bug ticket about that hardware. Verified: grep -rn "5090|joels-" on touched files -> zero hits cargo check -p continuum-cli -> clean (1.94s) The pattern lesson: any hardware-specific identity is narrative scaffolding, not substrate truth. The substrate is hardware-agnostic; tests use neutral labels; docs describe categories, not specific units. Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
… 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
added a commit
that referenced
this pull request
Jun 9, 2026
… command dispatch (install module; bootstrap wiring follows in #222) (#1567) 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
added a commit
that referenced
this pull request
Sep 17, 2026
…con — stop sending a rescued citizen back to a never-serving peer (ad96f5d1) The placement return gate (`decide()`, Seat::Home arm) was `fresh && !lane_cold && cooled`, where `fresh` is BEACON age — liveness, not service. Measured on the Intel tier 2026-09-17 (Cormac, card ad96f5d1): the peer-keyed breaker fell Saoirse home, then five minutes later — the moment COLD_WINDOW lapsed and the beacon was still fresh — she was returned to e85a5bb3, a peer that has never answered a single request in this node's entire history (`remote_lane.answered` = 0 all-time). A beacon proves the peer is ALIVE; it does not prove it will ANSWER, and a node that beacons perfectly and serves nothing is the most attractive dead seat on the grid. #1560 already won this argument one layer down — `has_observed_success` makes `health_check` admit "no signal" until traffic proves a peer reachable, so the SELECTOR does not route to an unproven peer. The placement gate made the identical mistake for SEAT selection and never asked. The fix, composing with the peer-keyed breaker (#4173): the service signal, like the fault, is a fact about the PEER not who asked, so it moves onto `PeerBreaker` (`ever_served` / `ever_observed`, set in `observe_answer`/`observe_timeout`) exposed as `served_ok()`. The Seat::Home arm becomes `fresh && !lane_cold && cooled && peer_served_ok`. Same registry, same keying, opposite polarity: the breaker decides when to LEAVE on summed FAILURE, `served_ok` decides when it is safe to GO BACK on summed SUCCESS. The self-sealing wrinkle — a never-served peer would never receive a first placement — is resolved by `served_ok = ever_served || never-observed`: a proven-bad peer (tried, only timeouts, e85a5bb3) is blocked; a brand-new UNTRIED peer reads optimistic and gets its first chance. #1560's strict reading was about not ROUTING to an unproven peer; refusing to ever TRY one is the worse, self-sealing failure. `breaker_for` returns a pristine (served_ok = true) entry for a peer never seen, so `follow_the_fleet` never self-seals a new seat. Also folds in Cormac's #4173 re-review test (same file): a miss while the peer is ALREADY cold does not re-trip — exercises the CAS warm-guard refusal branch, distinct from the count-reset path. On this tier e85a5bb3 is proven-bad, so the flap cannot form. NOT the root: the root is that cross-grid inference was never addressable (the receiving node refuses every `ai/generate` with request_not_for_me — card c34034b9), a separate transport fix. This closes the placement flap that root produced. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Sep 17, 2026
…con — stop sending a rescued citizen back to a never-serving peer (ad96f5d1) The placement return gate (`decide()`, Seat::Home arm) was `fresh && !lane_cold && cooled`, where `fresh` is BEACON age — liveness, not service. Measured on the Intel tier 2026-09-17 (Cormac, card ad96f5d1): the peer-keyed breaker fell Saoirse home, then five minutes later — the moment COLD_WINDOW lapsed and the beacon was still fresh — she was returned to e85a5bb3, a peer that has never answered a single request in this node's entire history (`remote_lane.answered` = 0 all-time). A beacon proves the peer is ALIVE; it does not prove it will ANSWER, and a node that beacons perfectly and serves nothing is the most attractive dead seat on the grid. #1560 already won this argument one layer down — `has_observed_success` makes `health_check` admit "no signal" until traffic proves a peer reachable, so the SELECTOR does not route to an unproven peer. The placement gate made the identical mistake for SEAT selection and never asked. The fix, composing with the peer-keyed breaker (#4173): the service signal, like the fault, is a fact about the PEER not who asked, so it moves onto `PeerBreaker` (`ever_served` / `ever_observed`, set in `observe_answer`/`observe_timeout`) exposed as `served_ok()`. The Seat::Home arm becomes `fresh && !lane_cold && cooled && peer_served_ok`. Same registry, same keying, opposite polarity: the breaker decides when to LEAVE on summed FAILURE, `served_ok` decides when it is safe to GO BACK on summed SUCCESS. The self-sealing wrinkle — a never-served peer would never receive a first placement — is resolved by `served_ok = ever_served || never-observed`: a proven-bad peer (tried, only timeouts, e85a5bb3) is blocked; a brand-new UNTRIED peer reads optimistic and gets its first chance. #1560's strict reading was about not ROUTING to an unproven peer; refusing to ever TRY one is the worse, self-sealing failure. `breaker_for` returns a pristine (served_ok = true) entry for a peer never seen, so `follow_the_fleet` never self-seals a new seat. Also folds in Cormac's #4173 re-review test (same file): a miss while the peer is ALREADY cold does not re-trip — exercises the CAS warm-guard refusal branch, distinct from the count-reset path. On this tier e85a5bb3 is proven-bad, so the flap cannot form. NOT the root: the root is that cross-grid inference was never addressable (the receiving node refuses every `ai/generate` with request_not_for_me — card c34034b9), a separate transport fix. This closes the placement flap that root produced. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Sep 17, 2026
…con — stop sending a rescued citizen back to a never-serving peer (ad96f5d1) (#4176) The placement return gate (`decide()`, Seat::Home arm) was `fresh && !lane_cold && cooled`, where `fresh` is BEACON age — liveness, not service. Measured on the Intel tier 2026-09-17 (Cormac, card ad96f5d1): the peer-keyed breaker fell Saoirse home, then five minutes later — the moment COLD_WINDOW lapsed and the beacon was still fresh — she was returned to e85a5bb3, a peer that has never answered a single request in this node's entire history (`remote_lane.answered` = 0 all-time). A beacon proves the peer is ALIVE; it does not prove it will ANSWER, and a node that beacons perfectly and serves nothing is the most attractive dead seat on the grid. #1560 already won this argument one layer down — `has_observed_success` makes `health_check` admit "no signal" until traffic proves a peer reachable, so the SELECTOR does not route to an unproven peer. The placement gate made the identical mistake for SEAT selection and never asked. The fix, composing with the peer-keyed breaker (#4173): the service signal, like the fault, is a fact about the PEER not who asked, so it moves onto `PeerBreaker` (`ever_served` / `ever_observed`, set in `observe_answer`/`observe_timeout`) exposed as `served_ok()`. The Seat::Home arm becomes `fresh && !lane_cold && cooled && peer_served_ok`. Same registry, same keying, opposite polarity: the breaker decides when to LEAVE on summed FAILURE, `served_ok` decides when it is safe to GO BACK on summed SUCCESS. The self-sealing wrinkle — a never-served peer would never receive a first placement — is resolved by `served_ok = ever_served || never-observed`: a proven-bad peer (tried, only timeouts, e85a5bb3) is blocked; a brand-new UNTRIED peer reads optimistic and gets its first chance. #1560's strict reading was about not ROUTING to an unproven peer; refusing to ever TRY one is the worse, self-sealing failure. `breaker_for` returns a pristine (served_ok = true) entry for a peer never seen, so `follow_the_fleet` never self-seals a new seat. Also folds in Cormac's #4173 re-review test (same file): a miss while the peer is ALREADY cold does not re-trip — exercises the CAS warm-guard refusal branch, distinct from the count-reset path. On this tier e85a5bb3 is proven-bad, so the flap cannot form. NOT the root: the root is that cross-grid inference was never addressable (the receiving node refuses every `ai/generate` with request_not_for_me — card c34034b9), a separate transport fix. This closes the placement flap that root produced. Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Opus 4.8 <[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.
First substrate-side consumer of TwoAircLoopback + AircIpcTransport's verified wire. Closes task #108 slice C (the adapter itself + first live test).
What lands
What this means
A persona on a crap Intel Mac can now register:
…and its cognition pipeline calls
.generate_text(request)like any otherAIProviderAdapter. The inference happens on the 5090; the persona-side code doesn't care. Per[[the-substrate-is-the-grid-tron-frame]]+[[nimble-ecosystems-beat-datacenters]], this is the substrate becoming literal cross-machine.Wire path
Exact same path
airc_ipc_roundtrip.rsalready pins for arbitrary commands — this slice adds an inference-specific consumer.Verified
Integration test uses substrate's REAL
CommandRequestHandler::parse_envelope+send_reply(per R3's pattern from PR #1558), so drift between adapter wire and substrate parser fails the test, not silently passes.Follow-up slices (#108 sub-tasks already in tree)
ai/generatehandler dispatching through its CommandExecutor instead of a canned response.CommandRequestHandleralready accepts; slice E adds inference-specific policy).AdapterCapabilities+ModelInfofrom the remote (drop the "conservative defaults" comment).ai/embedover the same adapter.Test plan
[[agent-review-as-acceptable-approval]]