Skip to content

fix: avoid invalidating valid Codex sessions during background refresh - #137

Closed
Bl0ck154 wants to merge 1 commit into
Lampese:mainfrom
Bl0ck154:fix/oauth-refresh-regression-upstream
Closed

Bl0ck154 wants to merge 1 commit into
Lampese:mainfrom
Bl0ck154:fix/oauth-refresh-regression-upstream

Conversation

@Bl0ck154

@Bl0ck154 Bl0ck154 commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the v0.2.12 OAuth regression reported in #136.

The main issue is that background usage/metadata refreshes can refresh OAuth solely because the stored ID token is expired, even while the access token and live Codex session are still valid. With rotated/single-use refresh tokens this can surface refresh_token_invalidated / refresh_token_reused and incorrectly make valid accounts look logged out.

Changes:

  • background usage, warm-up and metadata refresh only refresh OAuth when the access token is actually expired/near expiry;
  • account switching still prefers a full token refresh, but falls back to an existing usable access token if refresh fails, instead of aborting the switch;
  • known refresh-token failures are mapped to human-readable messages instead of dumping raw backend JSON into the account card;
  • when Codex is running, Switch now opens the existing force-close-and-switch flow instead of behaving like a dead/disabled action; the button label remains simply Switch.

Validation:

  • frontend production build passes (tsc && vite build);
  • Rust test suite passes: 49 passed, 0 failed.

Maintenance triage — 2026-09-30

Continue in: #185.

OAuth refresh policy is consolidated in #136 / #185, with the #182 cross-process persistence foundation. The force-close switch entry point is already present in main. The human-readable authentication-error presentation from this PR remains an acceptance concern in #136 and must be retained or split into an explicit follow-up before treating that issue as fully resolved. #185 is open and unmerged.

@Bl0ck154
Bl0ck154 force-pushed the fix/oauth-refresh-regression-upstream branch from 30c5405 to 4e6d8b0 Compare August 30, 2026 06:05
@Bl0ck154
Bl0ck154 force-pushed the fix/oauth-refresh-regression-upstream branch from 4e6d8b0 to 20d0f9e Compare September 7, 2026 08:13
@Lampese Lampese added bug Something isn't working duplicate This issue or pull request already exists area:auth OAuth, token refresh, identity, activation and reauthentication. priority:P1 Address first: auth, data integrity, security, startup or release validation. status:superseded Review is consolidated in a linked newer PR; this does not imply a released fix. labels Sep 30, 2026
@Lampese Lampese closed this Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:auth OAuth, token refresh, identity, activation and reauthentication. bug Something isn't working duplicate This issue or pull request already exists priority:P1 Address first: auth, data integrity, security, startup or release validation. status:superseded Review is consolidated in a linked newer PR; this does not imply a released fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants