G04: Fix exact model-variant narrowing in route_request without changing gateway pin admission #178

Closed
opened 2026-10-04 22:23:07 +00:00 by kilo · 3 comments
Member

Goal

Product owner: Scarcity Router; G04/G10. Source: Creatidy architecture v1.0 (2026-10-04), sections 1-5, 7-13, 14-18 via #173. Correct the existing pure routing core's exact target-pin behavior; preserve correctly exact gateway admission and all authorization/quality gates.

Why and Reproduced Evidence

Current integrated develop 8d9d4b04bcb23fe19ff702b6209fbcb1537cdf1b, routing_core.py:2615-2667: when RequestBinding.pinned_target exists, routable_keys contains every identity bound to that resource, not only pin.model. The selector can prefer another variant. Existing test_routing_core.PinTests.test_explicit_target_pin_is_honored_exactly asserts resource/channel but not variant.
A safe local probe using ONLY existing synthetic tests reproduced: requested openai-worker/openai/gpt-5.6-luna/max; route_request selected variant medium; admit_pinned_target(..., pinned_target=pin) admitted max. No inference/network/credentials. This is a proven library-core defect, not evidence the public gateway substitutes pins: its pin path uses admit_pinned_target (gateway_coordinator.py:1476-1498).

Scope

Small correction to exact pin candidate narrowing/failure reasons in route_request plus deterministic regression tests/docs. Inspect interaction with explicit_model/explicit_variant and requirement/profile gates rather than guessing precedence. No API redesign, no all-client behavioral expansion, no new Kernel code or public endpoint. Pin identifies resource + exact provider/model/opaque variant; configured effort remains separate.

Acceptance Criteria

  1. Multi-variant resource pinned to a non-ranking-winner identity returns exactly that identity or explicit refusal; never a sibling model/variant. Add assertion of every target dimension and no alternatives.
  2. Pinned identity not currently bound, unknown/missing resource, changed calibration/registration, stale/offline state, unauthorized resource, contradictory requirements, capability deficit and incompatible protocol produce explained typed no-solution with no substituted identity.
  3. Existing exact admit_pinned_target behavior, public sr-pin: ingress, logical-model competitive routing and frozen recommendation v1 remain unchanged. Pins remain neither credentials nor quota reservations/availability guarantees.
  4. Tests use actual core with synthetic state, not mocked selection; full make check, uv-managed basedpyright and full-range whitespace clean. Public contract/diagnostic wording is updated only where necessary.

Dependencies, Priority, Reuse and Authority

First-priority correctness blocker before public consumer G04 acceptance (#174). No dependency on MI or live inference; resolve before consumer tests can trust the shared core. Reuse existing _identity_key, _narrowed_catalog, exact admission validation and fixture world, smallest correct change; no upstream replacement needed unless it demonstrably improves semantics. Mandatory reuse audit records retained local mechanism and rejected broader rewrites. No config/data migration expected; prove existing pins now honor already documented semantics. If a breaking interpretation is found, explicit decision before change.
No credentials/endpoint changes, prompt capture, provider calls or real task execution. Normal independent technical+UX review required; future synthetic acceptance needs no inference/effect authority. Refs #173, #174, #87, D-042.

## Goal **Product owner: Scarcity Router**; G04/G10. Source: Creatidy architecture v1.0 (2026-10-04), sections 1-5, 7-13, 14-18 via #173. Correct the existing pure routing core's exact target-pin behavior; preserve correctly exact gateway admission and all authorization/quality gates. ## Why and Reproduced Evidence Current integrated develop `8d9d4b04bcb23fe19ff702b6209fbcb1537cdf1b`, `routing_core.py:2615-2667`: when RequestBinding.pinned_target exists, routable_keys contains every identity bound to that resource, not only pin.model. The selector can prefer another variant. Existing `test_routing_core.PinTests.test_explicit_target_pin_is_honored_exactly` asserts resource/channel but not variant. A safe local probe using ONLY existing synthetic tests reproduced: requested `openai-worker/openai/gpt-5.6-luna/max`; `route_request` selected variant `medium`; `admit_pinned_target(..., pinned_target=pin)` admitted `max`. No inference/network/credentials. This is a proven library-core defect, **not evidence the public gateway substitutes pins**: its pin path uses admit_pinned_target (gateway_coordinator.py:1476-1498). ## Scope Small correction to exact pin candidate narrowing/failure reasons in `route_request` plus deterministic regression tests/docs. Inspect interaction with explicit_model/explicit_variant and requirement/profile gates rather than guessing precedence. No API redesign, no all-client behavioral expansion, no new Kernel code or public endpoint. Pin identifies resource + exact provider/model/opaque variant; configured effort remains separate. ## Acceptance Criteria 1. Multi-variant resource pinned to a non-ranking-winner identity returns exactly that identity or explicit refusal; never a sibling model/variant. Add assertion of every target dimension and no alternatives. 2. Pinned identity not currently bound, unknown/missing resource, changed calibration/registration, stale/offline state, unauthorized resource, contradictory requirements, capability deficit and incompatible protocol produce explained typed no-solution with no substituted identity. 3. Existing exact `admit_pinned_target` behavior, public `sr-pin:` ingress, logical-model competitive routing and frozen recommendation v1 remain unchanged. Pins remain neither credentials nor quota reservations/availability guarantees. 4. Tests use actual core with synthetic state, not mocked selection; full make check, uv-managed basedpyright and full-range whitespace clean. Public contract/diagnostic wording is updated only where necessary. ## Dependencies, Priority, Reuse and Authority First-priority correctness blocker before public consumer G04 acceptance (#174). No dependency on MI or live inference; resolve before consumer tests can trust the shared core. Reuse existing `_identity_key`, `_narrowed_catalog`, exact admission validation and fixture world, smallest correct change; no upstream replacement needed unless it demonstrably improves semantics. Mandatory reuse audit records retained local mechanism and rejected broader rewrites. No config/data migration expected; prove existing pins now honor already documented semantics. If a breaking interpretation is found, explicit decision before change. No credentials/endpoint changes, prompt capture, provider calls or real task execution. Normal independent technical+UX review required; future synthetic acceptance needs no inference/effect authority. Refs #173, #174, #87, D-042.
Author
Member

Implemented in PR #191: exact provider/model/variant narrowing on the pinned resource, with refusal/drift/intersection regressions and existing contract docs updated. Reproduced max -> medium failure before fix; 61 core tests PASS. Full make check PASS (2690 tests, 15 skips), uv sync --only-dev, explicit basedpyright and whitespace gates PASS. Base 6c337a400b; HEAD 61b96247e7. Native independent whole-PR review pending; no live provider/harness integration claimed.

Implemented in PR #191: exact provider/model/variant narrowing on the pinned resource, with refusal/drift/intersection regressions and existing contract docs updated. Reproduced max -> medium failure before fix; 61 core tests PASS. Full make check PASS (2690 tests, 15 skips), uv sync --only-dev, explicit basedpyright and whitespace gates PASS. Base 6c337a400b4cdc28ded543d2ae8ccf3749d79cb7; HEAD 61b96247e7ed201f9a0fe8f27c94f73fb396f350. Native independent whole-PR review pending; no live provider/harness integration claimed.
Author
Member

Loop invocation 2026-10-05T12:38:32Z stopped BLOCKED at independent review ordinal 1/10 for PR #191. Fresh native whole-PR review returned COMMENT with empty findings at HEAD 61b96247e7 / base 6c337a400b: no established code/UX blocker, but independent behavioral validation incomplete. Focused test invocation was denied by reviewer permissions; the allowed full suite includes environment-dependent operations the read-only reviewer cannot safely run. Independent basedpyright/whitespace passed; parent full gate passed (2690 tests, 15 skips). No exact APPROVE, so no merge or issue closure. Final checkout clean and PR open/unmerged at the frozen SHAs. Counter preserved in excluded delivery ledger; fixing reviewer validation availability is outside #178 scope.

Loop invocation 2026-10-05T12:38:32Z stopped BLOCKED at independent review ordinal 1/10 for PR #191. Fresh native whole-PR review returned COMMENT with empty findings at HEAD 61b96247e7ed201f9a0fe8f27c94f73fb396f350 / base 6c337a400b4cdc28ded543d2ae8ccf3749d79cb7: no established code/UX blocker, but independent behavioral validation incomplete. Focused test invocation was denied by reviewer permissions; the allowed full suite includes environment-dependent operations the read-only reviewer cannot safely run. Independent basedpyright/whitespace passed; parent full gate passed (2690 tests, 15 skips). No exact APPROVE, so no merge or issue closure. Final checkout clean and PR open/unmerged at the frozen SHAs. Counter preserved in excluded delivery ledger; fixing reviewer validation availability is outside #178 scope.
Author
Member

Completed in the SAME /loop invocation 2026-10-05T12:38:32Z. PR #191 merged via supported Forgejo merge operation as 46cb9ab695. Fetched canonical develop contains that exact merge commit with parents approved base 4e1d5974f2 and approved HEAD f78cb9d24c; both ancestors verified, integrated tree equals approved tree.

Acceptance verified: non-ranking-winner pin retains exact resource/provider/model/variant and no alternatives; missing/unbound/calibration/registration drift, stale/offline/unauthorized, conflicting explicit pins, quality/profile and unsupported-tool cases refuse without substitution; pinned compatibility regression asserts exact stage/reason/details. Existing exact admission/public gateway/logical routing/recommendation contracts unchanged, covered by full gate and whole-PR source review. Existing identity-key/narrowed-catalog/selector mechanisms reused, no broader redesign or #179 work.

Reviews preserved: 1 COMMENT (old HEAD infrastructure); 2 REQUEST_CHANGES (test coverage gap); remediation f78cb9d; 3 COMMENT (artifact gap); 4 APPROVE with empty findings and technical/security/UX assessment at exact current HEAD/base. Recovery used immutable original focused-source export and system-recorded sanitized full-gate artifact, without permission weakening. Full exact-HEAD gate2693 PASS/17 skips, basedpyright0 diagnostics, whitespace clean; independent61 original core tests PASS. No live provider/harness/product readiness claim. Closing only this satisfied library-core issue.

Completed in the SAME /loop invocation 2026-10-05T12:38:32Z. PR #191 merged via supported Forgejo merge operation as 46cb9ab6958b63003d0b4e275590c04616fa405d. Fetched canonical develop contains that exact merge commit with parents approved base 4e1d5974f2abecf9aa43556afa591a4547656a17 and approved HEAD f78cb9d24cfc2023b450bd71c195e195db08c794; both ancestors verified, integrated tree equals approved tree. Acceptance verified: non-ranking-winner pin retains exact resource/provider/model/variant and no alternatives; missing/unbound/calibration/registration drift, stale/offline/unauthorized, conflicting explicit pins, quality/profile and unsupported-tool cases refuse without substitution; pinned compatibility regression asserts exact stage/reason/details. Existing exact admission/public gateway/logical routing/recommendation contracts unchanged, covered by full gate and whole-PR source review. Existing identity-key/narrowed-catalog/selector mechanisms reused, no broader redesign or #179 work. Reviews preserved: 1 COMMENT (old HEAD infrastructure); 2 REQUEST_CHANGES (test coverage gap); remediation f78cb9d; 3 COMMENT (artifact gap); 4 APPROVE with empty findings and technical/security/UX assessment at exact current HEAD/base. Recovery used immutable original focused-source export and system-recorded sanitized full-gate artifact, without permission weakening. Full exact-HEAD gate2693 PASS/17 skips, basedpyright0 diagnostics, whitespace clean; independent61 original core tests PASS. No live provider/harness/product readiness claim. Closing only this satisfied library-core issue.
kilo closed this issue 2026-10-05 15:32:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Creatidy/scarcity-router#178
No description provided.