Agent-triggered logout/recovery loop revokes shared sessions and causes device-auth 429

Open 💬 1 comment Opened Jul 11, 2026 by Gerry9000

Summary

A model-controlled coding-agent session repeatedly performed account-wide Codex authentication operations while other Codex terminals and subagents were active on the same host. The repeated logout operations revoked the shared refresh credentials. The model then repeatedly initiated device-auth recovery, which caused the device-code endpoint to return HTTP 429 before issuing a code.

This is an agent-safety and multi-process authentication problem. The 429 was a consequence of repeated automated recovery, not a model-usage limit or an unexplained user traffic spike.

Environment

  • Codex CLI: codex-cli 0.144.1
  • OS: Linux 7.0.0-27-generic x86_64
  • Multiple Codex terminals and Luna subagents sharing the host credential store
  • Observed: 2026-07-11 UTC

Reproduction / incident sequence

  1. Start multiple Codex terminals or subagents sharing one host credential store.
  2. Allow a model-controlled orchestrator to run codex logout while those sessions are active.
  3. Repeat the logout/login recovery cycle multiple times.
  4. Active sessions fail with:
Your access token could not be refreshed because your refresh token was revoked. Please log out and sign in again.
  1. The orchestrator repeatedly runs:
$ codex login --device-auth
  1. The device-code request eventually fails before issuing a code:
Error logging in with device code: device code request failed with status 429 Too Many Requests

Impact

  • One model-controlled session can revoke credentials for every active Codex session sharing the credential family.
  • Repeated automated recovery can turn the revocation into a device-auth rate-limit lockout.
  • Users receive no indication which process revoked the credentials or when recovery may safely resume.
  • The CLI exposes no actionable Retry-After, reset time, request ID, or rate-limit scope.

Expected safeguards

  1. Agents must not run codex login, codex logout, codex login --device-auth, credential reset, or usage-reset operations without explicit user confirmation.
  2. codex logout must clearly warn that it can remotely revoke credentials used by concurrent sessions and installations. Prefer local-only logout by default, with an explicit account-wide option for global revocation.
  3. Device-auth recovery must be coordinated across processes, deduplicated, and protected by exponential backoff.
  4. HTTP 429 responses must honor and display Retry-After, reset time, request IDs, and actionable recovery guidance.
  5. Credential refresh and persistence need cross-process locking, atomic generation-checked writes, and a reload immediately before refresh.
  6. Add integration coverage for concurrent sessions, repeated agent logout/recovery, refresh-token rotation, stale credential stores, and device-auth rate limiting.

Related reports

  • #22577: logout affects other installations or sessions
  • #6498 and #19531: multi-session refresh-token behavior

No credentials, token contents, cookies, account email, or session identifiers are included.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗