Architecture D-2: unify ModelRegistry with RouteResolver
- Dominant language
- Rust
- Stars
- 41k
- Forks
- 3.6k
- Avg merge
- 13h 59m
- Merged PRs (30d)
- 299
Description
## Combined Core execution: C04
[Core execution plan]() owns order and scope. This issue contributes to C04; the linked plan owns the complete packet and any outstanding candidate acceptance. Record this issue's path claims and implementation evidence here.
**Issue mapping:** [SHA-5689 / GitHub #4166]()
requires one canonical alias/route resolver with documented, tested precedence,
including Fleet/AgentProfile routes.
[SHA-5696 / GitHub #4173]() requires distinguishing
product-contract registries from generated/catalog data and internal code;
migrate model/provider data appropriately and preserve tool dispatch/discovery.
[SHA-6348 / GitHub #5851]() requires a **disposition**
of the parked credential-affecting provider-wire migration: keep it parked
unless explicitly selected, or close it with an accurate WIP explanation.
If revived, preserve legacy identity parsing until tables migrate, prove the
full authentication matrix and never orphan credentials. This packet does
not automatically unpark or publish that branch.
[SHA-6072 / GitHub #5092]() and
[SHA-6073 / GitHub #5093]() require canonical
provider/model routes with typed Responses wire profiles and a shared dialect
conformance fixture set for requests, streams, replay, reasoning and usage.
Preserve the prepared-request seam; prohibit model-slug inference, silent
route rewrites and unbounded JSON overrides. This is provider conformance,
not a mandate to change implementation language.
**Owner: provider/model owner. Dependencies: C03.** Move cohesive provider
adapters and their tests using the existing model-client seam; consolidate
live catalog/pricing resolution and routing against canonical config facts.
Reuse the proposal's `codewhale-models` boundary where the dependency graph
supports it. Migrate existing `agent` catalog consumers instead of retaining
a second seeded registry. `config` remains schema/route identity authority,
`secrets` owns credential access and UI labels stay in clients.
**Completion evidence required:** all selected provider consumers use the owner, exact model
IDs and credential namespaces survive, and focused catalog/config/streaming
tests pass without compiling the unrelated TUI test unit. Preserve tool order,
model-facing receipts and pinned prompt/cache semantics for mechanical moves.
C13 supplies the outstanding real route/catalog acceptance.
---
## Original issue and contributor history
Source: CODEWHALE_0_8_68.md Sections 7 and 9
Unify `agent::ModelRegistry` with `config::route::RouteResolver` so the same model alias cannot resolve differently depending on code path.
Current architecture context:
* `agent::ModelRegistry::resolve()` uses its own fallback chain.
* `config::route::RouteResolver` handles model classes, loadouts, and reasoning tiers.
* The same alias can resolve to different model IDs.
Acceptance:
* There is one canonical resolution path for model aliases/routes.
* Precedence and fallback rules are documented and tested.
* Fleet/AgentProfile route precedence from #4136 and #4137 uses this canonical path.
Contributor guide
Research direction
Start by reading agent::ModelRegistry::resolve() and config::route::RouteResolver, then trace existing agent catalog consumers and the proposed codewhale-models boundary. Review the focused catalog, config, and streaming tests first. Done means one canonical alias/route path with documented precedence, preserved model IDs and credential namespaces, and passing focused tests without the unrelated TUI unit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100