Repository navigation
feat(inference): open() falls back to the shared AdapterRegistry (slice 6) - #1622
Merged
Merged
Conversation
…ce 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]>
…ous (reviewer nit, #1622) 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 6 — closes the adapter-resolution gap the #1620 review caught.
InferenceHandleModule::open()resolved the adapter ONLY from the module's localprovidersmap, which is empty underwith_coordinator— soai/inference/open404'd in production even when the adapter was registered elsewhere.Change
Resolution is now local-map-first, then a fallback to the shared
ai_provider::global_registry()viaget_arc— the #162 source of truth the module's header doc already claimed it used. Local map stays for adapters explicitly registered on this instance (tests + pre-#162 sites).Two substrate subtleties handled
global_registry()isArc<tokio::sync::RwLock<AdapterRegistry>>→ async.read().await. Guard scoped to one statement (get_arcreturns an ownedArc), dropped before the downstreamcoordinator.open_laneawait.Optionin its own statement before the match, so the DashMapRefis never held across the registry await — no lock-across-await / shard deadlock (CONCURRENCY-STYLE-GUIDE forbidden move Build(deps-dev): Bump lerna from 6.6.2 to 8.2.1 #7).Tests / docs
bare_coordinator_module()fixture (empty local map); addedopen_resolves_via_shared_registry_when_absent_from_local_map.This fixes adapter resolution (single source of truth). Opens succeeding end-to-end still need an adapter registered into
global_registryat boot — separate from this fix.Validation (rust:1.95, continuum-core
--lib)24 passed; 0 failed(handle_module + ai_provider, incl. new fallback test + unchanged unregistered-error test) ·CARGO_EXIT=0.🤖 Generated with Claude Code