Logical OpenAI model discovery + bare-model resolution (D-055, #134) #144
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
P1
P2
P3
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Creatidy/scarcity-router!144
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "compat/logical-model-resolution"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #134 (child B of program #132, decision D-055). Stacked on PR #142 (
compat/representative-client-fixture): the representative fixture (#133) is this contract's regression asset. Retarget todevelopafter #142 merges.What
Bare physical-model ids become a third model-field reading — the fix for acceptance failure 4 (a real client's
"model": "gpt-5.6-luna"wasmodel_not_found; only aliases andsr-pin:resolved, and/v1/modelsexposed aliases only).sr-pin:→ alias → logical model →model_not_found. A logical request resolves to the EXACT(provider, model)identity and rides the routing core's EXISTINGexplicit_model/explicit_variantnarrowing — normal scarcity policy competes only the resources providing exactly that identity. No routing-engine change, no substitution, ever.unsupported_reasoning_effort(typed 400) for a variant the identity lacks — no downgrade;reasoning_effort_requiredwhen omitted and several calibrated variants exist; a max-only family's single legal effort (max, D-054) is used when omitted;ambiguous_logical_modelwhen two providers carry the slug. Rejections are audited with no dispatch.GET /v1/models): aliases first, then exposed logical models — a calibrated identity is exposed only when ≥1 registered resource binds it (empty deployment exposes nothing; retired disappears; registered-but-unavailable still appears and yields 503no_eligible_target, never a misleading 404; restricted/unclassified never appear). Additivex_scarcity_routermetadata per entry:kind, and for logical modelsprovider,reasoning_efforts,effective_context_limit_tokens(model hard context ∩ known channel ceilings;null= UNKNOWN, never guessed),max_output_tokens.logical_model_shadowed.docs/decisions.md(with alternatives + explicit D-042 reconciliation); execution-surface model-resolution section and error table amended in place.Pins flipped / coordination with #142 review
The #142 review's DEFER findings are addressed here: the aliases-only assertions in
test_gateway_server.pyAND the representative pin are updated in coordination (DEFER 2), and the tools-pin docstring wording is tightened (DEFER 3). DEFER 1 (test-to-test harness import) is acknowledged; promotion togateway_fixturesis left until a third importer materializes — this branch importsServerHarnessdirectly, keeping the diff minimal. The #135/#136/#137 pins are untouched.Tests
New
tests/test_logical_model_resolution.py(16 tests) over a real D-053 world (track registry + derived registrations + floor catalog): exact-identity routing with selected==executed audit; two sources competing for one identity; effort rule (max-only omitted → max; multi-variant omitted → 400; unknown effort → 400 + audited rejection); restricted/unclassified/unknown stay 404; unavailable → 503 availability; empty deployment exposes nothing; alias precedence + visible shadowing; ambiguous slug fails loudly and is never advertised; honest metadata intersection (272000, not 1.05M); historical no-catalog behavior preserved.Gates
uv sync --only-dev✓make check— 2083 tests; green on 5 of 7 runs this session; the 2 failures are the pre-existing load-sensitivetest_scenario_11cancellation e2e, unrelated to this diff (class passes 8/8 in isolation on BOTH this branch and pristinedevelop), filed as #143 with root-cause hypothesis. Not retried to green; reported per repo discipline.uv run basedpyright— 0 / 0 / 0 ✓git diff --check✓UX impact
Direct positive: the normal client path (bare model id) now works without
sr-pin:; discovery shows real models with real effective numbers; unavailable models give honest availability errors; alias shadowing is visible. Errors are typed and actionable (unsupported_reasoning_effort,reasoning_effort_required). No hidden/manual steps introduced.Review
Independent GLM-5.3-Flash exact-head review requested. Not security-critical (no new trust boundary, credential path or execution semantics; routing narrowing reuses the frozen pin-narrowing machinery). PR left open for the human merge gate.
Independent review (GLM-5.3-Flash, fresh reviewer context) of reviewed_head
8c3dd674c97ea314c0fb9cfe7847ebe3b1e73676(diff8586320..8c3dd67, the approved #142 head + this PR's single commit) — VERDICT: APPROVE.Invariant verification (all confirmed with file:line evidence):
RequestBinding(explicit_model, explicit_variant)into the routing core's pre-existing exact narrowing (routing_core.py:2548-2568); same-identity resources still compete (qualified_by_identity,selected_gatesby_order_key, runner-ups intarget_alternatives); the no-alternatives branch fires only for resource-id pins.routing_core.pyhas an EMPTY diff.unsupported_reasoning_effortbefore routing/dispatch and is auditedrejectedwithexecuted_target=None; omitted effort uses the single calibrated variant orreasoning_effort_required; D-054 max-only case pinned.Findings (none blocking):
exposed_logical_modelsrelies on the adoption gate + owner-reviewed catalog to exclude restricted entries (true today); a defense-in-depth classification guard could be considered if the catalog ever gains a restricted-track entry.8c3dd67is 0/0/0). Child C (#135, PR #145) owns it.Reviewer gates: pure-checkout
basedpyright0/0/0; 122 focused tests OK; exactly one commit in range;git diff --checkclean;/v1/modelsremains authenticated. UX impact: positive (bare model ids usable, typed actionable errors, honest discovery metadata, visible alias shadowing; no regression for pin/alias/unknown flows).