feat(oauth): reliability, credential integrity, and diagnostics#479
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
Ready for merge. @lidge-jun |
CodexAccountPool suppresses next-session for projected reauth/cooldown; update the source-string lock so full suite stays green.
Exempt Kiro access-only creds, localize health copy, observe-only doctor reads, longer refresh lock wait, proxy-backed CLI Codex health, and safe clipboard doctor copy.
Harden short account-id masking and OAuth log secret filters, distinguish quota cooldown labels, keep cooldown actions ISO-based, validate remote health payloads, and add focused API/CLI/multiprocess regression coverage.
f580664 to
fb9b64c
Compare
Ingwannu
left a comment
There was a problem hiding this comment.
A major health-state propagation bug remains at exact head fb9b64cd47b6b314330a672de1c737f08d7f4f15. In gui/src/components/CodexAccountPool.tsx, activePoolNeedsReauth correctly combines the legacy flag with health.status === "reauth_required", but the effect still calls onActiveNeedsReauthChange(activeNeedsReauth) and depends on the legacy value. In gui/src/hooks/useProviderAccountPools.ts, activeAccountNeedsReauth likewise marks a provider only when active.needsReauth is true and ignores active.health?.status. An API response that carries only the new canonical health projection therefore shows a reauth action on the account row while the Providers overview remains healthy and omits its attention state. Pass activePoolNeedsReauth through the Codex callback, include health-only reauth in the generic provider map, and add focused aggregate-path regressions for both. This is an authentication-health UI contract and blocks merge; the current Windows job is also not green.
On it. btw. window job cancels on many pr's right now after 8 minutes, but can only look at it after i slept, So maybe u got the time to have a look. |
Pass activePoolNeedsReauth through the Codex callback, honor health.status === reauth_required in the generic provider map and Codex controller, and add aggregate-path regressions so overview attention matches row CTAs.
Ingwannu
left a comment
There was a problem hiding this comment.
Re-reviewed exact head af6bd0f. The requested aggregate-health blocker is resolved: both the shared Codex controller and generic provider map now treat health-only reauth_required as an attention state, while inactive-account reauth remains isolated. The new focused regressions pass (15 GUI + 14 workspace tests), and both GUI/root TypeScript checks are clean. The sole non-green check was a Windows job cancelled at the repository 8-minute ceiling, not a test failure; I have rerun that workflow. Approved pending a successful required-CI rerun.
Summary
This PR hardens OpenCodex OAuth reliability, credential integrity, and actionable diagnostics. It does not add client impersonation, fingerprint spoofing, or rate-limit circumvention.
Why
Concurrent requests and multi-process refresh races can corrupt rotated tokens or refresh the same grant twice. Operators also lacked a shared, redacted view of OAuth health across
ocx status,ocx doctor, and the dashboard. The Codex forward path needed regression locks so genuine client metadata stays preserved and official-client identity is never fabricated when absent.What this does
Refresh single-flight + CAS for generic OAuth providers
Extends the existing xAI/Anthropic pattern: in-process join map + per-account file lock + reload-before-refresh +
mergeAccountCredentialgeneration CAS. Prevents stale refresh results from overwriting newer credentials.Shared
OAuthAccountHealthprojectionOne read model over existing
needsReauth, Codex cooldowns, and warning signals — consumed by CLI, management API, and GUI. No parallel credential store.Diagnostics
ocx status: redacted OAuth health blockocx doctor: observe-only checks with recovery Actionsocx doctor/ cooldown hintsPrivacy
maskAccountId/displayAccountId, structuredlogOAuthEventthat strips token-like keys, never falls back to raw account IDs in UI.Codex metadata integrity
Regression tests: preserve genuine
originator/session_id/thread-id; do not fabricate when missing; outgoingchatgpt-account-idmatches the selected pool credential.Docs
Documents refresh coordination, cooldowns, process-local affinity, preserved vs non-fabricated metadata, status/doctor usage, and explicitly that this cannot guarantee protection from provider enforcement.
Explicit non-goals / policy
ocx login codex(not a public login provider).Test plan
bun testtargeted OAuth/privacy/health/status/doctor/metadata suitesbun run test(4183 pass after rebase smoke on key suites)bun run typecheckbun run lint:guibun run privacy:scanbun run build:guiocx status/ocx doctorwith a reauth-marked and cooldown accountDesign / plan
docs/superpowers/specs/2026-07-26-oauth-reliability-integrity-design.mddocs/superpowers/plans/2026-07-26-oauth-reliability-integrity.mdSummary by CodeRabbit
New Features
ocx statusandocx doctor, with convenient doctor-command copying in the dashboard.Documentation