fix(auth): clarify Codex OAuth region failures#71501
Conversation
Greptile SummaryThis PR adds detection of OpenAI's Confidence Score: 5/5This PR is safe to merge — the change is a narrow, well-tested error-message rewrite with no side-effects on the happy path. The new branch in No files require special attention. Reviews (1): Last reviewed commit: "fix(auth): clarify Codex OAuth region fa..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9029d066d
ℹ️ 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".
|
|
||
| function rewriteOpenAICodexOAuthError(error: unknown): Error { | ||
| const message = formatErrorMessage(error); | ||
| if (/unsupported_country_region_territory/i.test(message)) { |
There was a problem hiding this comment.
Match surfaced token-exchange errors, not hidden response text
The new rewrite branch depends on unsupported_country_region_territory appearing in the thrown error message, but in the currently bundled dependency (node_modules/@mariozechner/pi-ai/dist/utils/oauth/openai-codex.js) the OAuth flow throws new Error("Token exchange failed") after a non-OK token response and does not propagate the response body text. In that real 403 region-denied path, this regex never matches, so users still get the generic OAuth failure with no region/proxy guidance despite the new changelog claim.
Useful? React with 👍 / 👎.
f9029d0 to
7f67c3a
Compare
… Unreleased Three of my (vincentkoc) entries were missing closing PR refs, and several maintainer-fix entries were missing credit for the user who reported the underlying issue: - Diagnostics/OTEL outbound delivery: add (#71471) and credit @jlapenna whose #70424 framed the broader tracing work. - Cron malformed legacy jobs: add (#71509). - OpenAI/Codex OAuth region failures: add (#71501) and credit reporter @wulala-xjj (#51175). - Telegram duplicate pollers: credit reporter @Co-Messi (#56230). - MCP/CLI one-shot retire: credit reporter @spartoviMD (#71457). - OpenAI/Codex image baseUrl canonicalize: credit reporter @GodsBoy (#71460). - Feishu TTS Ogg/Opus: credit reporters @sg1416-zg (#61249) and @ycjlb2023-peteryi (#37868). - MiniMax TTS portal OAuth: credit reporter @zx15210404690-hash (#55017). - MCP config reload disposal: credit reporter @xieyuanqing (#60656).
… Unreleased Three of my (vincentkoc) entries were missing closing PR refs, and several maintainer-fix entries were missing credit for the user who reported the underlying issue: - Diagnostics/OTEL outbound delivery: add (openclaw#71471) and credit @jlapenna whose openclaw#70424 framed the broader tracing work. - Cron malformed legacy jobs: add (openclaw#71509). - OpenAI/Codex OAuth region failures: add (openclaw#71501) and credit reporter @wulala-xjj (openclaw#51175). - Telegram duplicate pollers: credit reporter @Co-Messi (openclaw#56230). - MCP/CLI one-shot retire: credit reporter @spartoviMD (openclaw#71457). - OpenAI/Codex image baseUrl canonicalize: credit reporter @GodsBoy (openclaw#71460). - Feishu TTS Ogg/Opus: credit reporters @sg1416-zg (openclaw#61249) and @ycjlb2023-peteryi (openclaw#37868). - MiniMax TTS portal OAuth: credit reporter @zx15210404690-hash (openclaw#55017). - MCP config reload disposal: credit reporter @xieyuanqing (openclaw#60656).
… Unreleased Three of my (vincentkoc) entries were missing closing PR refs, and several maintainer-fix entries were missing credit for the user who reported the underlying issue: - Diagnostics/OTEL outbound delivery: add (openclaw#71471) and credit @jlapenna whose openclaw#70424 framed the broader tracing work. - Cron malformed legacy jobs: add (openclaw#71509). - OpenAI/Codex OAuth region failures: add (openclaw#71501) and credit reporter @wulala-xjj (openclaw#51175). - Telegram duplicate pollers: credit reporter @Co-Messi (openclaw#56230). - MCP/CLI one-shot retire: credit reporter @spartoviMD (openclaw#71457). - OpenAI/Codex image baseUrl canonicalize: credit reporter @GodsBoy (openclaw#71460). - Feishu TTS Ogg/Opus: credit reporters @sg1416-zg (openclaw#61249) and @ycjlb2023-peteryi (openclaw#37868). - MiniMax TTS portal OAuth: credit reporter @zx15210404690-hash (openclaw#55017). - MCP config reload disposal: credit reporter @xieyuanqing (openclaw#60656).
… Unreleased Three of my (vincentkoc) entries were missing closing PR refs, and several maintainer-fix entries were missing credit for the user who reported the underlying issue: - Diagnostics/OTEL outbound delivery: add (openclaw#71471) and credit @jlapenna whose openclaw#70424 framed the broader tracing work. - Cron malformed legacy jobs: add (openclaw#71509). - OpenAI/Codex OAuth region failures: add (openclaw#71501) and credit reporter @wulala-xjj (openclaw#51175). - Telegram duplicate pollers: credit reporter @Co-Messi (openclaw#56230). - MCP/CLI one-shot retire: credit reporter @spartoviMD (openclaw#71457). - OpenAI/Codex image baseUrl canonicalize: credit reporter @GodsBoy (openclaw#71460). - Feishu TTS Ogg/Opus: credit reporters @sg1416-zg (openclaw#61249) and @ycjlb2023-peteryi (openclaw#37868). - MiniMax TTS portal OAuth: credit reporter @zx15210404690-hash (openclaw#55017). - MCP config reload disposal: credit reporter @xieyuanqing (openclaw#60656).
… Unreleased Three of my (vincentkoc) entries were missing closing PR refs, and several maintainer-fix entries were missing credit for the user who reported the underlying issue: - Diagnostics/OTEL outbound delivery: add (openclaw#71471) and credit @jlapenna whose openclaw#70424 framed the broader tracing work. - Cron malformed legacy jobs: add (openclaw#71509). - OpenAI/Codex OAuth region failures: add (openclaw#71501) and credit reporter @wulala-xjj (openclaw#51175). - Telegram duplicate pollers: credit reporter @Co-Messi (openclaw#56230). - MCP/CLI one-shot retire: credit reporter @spartoviMD (openclaw#71457). - OpenAI/Codex image baseUrl canonicalize: credit reporter @GodsBoy (openclaw#71460). - Feishu TTS Ogg/Opus: credit reporters @sg1416-zg (openclaw#61249) and @ycjlb2023-peteryi (openclaw#37868). - MiniMax TTS portal OAuth: credit reporter @zx15210404690-hash (openclaw#55017). - MCP config reload disposal: credit reporter @xieyuanqing (openclaw#60656).
… Unreleased Three of my (vincentkoc) entries were missing closing PR refs, and several maintainer-fix entries were missing credit for the user who reported the underlying issue: - Diagnostics/OTEL outbound delivery: add (openclaw#71471) and credit @jlapenna whose openclaw#70424 framed the broader tracing work. - Cron malformed legacy jobs: add (openclaw#71509). - OpenAI/Codex OAuth region failures: add (openclaw#71501) and credit reporter @wulala-xjj (openclaw#51175). - Telegram duplicate pollers: credit reporter @Co-Messi (openclaw#56230). - MCP/CLI one-shot retire: credit reporter @spartoviMD (openclaw#71457). - OpenAI/Codex image baseUrl canonicalize: credit reporter @GodsBoy (openclaw#71460). - Feishu TTS Ogg/Opus: credit reporters @sg1416-zg (openclaw#61249) and @ycjlb2023-peteryi (openclaw#37868). - MiniMax TTS portal OAuth: credit reporter @zx15210404690-hash (openclaw#55017). - MCP config reload disposal: credit reporter @xieyuanqing (openclaw#60656).
Summary
unsupported_country_region_territoryfailures from the Codex OAuth token exchange.unsupported_regionOAuth error with proxy/region guidance.Fixes #51175
Validation
OPENCLAW_LOCAL_CHECK=0 pnpm test src/plugins/provider-openai-codex-oauth.test.tsOPENCLAW_LOCAL_CHECK=0 pnpm check:changed