Skip to content

fix: explain scan sign-in refresh failures - #571

Open
mldangelo-oai wants to merge 7 commits into
mainfrom
mdangelo/codex/fix-scan-auth-recovery
Open

fix: explain scan sign-in refresh failures#571
mldangelo-oai wants to merge 7 commits into
mainfrom
mdangelo/codex/fix-scan-auth-recovery

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

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

  • Recognize the four permanent refresh failures emitted by the pinned Codex executable and replace the full upstream message with status, retry, logout, and login guidance.
  • Preserve the two native recovery messages for other session states, and remove the inaccurate claim that a stored sign-in was unused during generic API-key failures.
  • Explain model authentication and workspace-managed policy loading separately in the authentication documentation.
  • Cover both authentication choices, every handled refresh variant, the preserved variants, and suppression of trailing upstream details.

Testing

  • CLI authentication suite: 27 passed, 0 failed.
  • pnpm run test --seed 12345: 1,550 passed, 29 platform-specific skips, 0 failed.
  • pnpm run types, pnpm run format, and git diff --check: passed.
  • pnpm pack and pnpm run check:package <tarball>: passed with 247 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

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@github-actions github-actions Bot added the bug Something isn't working label Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review commit b896475cda13b60eddb9ad8f1e6e11a23deb5389. Keep the public response limited to review results and public links.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: b896475cda

ℹ️ 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".

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review commit 8a56a0bc9425e7aa7010aae9306ca2b3315af2cd. Keep the public response limited to review results and public links.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-21T21:33:02.263398Z 7c3a3ae Manual request
🔒 Security Review Completed 2026-08-21T05:58:23.912594Z 56a5df4 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 8a56a0bc94

ℹ️ 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".

@mldangelo-oai
mldangelo-oai marked this pull request as ready for review August 21, 2026 05:56
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head commit 7c3a3aec7ba77de2cd7e5ae894030bb11fae145d. Focus on safe upstream error suppression, managed-policy semantics, preservation of native recovery messages, and test coverage. Keep the public response limited to review results and public links.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

Please review exact head commit 7c3a3aec7ba77de2cd7e5ae894030bb11fae145d. Focus on credential and error disclosure boundaries, authentication recovery semantics, and whether trailing upstream details can escape. Keep the public response limited to review results and public links.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Unknown error
ℹ️ 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".

@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: 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".

Comment thread sdk/typescript/src/cli.ts
Comment on lines +5744 to +5746
/\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),
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant