Repository navigation
cleanup(ts): delete dead TS cloud-inference adapter classes (task #229) - #1587
Merged
Merged
Conversation
Per headless-Rust doctrine + the no-fallbacks campaign (#1585): the TS-side cloud-inference adapter classes are dead infrastructure now that: - continuum-core's `model_registry/catalog.rs` enumerates all 9 cloud providers (anthropic, openai, groq, deepseek, together, mistral, fireworks, google/gemini, xai) as Rust catalog rows - ai_provider.rs Rust module owns cloud inference dispatch via `LateBound<CommandExecutor>` + the inference handle store - The inference routing campaign (#112/#113/#114) is finishing the cognition-side migration so every persona turn routes through the inference command, not the TS daemon This commit removes the now-unreachable TS surface: Deleted (8 cloud-inference adapter classes): - anthropic/shared/AnthropicAdapter.ts - deepseek/shared/DeepSeekAdapter.ts - fireworks/shared/FireworksAdapter.ts - google/shared/GoogleAdapter.ts - groq/shared/GroqAdapter.ts - openai/shared/OpenAIAdapter.ts - together/shared/TogetherAIAdapter.ts - xai/shared/XAIAdapter.ts (Mistral had no inference adapter in TS — only fine-tuning. Fine-tuning adapters across all providers remain in place; their deletion follows the TS persona-chain collapse, separate card.) Deleted (stale planning docs that referenced the now-dead architecture): - adapters/CONSOLIDATION-PLAN.md - adapters/MULTI-MODAL-ARCHITECTURE.md Edited (AIProviderDaemonServer.ts): - Removed the 8 cloud-adapter import + register_adapter calls - Removed Candle/Sentinel orchestration scaffolding that was only needed because of the cloud adapters - Kept only the Sentinel adapter registration path (separate provider, its own migration card pending) - Added doctrine pointers: SUBSTRATE-DOCTRINE-ORGANIC-FLOW.md forbidden moves clause 7 + CANARY-ALPHA-EXECUTION-ROADMAP.md Group A Out-of-scope (deliberate — follow-up cards): - BaseConfig files per provider (fine-tuning adapters still depend on them) - FineTuning adapter classes (TS persona chain still calls them via FineTuningAdapterFactory; deletion follows the TS persona-chain collapse) - candle/ and candle-grpc/ adapter dirs (entangled with PersonaUser, AIProviderDaemon; deletion is its own scoped PR) - SentinelAdapter + BaseAIProviderAdapter (sentinel is a separate provider migration card) - AIProviderDaemon itself (still needed until the full TS persona chain dies; this PR just removes its dead registrations) Verified: - `npx tsc --noEmit` produces zero errors from this change (the only errors are pre-existing rootDir issues on generated TS bindings) - `cargo check -p continuum-core --lib --features metal,accelerate` clean Doctrine alignment: - [[rust-is-the-core-node-is-the-shell]] — TS no longer owns cloud inference registration - [[no-fallbacks-ever]] — the TS bridge for cloud inference is one step closer to deletion - [[headless-rust-must-work-soon]] — headless boot needs zero of these adapters; their presence was vestigial Co-Authored-By: Claude Opus 4.7 <[email protected]>
…1587) Adversarial reviewer BLOCK on PR #1587: three tsx-script test files imported the deleted cloud-inference adapter classes and would fail at runtime when a developer ran them by hand. They were excluded from tsc (tsconfig exclude) so the build check missed them. Per CLAUDE.md test-fixtures STOP block + "Tests must justify themselves": dead tests that test deleted code go away with the code. Leaving them as broken-on-execute landmines violates the no-fallbacks campaign that motivated #1587 in the first place. Deleted: - src/tests/integration/ai-cost-tracking.test.ts (imported OpenAIAdapter) - src/tests/integration/quick-provider-test.ts (dyn-imported 6 deleted adapters) - src/tests/integration/test-provider-diagnostics.ts (same 6) Also cleaned (cosmetic nit from review): - Empty adapters/groq/ dir (no FineTuning, no inference) - Empty adapters/xai/ dir (no FineTuning, no inference) Reviewer nits not addressed in this commit (would-be-nice but non-blocking): - Stale BaseConfig docstrings referencing deleted classes (4 files) - Promise.allSettled single-element redundancy - discoverModelsViaRust becoming dead-on-the-TS-side These are TS persona-chain hygiene targets, follow with #143/#215 when the broader chain collapse lands. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Contributor
Author
|
BLOCK addressed in 7f4cca8 — deleted the 3 broken tsx-script test files (ai-cost-tracking, quick-provider-test, test-provider-diagnostics) and the 2 empty adapter dirs (groq/, xai/). Per CLAUDE.md test-fixtures STOP block: dead tests that test deleted code go away with the code. Nits 2-4 deferred to TS persona-chain cleanup (#143/#215). PR is now +18/-2,523. |
joelteply
added a commit
that referenced
this pull request
Jun 10, 2026
…ix it caught (task #240) (#1593) * test(arch): cross-grid peer-disconnect chaos proof + fix classifier bug it caught (task #240 — Shape-4) Fifth proof in the architecture-test matrix, and the FIRST Shape-4 adversarial/chaos test. Pins the "cross-grid composition" doctrine clause: when a remote peer disconnects mid-stream (crashes, hangs, never replies), the caller's transport surfaces a TYPED error within the configured deadline, never hangs, and remains usable for the next request. ## What ships ### 1. `core/continuum-core/tests/architecture_cross_grid_chaos.rs` Two integration tests over the `TwoAircLoopback` fixture: 1. `silent_peer_request_times_out_with_typed_error` — wire two airc peers, spawn a "silent" responder on peer_a that subscribes, observes the incoming request envelope (via Notify barrier proves wire-delivery), then drops it on the floor. Peer_b's `AircLiveTransport` with a tight 300ms deadline calls `send_request`. Asserts: - Returns `Err(RemoteInferenceError::Timeout { elapsed_ms })` - elapsed_ms is in the 100–2000ms window (deadline plumbing honored end-to-end; not zero, not 30s default) - Wall-clock < 2s (deadline bounds the wall-clock, not just the reported elapsed_ms) - Silent responder MUST have seen the request (proves silence wasn't a wire break) 2. `transport_remains_callable_after_peer_timeout` — same fixture. First request hits the silent responder → Timeout. Then a NORMAL responder is spawned and a SECOND request via the SAME transport instance succeeds with typed Ok. Proves the transport has no global state corruption: a timed-out request doesn't poison the airc-lib correlation tables or wedge subsequent dispatches. Both tests drive the transport's `send_request` directly (not via `AircRemoteInferenceAdapter::generate_text`), because the adapter trait flattens typed errors to `Result<_, String>`. The chaos proof needs the typed variant; the transport seam is where the typed semantics live. ### 2. **Bug fix in `AircLiveTransport::send_request` error classifier** The chaos test caught a real production bug at first run: airc-lib's deadline-elapsed message is literally `"command deadline elapsed (correlation_id=…)"`. The transport's substring classifier was checking only `"timeout"` and `"timed out"` — neither matches — so genuine timeouts were mis-classified as `RemoteInferenceError::Transport { message }`, which silently broke `InferenceCoordinator`'s retry policy (it distinguishes by variant). Fix: extend the classifier to also recognize `"deadline elapsed"` and `"deadline exceeded"`. The phrase list is the canonical answer to "what does airc-lib emit when a deadline fires?" — it grows HERE when airc-lib's message changes, not in every consumer. Per `[[every-error-is-an-opportunity-to-battle-harden]]`: the chaos test surfaced a real defect, the production fix shipped in the same PR with a comment naming the test that caught it. ### 3. Matrix update `PROVING-THE-DOCTRINE.md` row for "Cross-grid composition" flips from 🟡 (only happy-path roundtrip) to **✅** (Shape-1 + Shape-4 both covered). The federation-by-default story now has an adversarial proof at the disconnect surface. ## Test plan - [x] `cargo test -p continuum-core --test architecture_cross_grid_chaos --features metal,accelerate` — 2/2 pass; both tests complete in <2s end-to-end - [x] Happy-path regression: `cargo test -p continuum-core --test airc_remote_inference_roundtrip --features metal,accelerate` still passes — classifier widening doesn't false-positive on successful replies - [x] `// proves: cross-grid composition` tag applied to both tests - [x] Bug fix documented inline with the test that caught it (and vice-versa in the test's module doc) ## Doctrine alignment - Substrate doctrine § "Cross-grid composition" — federation works by default; absent peers can't dominate or wedge the substrate - `[[every-error-is-an-opportunity-to-battle-harden]]` — chaos test surfaced a real classifier bug; the fix and the test ship together - PROVING-THE-DOCTRINE.md § "Shape 4 — Adversarial / chaos test" — first instantiation of this proof shape ## Related - Task #240 — architecture-test matrix, fifth proof, first Shape-4 - Builds on PR #1587/1588/1589/1591/1592 (matrix establishment + Shape-5 ratchets) - Builds on task #187 (`TwoAircLoopback` fixture this proof needs) - Follow-up: the same fixture can power "malformed reply" and "hostile peer flood" chaos tests — tracked under the matrix rows for "Backpressure intrinsic" and "Federated alignment" ## Nit (not blocking; noted in the test) `AircLiveTransport::new` returns `Arc<Self>` but `with_deadline` consumes `self` — they don't chain. The test works around with `Arc::into_inner` since `new`'s Arc has refcount=1. The API could take `&self` or accept `Arc<Self>` for a cleaner builder. Not in scope for this PR. Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(transport): classify await_reply errors by AircError variant, not Display substring Follow-up to the substring fix in the parent commit, per Joel's review: > Couldn't structs prevent this? Can't you encode the protocol? Yes — and airc-lib already encodes it. `AircError::CommandDeadline { correlation_id }` is the typed variant for "command deadline elapsed"; the old classifier was throwing away the type by substring-matching the Display impl. The substring fix (commit 383dd81) widened the phrase list to include the actual airc-lib message — that closed THIS bug but keeps the antipattern. Every time airc-lib's Display string is refactored (rephrased, reformatted, new variants added), this classifier silently regresses until someone notices. The structural fix: `match` on the `AircError` variant. ```rust match self.airc.await_reply(pending).await { Ok(reply) => reply, Err(airc_lib::AircError::CommandDeadline { .. }) => { return Err(RemoteInferenceError::Timeout { ... }); } Err(other) => { return Err(RemoteInferenceError::Transport { ... }); } } ``` Now: - A future airc-lib refactor that changes the Display format CAN'T silently break us — the variant is the contract, not the prose. - New `AircError` variants surfaced from `await_reply` (e.g. a future `CorrelationDropped` variant) land here as a compile warning (non-exhaustive `Err(other)` branch), not as a silent mis-classification at runtime. - The chaos test still passes, proving the variant match is equivalent to the (correct) substring match at runtime. Architecturally: the protocol is already encoded — we just have to USE the encoding. Substring-parsing a stringified enum to recover the variant is "decode the binary serialization of an already-typed enum by inspecting the bytes" in disguise. ## Test plan - [x] `cargo test -p continuum-core --test architecture_cross_grid_chaos --test airc_remote_inference_roundtrip --features metal,accelerate` — 3/3 pass (chaos 2 + happy-path 1) - [x] No new dependencies — `airc_lib::AircError` was already in scope via the existing imports ## Doctrine - `[[every-error-is-an-opportunity-to-battle-harden]]` — the original substring approach was a latent class of bug; the variant match closes the class, not just the instance. - "Encode the protocol in the type" — the doctrine Joel called out. Strings are fallback for what doesn't fit in the type system; here it fits. Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(transport,test): close gap-analysis nits from #1593 review Adversarial reviewer on PR #1593 surfaced four real gaps; closing all four here. ## Nit 1 — `elapsed_ms` was a parroted constant `RemoteInferenceError::Timeout { elapsed_ms }` was being populated with `self.deadline.as_millis()` regardless of how long the call actually waited. The chaos test's `>= 100` lower bound passed trivially because the value was the deadline constant 300 — a future deadline-plumbing bug returning immediately with `elapsed_ms == self.deadline` would still look "honest" in probes. Fix: stamp `Instant::now` at `send_request` entry; report `start.elapsed().as_millis`. Now `elapsed_ms` is the TRUE wall- clock since send-entry. Probes downstream — latency histograms, sentinel verdicts — get the honest read. ## Nit 2 — send-side `request` was still substring-prone The await_reply seam got the variant-match treatment in the parent commit, but `airc.request` — the SEND-side call — was still doing `format!("airc.request to ...: {e}")` and wrapping in `Transport`. Asymmetric; and the variants the SEND side surfaces — `NoCurrentRoom`, `NotSubscribed`, `UnknownPeer` — semantically mean "no peer reachable", not "transport break". The coordinator's backoff policy treats those differently. Fix: typed match on the send side too, routing `NoCurrentRoom` / `NotSubscribed` / `UnknownPeer` to `RemoteInferenceError::NoPeerReachable`. Any other variant lands in `Transport { message }`. ## Nit 3 — TODO marker for the Subscription gap Reviewer noted that `await_reply` COULD theoretically surface `AircError::Subscription` if a future caller bypassed the substrate's pre-armed reply_stream and let await_reply do its own subscribe. Today's path can't hit it — substrate's `request` arms the stream pre-send — but the catch-all would mis-classify it as Transport when NoPeerReachable would be more accurate. Fix: TODO marker on the seam so a future contributor extending that variant knows where to add the classification. ## Nit 4 — wall-clock assertion was too generous Test asserted `elapsed < from_secs 2` for a 300ms deadline. A future bug where the deadline arg is silently dropped AND airc-lib falls back to its multi-second default would PASS. Fix: `from_millis 800` — deadline plus 500ms CI fudge. Also tightened the `elapsed_ms` bounds to deadline - 50 ..= deadline + 500. They now actually constrain the deadline plumbing, not just "was nonzero and under 2s". ## Test plan - [x] `cargo test -p continuum-core --test architecture_cross_grid_chaos --test airc_remote_inference_roundtrip --features metal,accelerate` — 3/3 pass; tighter bounds hold on this hardware - [x] Chaos test's new elapsed_ms window of 250 ..= 800 ms is meaningful: the constant-parroting bug would have surfaced 300 exactly, but Nit 1's measured value varies run-to-run within the expected window ## Doctrine - [[strong-typing-across-boundaries]] — applied at BOTH seams, send and reply, not just one. Asymmetric typing IS the gap. - [[every-error-is-an-opportunity-to-battle-harden]] — chaos test surfaced the original; review tightened the honest-measurement story. - "Tighter on gap analysis" — Joel 2026-06-10. The instinct of "approve with nits, follow up later" is the gap factory. Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(transport): also route AircError::Route to NoPeerReachable (final nit from #1593 re-review) Re-reviewer flagged: `Err(other)` catch-all on the send-side match catches `AircError::Route(_)` and surfaces it as `Transport`, but semantically Route is "route resolver refused or selected a route the current sender cannot execute" — same category as the existing three NoPeerReachable variants. The coordinator's backoff policy treats all four identically. Fix: add `Route(_)` to the NoPeerReachable arm with a one-line comment explaining the framing. No new exhaustiveness warnings; all 3 tests still pass. Per [[strong-typing-across-boundaries]] applied tightly — every variant that semantically fits a category lands in that category, not in the catch-all. Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- 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.
Summary
Per headless-Rust doctrine + no-fallbacks campaign (#1585), the TS-side cloud-inference adapter classes are dead. continuum-core's Rust catalog enumerates all 9 cloud providers;
ai_provider.rsowns cloud inference dispatch; the inference routing campaign (#112/#113/#114) finishes the cognition-side cutover.1,969 lines deleted, 18 added. Pure cleanup.
What's deleted
8 cloud-inference adapter classes (Mistral never had a TS inference adapter — only fine-tuning):
anthropic/shared/AnthropicAdapter.tsdeepseek/shared/DeepSeekAdapter.tsfireworks/shared/FireworksAdapter.tsgoogle/shared/GoogleAdapter.tsgroq/shared/GroqAdapter.tsopenai/shared/OpenAIAdapter.tstogether/shared/TogetherAIAdapter.tsxai/shared/XAIAdapter.ts2 stale planning docs:
adapters/CONSOLIDATION-PLAN.mdadapters/MULTI-MODAL-ARCHITECTURE.mdAIProviderDaemonServer.tsupdated to drop the 8 dead imports + registrations. Only the Sentinel adapter registration path remains.Honest scoping (deliberate out-of-scope)
This PR is the focused cleanup — the TS chain's other tendrils get their own scoped PRs to avoid blast-radius surprises:
FineTuningAdapterFactory; deletion follows the TS persona-chain collapsecandle/andcandle-grpc/adapter dirs — entangled withPersonaUser,AIProviderDaemon; their own scoped PRSentinelAdapter+BaseAIProviderAdapter— Sentinel is its own provider migration cardAIProviderDaemonitself — still needed until the full TS persona chain diesThe TS persona chain collapse is task #143 (Rust-first jtag + clean Node shell) and its dependencies (#215, #142). When that lands, the rest of the TS adapter surface follows mechanically.
Doctrine alignment
Test plan
npx tsc --noEmit— zero errors from this change (only pre-existing rootDir bindings issues)cargo check -p continuum-core --lib --features metal,accelerate— cleanRelated
CANARY-ALPHA-EXECUTION-ROADMAP.mdGroup A (just merged)🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.7 [email protected]