Repository navigation
feat(inference): wire InferenceHandleModule through the broker-managed coordinator (slice 5) - #1620
Merged
Merged
Conversation
…d coordinator (slice 5)
Registers the `ai/inference/{open,generate,close,inspect}` command surface
(`InferenceHandleModule`) through the SAME `InferenceCoordinator` Arc that
`InferenceCoordinatorModule` owns and registered with the PressureBroker
(slice 4). Proven single-instance: both `register_with_broker` (the pool the
broker evicts) and the handle module's `with_coordinator` receive
`self.coordinator.clone()` — one allocation, so a lane opened via the handle
surface is the same lane the broker's pool accounts + evicts.
Purely additive, NOT a replacement: `InferenceModule` ("inference",
`inference/capacity`) and `InferenceHandleModule` ("ai-inference-handle",
`ai/inference/`) are disjoint command surfaces. Coordinator Arc fetched from
the already-registered InferenceCoordinatorModule (module_of_type → downcast
→ coordinator()); defensive else-log for the unreachable missing-module
case. Manifest gains ("ai-inference-handle", Core) so the A.2.2 boot
cross-check stays honest.
NOT yet end-to-end live (honest scope): `open()` resolves its adapter from
the handle module's local `providers` map, which is empty under
`with_coordinator`, so `ai/inference/open` currently returns "provider not
registered" before reaching `coordinator.open_lane`. Making opens actually
create lanes needs a production adapter wired in — either registered on the
module at boot or resolved from the shared AdapterRegistry (the `get_arc`
migration the module's own doc flags). That's a follow-up slice, gated on the
LlamaCppAdapter init lifecycle integrating with runtime startup (already a
known TODO in this file). This slice lands the correct, identity-proven
plumbing that adapter slice builds on.
Validated rust:1.95 (continuum-core --lib): 25 tests pass (handle_module +
inference_coordinator_module), whole lib compiles, CARGO_EXIT=0.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply
force-pushed
the
feat/wire-handle-module-coordinator
branch
from
June 14, 2026 23:00
5d6fd14 to
c4c1ca5
Compare
joelteply
added a commit
that referenced
this pull request
Jun 14, 2026
…ce 6) (#1622) * feat(inference): open() falls back to the shared AdapterRegistry (slice 6) InferenceHandleModule::open() resolved the requested adapter ONLY from the module's local `providers` map, which is empty under `with_coordinator` — so ai/inference/open 404'd in production even when the adapter was registered elsewhere in the system. (Reviewer MAJOR on #1620.) Resolution is now local-map-first, then a fallback to the shared `ai_provider::global_registry()` via `get_arc` — the #162-era source of truth the module's own header doc already CLAIMED it used. The local map stays for adapters explicitly registered on this instance (tests + pre-#162 wiring sites). Two substrate subtleties handled: - `global_registry()` is an `Arc<tokio::sync::RwLock<AdapterRegistry>>`, so the read is async (`.read().await`). The registry guard is scoped to a single statement (get_arc returns an owned Arc), dropped well before the downstream `coordinator.open_lane` await. - The local DashMap lookup is resolved into an owned `Option` in its OWN statement BEFORE the match, so the DashMap `Ref` is never held across the registry await — no lock-across-await / shard deadlock (CONCURRENCY-STYLE-GUIDE forbidden move #7). Error message keeps "not registered" (existing typed-error test stays green) and now reports both the local set and that the registry was consulted. Fixed two stale doc comments that described registry resolution the code didn't yet do. Extracted `bare_coordinator_module()` test fixture (empty local map) so `module_with_coordinator` layers the local heuristic on top; added a fallback test proving open resolves a registry-only adapter. Honest scope: this fixes adapter RESOLUTION (single source of truth). Opens succeeding end-to-end still need an adapter registered into global_registry at boot — separate from this resolution fix. Validated rust:1.95 (continuum-core --lib): 24 tests pass (handle_module + ai_provider, incl. the new fallback test + the unchanged unregistered-error test), CARGO_EXIT=0. Co-Authored-By: Claude Opus 4.8 <[email protected]> * docs(inference): correct open() guard comment — open_lane is synchronous (reviewer nit, #1622) Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- 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.
Slice 5 — wires the
ai/inference/{open,generate,close,inspect}command surface (InferenceHandleModule) through the sameInferenceCoordinatorArc thatInferenceCoordinatorModuleowns and registered with thePressureBroker(slice 4).Proven single-instance (the load-bearing invariant)
Both
register_with_broker(the pool the broker evicts) and the handle module'swith_coordinatorreceiveself.coordinator.clone()— one allocation. So a lane opened via the handle surface is the same lane the broker's pool accounts and evicts. No two-instance split. (Adversarial review verified the Arc identity, registration order, and manifest match.)Purely additive
InferenceModule("inference",inference/capacity) andInferenceHandleModule("ai-inference-handle",ai/inference/) are disjoint surfaces. Manifest gains("ai-inference-handle", Core)so the A.2.2 boot cross-check stays honest.open()resolves its adapter from the handle module's localprovidersmap, which is empty underwith_coordinator— soai/inference/opencurrently returns "provider not registered" before reachingcoordinator.open_lane. Making opens actually create lanes needs a production adapter wired in (registered on the module at boot, or resolved from the sharedAdapterRegistry— theget_arcmigration the module's own doc flags), which is gated on the LlamaCppAdapter init lifecycle integrating with runtime startup (a known TODO inipc/mod.rs). This slice lands the correct, identity-proven plumbing that the adapter slice builds on.Validation (rust:1.95, continuum-core
--lib)25 passed; 0 failed(handle_module + inference_coordinator_module) · whole lib compiles ·CARGO_EXIT=0.🤖 Generated with Claude Code