Skip to content

Fix imported account refresh authority and reused-token recovery - #6

Merged
Pimpmuckl merged 1 commit into
mainfrom
fix/multi-account-auth-authority
Jul 10, 2026
Merged

Fix imported account refresh authority and reused-token recovery#6
Pimpmuckl merged 1 commit into
mainfrom
fix/multi-account-auth-authority

Conversation

@Pimpmuckl

@Pimpmuckl Pimpmuckl commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Why

Codex++ could retain the same rotating ChatGPT refresh token in both root auth storage and an imported account profile. Concurrent managers or processes could spend that one-time token twice, producing refresh_token_reused; stale imported accounts then remained selectable, so the error could recur on startup or when opening a thread.

What changed

  • Make each imported profile the sole refresh-token authority; root auth becomes a refresh-token-free account marker.
  • Serialize refresh, account switching, import, reload, and logout transitions across managers and processes, then reload credentials after locking.
  • Treat expired, exhausted, revoked, and reused imported credentials as terminal for that profile: mark it login-required, fail over to a healthy account, or retire auth with actionable sign-in guidance.
  • Preserve forced-workspace policy, usage-limit state, active account leases, root reauthentication, and rollback safety across profile/index/marker writes.
  • Keep new coordination logic in account-owned modules with small call-site hooks.

Validation

  • just test -p codex-login: 187 passed
  • just test -p codex-cli login: 6 passed
  • just test -p codex-tui account_usage: 4 passed
  • Scoped Clippy: just fix -p codex-login -p codex-tui
  • Development package build: codex-cli 0.144.1-fork
  • Deep local review covered concurrent refresh, logout/revoke, account switching, marker resolution, forced workspaces, rollback, and reload races

The reused-token regression reproduced the original user-facing failure before the fix and passes with the final implementation.

@Pimpmuckl

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a8a90480ad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/login/src/auth/manager.rs Outdated
@Pimpmuckl

Copy link
Copy Markdown
Owner Author

@codex review

1 similar comment
@Pimpmuckl

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d59c9eada2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/login/src/account.rs
@Pimpmuckl
Pimpmuckl force-pushed the fix/multi-account-auth-authority branch 2 times, most recently from 22bdda2 to 94c0fe9 Compare July 10, 2026 19:18
@Pimpmuckl Pimpmuckl changed the title Fix imported account refresh token reuse Fix imported account refresh authority and reused-token recovery Jul 10, 2026
@Pimpmuckl

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94c0fe965f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/login/src/account.rs
Make imported account profiles the sole rotating refresh-token authority, serialize cross-process auth transitions, retire terminal credentials safely, and resolve structural account markers before workspace enforcement.
@Pimpmuckl
Pimpmuckl force-pushed the fix/multi-account-auth-authority branch from 94c0fe9 to ddca46e Compare July 10, 2026 19:41
@Pimpmuckl
Pimpmuckl merged commit dfd1e49 into main Jul 10, 2026
11 of 30 checks passed
@Pimpmuckl
Pimpmuckl deleted the fix/multi-account-auth-authority branch July 10, 2026 19:42
Pimpmuckl added a commit that referenced this pull request Jul 13, 2026
Resolve reused rotating refresh tokens across imported accounts, serialize auth transitions, retire terminal credentials safely, and enforce workspace policy against resolved account authorities.
Pimpmuckl added a commit that referenced this pull request Jul 14, 2026
Resolve reused rotating refresh tokens across imported accounts, serialize auth transitions, retire terminal credentials safely, and enforce workspace policy against resolved account authorities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant