fix(telemetry): classify evidenced Codex auth failure as auth_required / telemetry_auth_required #101
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#101
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
Make the Router's OpenAI telemetry distinguish an authentication-required condition (expired/unrecoverable persisted ChatGPT credential) from generic telemetry/schema failure, so operators see the bounded reason
telemetry_auth_requiredinstead of the ambiguoustelemetry_invalid. Routing must remain fail-closed.Confirmed incident evidence (Precision PRD, 2026-09-19)
During the Codex ChatGPT credential-expiry incident (Infrastructure/creatidy-autonomy#50), the Router reported
state=unknown, reason_codes=["telemetry_invalid"]while the actual upstream condition was authentication: app-serveraccount/rateLimits/read→ JSON-RPC-32603→ backend401 Unauthorized→ token expired. That diagnosis cost a manual production investigation; the code already contains every vocabulary element needed for the precise answer.Why the reason code is currently unreachable (verified on develop
fce4311)_STATUS_VALUESalready contains snapshot statusauth_required,_DIAGNOSTIC_CODEScontains diagnosticauth_required, andELIGIBILITY_REASON_CODEScontainstelemetry_auth_required(capacity.py,eligibility.py)._failure_eligibility()already maps statusauth_required→ reasontelemetry_auth_required(providers/openai_codex_acquisition.py)._run_session()never produces theauth_requiredstatus: after the evidenced-32603trigger, the bounded D-018 recovery failure paths (refresh response carries a validated protocol error; retry response carries a validated protocol error) return_observation("unknown", "telemetry_unknown"), which normalizes totelemetry_invalid.Scope
_run_session(): when the rate-limits read fails with the evidenced-32603code and the bounded recovery sequence then fails (refresh response carries a validated protocol error, or the retry carries a validated protocol error), classify the observation as snapshot status/diagnosticauth_required→ eligibilityunknownwith reasontelemetry_auth_required. Any other protocol-error code keeps the existingunknown/telemetry_unknownbehavior. The initial-32603alone (before recovery is attempted) must not classify anything by itself.auth_required; retry-error →auth_required; non-−32603 errors unchanged; parse-pathtelemetry_invalidunchanged.docs/capacity-model.md/docs/decisions.mdD-018 wording).Security invariants (unchanged)
auth_requiredmaps to eligibility stateunknown; OpenAI stays excluded until a validated rate-limits observation succeeds.Non-goals
reason_codes).Acceptance criteria
state=unknown,reason_codes=["telemetry_auth_required"]on/v1/statusand in the select exclusion evidence.make checkgreen.Links
Owner-review outcome (correction pushed to PR #102, commit
2293c89): thetelemetry_auth_requiredclassification is reverted — accuracy over vocabulary reachability.Structured-signal audit of pinned codex 0.154.0 (source:
codex-rs/app-server)error_code.rsconstructs everyJSONRPCErrorErrorwithdata: None— the only members are the integercodeand the free-textmessage(which the router's security contract forbids parsing).-32603conflates all backend failures.account_processor.rs(get_account_rate_limits_response):response.map_err(|err| internal_error(format!("failed to fetch codex rate limits: {err}")))— an expired-token 401, a 403, a 5xx, a timeout or an empty snapshot all collapse into the same-32603. A failed refresh/retry therefore does not prove an authentication condition; a backend outage that outlives one refresh+retry would have been mislabeledauth_requiredand sent an operator into a pointless device-auth re-login.get_account_responsecallsrefresh_token_if_requested(do_refresh).awaitand discards the outcome (fire-and-forget); refresh failure never produces an error envelope. This matches the live probe evidence from 2026-09-20:account/read {refreshToken:true}returned a RESULT even while the retry afterwards still failed with-32603.The only code-level auth-adjacent signal on this surface is
-32600 invalid_request("…authentication required to read rate limits") for a missing/unusable local auth store — but-32600is also used for unrelated invalid-request conditions, it is not the expired-token shape (production evidenced-32603), and D-018 deliberately never refreshes on it.Resulting behavior
unknown/telemetry_unknown→ eligibilityunknown/telemetry_invalid(the pre-#102 fail-closed behavior). Routing is fail-closed either way; only the diagnosis changed back.telemetry_auth_requiredstays deliberately unreachable until a future codex generation exposes a bounded, structured, non-secret auth-failure signal (typed errordataor a dedicated error code). D-018 now records this amendment and those conditions explicitly.autonomy-openai-maintain.prd, exit 4 =auth_required) and the primary issue's runbook.