fix: explain scan sign-in refresh failures - #571
Conversation
|
@codex review Please review commit |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review Please review commit |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review Please review exact head commit |
|
@codex security review Please review exact head commit |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c3a3aec7b
ℹ️ 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".
| /\byour access token could not be refreshed(?: because your refresh token (?:has expired|was already used|was revoked))?\. Please log out and sign in again\./iu.test( | ||
| errorMessage(error), | ||
| ) |
There was a problem hiding this comment.
Sanitize every recognized refresh-error variant
When either alternate refresh message covered by the new test (because you have since logged out... or authentication session could not be refreshed automatically) arrives with trailing upstream detail, this regex misses it, classification remains unknown, and diagnosticValue emits the entire wrapper to stderr. That permits organization, project, or credential-bearing suffixes to escape through the same boundary this branch sanitizes for the four permanent variants; preserve the native recovery advice by extracting/replacing the complete upstream error rather than passing the wrapper through.
AGENTS.md reference: sdk/typescript/AGENTS.md:L8-L12
Useful? React with 👍 / 👎.
|
@codex review Exact head: |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
When a stored ChatGPT sign-in can no longer be refreshed, the CLI now replaces Codex's raw error with safe recovery steps. This matters even for API-key scans because Codex can still use the stored sign-in to load workspace-managed policy.
Changes
Testing
bun test --timeout 30000 tests-ts/cli-authentication.test.ts tests-ts/cli.test.ts: 169 passed, 0 failed (2,310 assertions).pnpm run types: passed.pnpm run format: passed.pnpm run build: passed.git diff --check origin/main...HEAD: passed.pnpm packandnode scripts/check-package.mjs <tarball>: passed with 255 archive entries. The check validated the public import, NodeNext types, CLI, 111 bundled plugin files, bundled Codex version, and a nested worker without global Codex.Risk and rollout
This changes final CLI error presentation and documentation. It does not change command syntax, authentication selection, credential storage, reconnect behavior, or managed policy. Recovery still requires explicit logout and login when retrying the current sign-in is not enough. A package release is needed after merge.
Public disclosure review