[Auth] Expose OpenAI subscription execution eligibility to selection (M4.1) #82
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Creatidy/scarcity-router#82
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Goal
Extend the normalized contract with a versioned, provider-generic execution eligibility report so selection can distinguish, before routing:
eligible);allowance_unavailable);policy_blocked— forbidden for autonomy by owner policy);unknown— fail closed).The selector must exclude non-eligible providers through a first-class exclusion stage so the router selects the least-scarce capable and executable provider (e.g. Z.ai when OpenAI is unsafe) without any caller-side fallback.
Why
Owner policy change for M4.1 (Infrastructure/creatidy-autonomy): subscription allowance is allowed; purchased-credit usage is forbidden; API PAYG is forbidden. Today the Codex collector validates credits/spend-control/ordinary-usage telemetry but withholds it from normalized output (D-019 "validated-but-unrepresented"), and a
credits.hasCredits=trueaccount still produces a healthystatus="ok"snapshot — the router would select OpenAI for an account state the owner forbids. Unsafe OpenAI must be excluded BEFORE routing instead of failing after selection.Evidence re-verified 2026-09-16 (first-party): included usage is consumed first, then usage draws from the credit balance; no documented opt-out exists for draw-down; auto-reload is a UI setting; mid-task continuation can cross the allowance/credit boundary; balances can go negative (help.openai.com articles 12642688, 11369540).
Scope
ExecutionEligibility(ownschema_version: 1; closed state + reason-code vocabularies; strict serialization, unknown keys rejected; omitted-never-null), separate from CapacitySnapshot v3 — never collapsed.account/rateLimits/readresult (credits present/unknown, ordinaryUsageAllowed generation-aware, spendControlReached, rateLimitReachedType, individualLimit exhausted, upsell present, 100% main windows). Unknown == unsafe.unknowneligibility with safe reason codes. Optional explicitbinary_pathoverride (production uses a pinned standalone install; VS Code extension discovery stays default).executionexclusion stage + reason codes (execution_allowance_unavailable,execution_policy_blocked,execution_unverified), per-provider eligibility gate in the candidate pipeline,eligibility_reportsinput with at-most-one-per-provider discipline; decision D-039 in docs/decisions.md./v1/statusenvelope gains an additive optionaleligibilityarray (machine-interface v1 additive-domain-field rule); CLI--jsonsnapshot-array shape unchanged.Non-scope
Acceptance criteria
credits.hasCredits=true→ OpenAI candidates excluded withexecution_policy_blockedeven when capacity windows are healthy.hasCreditsmissing/unreadable,ordinaryUsageAllowednot explicitlytrue, orspendControlReachedunknown →execution_unverified(fail closed).ordinaryUsageAllowed=false) →execution_allowance_unavailable.unknowneligibility; safe Z.ai candidates remain selectable; no eligibility report for Z.ai (gate is a no-op there).status --jsonbyte-shape unchanged.uv sync --only-dev && make check && uv run basedpyright && git diff --checkgreen; tests deterministic and quota-free.Constraints
Links
Closeout (v0.1.0 release-readiness reconciliation, 2026-09-21). The D-039 execution-eligibility work this issue describes is implemented, merged and pinned by tests; A0 (#85) already recorded that "its scope is complete and it remains a separate open issue for its own closeout" — this is that closeout.
ExecutionEligibilityv1 (eligibility.py, ownschema_version, closed state/reason vocabularies, strict two-way serialization) and the pure OpenAI eligibility parser (providers/openai_eligibility.py) — 23 contract tests intests/test_eligibility.py, 89 acquisition/parser tests intests/test_openai_codex_acquisition.py.executionexclusion stage with the acceptance criteria mapped to named tests intests/test_selector_eligibility.py:test_policy_blocked_excludes_openai_and_zai_is_selected(criterion 1),test_unverified_excludes_openai_fail_closed(criterion 2),test_allowance_unavailable_excludes_openai(criterion 3), collector-failure →unknownwith Z.ai unaffected and no-report baseline behavior (criterion 4/5,test_no_reports_matches_documented_baseline,test_openai_still_selected_when_eligible_and_zai_lacks_capacity), additive envelope parity with unchanged CLIstatus --jsonshape (criterion 6, M08 guardrails).docs/decisions.mdwith provenance; the later-32603auth-failure classification fix (#101) landed separately and merged 2026-09-20.develop@9d6192e(1868 tests, basedpyright clean), Forgejo CI green (run #25).Closing as complete.