Skip to content

feat(inference): open() falls back to the shared AdapterRegistry (slice 6) - #1622

Merged
joelteply merged 2 commits into
canaryfrom
feat/handle-open-adapter-registry
Jun 14, 2026
Merged

joelteply merged 2 commits into
canaryfrom
feat/handle-open-adapter-registry

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Slice 6 — closes the adapter-resolution gap the #1620 review caught. InferenceHandleModule::open() resolved the 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.

Change

Resolution is now local-map-first, then a fallback to the shared ai_provider::global_registry() via get_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() is Arc<tokio::sync::RwLock<AdapterRegistry>> → async .read().await. Guard scoped to one statement (get_arc returns an owned Arc), dropped 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 Build(deps-dev): Bump lerna from 6.6.2 to 8.2.1 #7).

Tests / docs

  • "not registered" preserved in the error (existing typed-error test stays green); error now reports both sources.
  • Fixed two stale doc comments describing registry resolution the code didn't yet do.
  • Extracted bare_coordinator_module() fixture (empty local map); added open_resolves_via_shared_registry_when_absent_from_local_map.

⚠️ 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 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

…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]>
@joelteply
joelteply merged commit ed0edc5 into canary Jun 14, 2026
@joelteply
joelteply deleted the feat/handle-open-adapter-registry branch June 14, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant