Skip to content

Studio: offer ChatGPT Reconnect for reused or revoked refresh tokens - #16946

Merged
danielhanchen merged 3 commits into
unslothai:mainfrom
NilayYadav:codex-refresh-reauthorization
Nov 7, 2026
Merged

danielhanchen merged 3 commits into
unslothai:mainfrom
NilayYadav:codex-refresh-reauthorization

Conversation

@NilayYadav

@NilayYadav NilayYadav commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

When a ChatGPT subscription connection's refresh token was already used or has been revoked, OpenAI answers the refresh with refresh_token_reused or refresh_token_invalidated. Studio only recognised invalid_grant, invalid_refresh_token and refresh_token_expired as permanent, so the connection kept showing Connected, every request failed with a generic authorization error, and Reconnect was never offered.

A refresh now counts as permanently rejected for those two codes and for any 401 from the token endpoint, the same rules the Codex CLI uses. The connection is marked as needing reauthorization and the dialog offers Reconnect in browser. Network errors and 5xx answers stay retryable as before.

Tested against a real ChatGPT subscription, with one device-code sign-in per side and the refresh token then revoked through OpenAI's /oauth/revoke:

main this branch
OpenAI's answer to the refresh 401 refresh_token_invalidated ("Your session has ended. Please log in again.") same
Connection status afterwards connected reauthorization_required
Reconnect offered no yes

The saved access token's expiry was set to now so the refresh ran right away instead of after ~10 days; the refresh call and OpenAI's response were real.

@NilayYadav NilayYadav self-assigned this Nov 6, 2026
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T11:10:16.346301Z 8667143 Manual request
ℹ️ 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. More of your lovely PRs please.

Reviewed commit: 672bb5e370

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

Copy link
Copy Markdown

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

Reviewed commit: 86671433f4

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

@danielhanchen
danielhanchen merged commit d94eccf into unslothai:main Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants