Add OpenAI OAuth TLS preflight and doctor prerequisite check#32051
Add OpenAI OAuth TLS preflight and doctor prerequisite check#32051grp06 merged 4 commits intoopenclaw:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c71cd7db8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
src/commands/oauth-tls-preflight.ts
Outdated
| /unable to verify the first certificate/i, | ||
| /self[- ]signed certificate/i, | ||
| /certificate has expired/i, | ||
| /tls/i, |
There was a problem hiding this comment.
Remove generic TLS regex from cert-failure detection
The TLS_CERT_ERROR_PATTERNS entry /tls/i will classify many non-certificate failures as tls-cert (for example, Node fetch errors like ECONNRESET that say "secure TLS connection was established"). That classification is consumed by loginOpenAICodexOAuth, which hard-fails early for tls-cert and shows Homebrew certificate remediation, so transient/proxy transport failures get misreported as cert-chain issues and abort OAuth before a real login attempt. Please keep cert detection limited to certificate-specific codes/messages so generic TLS transport errors stay in the network path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Removed the generic /tls/i pattern from TLS_CERT_ERROR_PATTERNS, so only certificate-specific codes/messages map to tls-cert. Added a regression test asserting "secure TLS connection was established" transport failures stay classified as network.
Greptile SummaryThis PR adds a TLS preflight check for OpenAI OAuth flows to detect certificate chain issues early. The implementation is well-structured with comprehensive test coverage:
The error handling correctly distinguishes TLS certificate errors from general network issues, and the remediation messages provide specific Homebrew commands ( No issues found - the implementation follows existing patterns, has robust error handling, and provides a clear user experience improvement. Confidence Score: 5/5
Last reviewed commit: 0c71cd7 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 943aba1bbe
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
src/commands/doctor.ts
Outdated
| await noteMacLaunchctlGatewayEnvOverrides(cfg); | ||
|
|
||
| await noteSecurityWarnings(cfg); | ||
| await noteOpenAIOAuthTlsPrerequisites(); |
There was a problem hiding this comment.
Gate OAuth TLS preflight in doctor to avoid global 4s probe
This new call runs on every doctor execution, even when the user is not using OpenAI OAuth, and it triggers an outbound probe to auth.openai.com; combined with runOpenAIOAuthTlsPreflight({ timeoutMs: 4000 }), blocked/offline environments can now pay an extra ~4s on every run with no actionable output (network errors are intentionally suppressed). Please make this check conditional (for example, only when OpenAI OAuth is configured or in an explicit deep/probe mode) so doctor doesn't add a universal external dependency and latency penalty.
Useful? React with 👍 / 👎.
943aba1 to
27e55c7
Compare
|
Landed via temp rebase onto main.
Thanks @alexfilatov! |
* main: (154 commits) fix: harden exec allowlist regex literal handling (openclaw#32162) (thanks @stakeswky) fix(exec): escape regex literals in allowlist path matching fix: OpenAI OAuth TLS preflight gating (openclaw#32051) (thanks @alexfilatov) Auth: gate OpenAI OAuth TLS preflight in doctor Fix TLS cert preflight classification false positive Add OpenAI OAuth TLS preflight and doctor prerequisite check fix(gateway): hot-reload channelHealthCheckMinutes without full restart refactor: harden plugin install flow and main DM route pinning fix: propagate whatsapp inbound fromMe context (openclaw#32167) (thanks @scoootscooob) fix(whatsapp): propagate fromMe through inbound message pipeline refactor: harden msteams lifecycle and attachment flows fix(config): move sensitive-schema hint warnings to debug test(perf): reduce heavy fixture and guardrail overhead perf(core): speed up routing, pairing, slack, and security scans refactor: unify queueing and normalize telegram slack flows fix: harden bundled plugin install fallback semantics (openclaw#32096) (thanks @scoootscooob) fix(plugins): prefer bundled plugin ids over bare npm specs fix: distinguish warning message for non-OpenClaw vs missing npm package fix(plugins): fall back to bundled plugin when npm spec resolves to non-OpenClaw package (openclaw#32019) fix: harden msteams revoked-context fallback delivery (openclaw#27224) (thanks @openperf) ...
Summary
Add an OpenAI OAuth TLS preflight to detect local certificate-chain problems early and provide actionable remediation, instead of surfacing only
TypeError: fetch failed.Changes
runOpenAIOAuthTlsPreflight()and remediation formatter insrc/commands/oauth-tls-preflight.ts.loginOpenAICodex()insrc/commands/openai-codex-oauth.ts.noteOpenAIOAuthTlsPrerequisites()insrc/commands/doctor.ts.src/commands/doctor.fast-path-mocks.ts.User-visible behavior
brew postinstall ca-certificatesbrew postinstall openssl@3openclaw doctornow reports anOAuth TLS prerequisiteswarning when TLS trust is broken for OpenAI auth calls.Why
On some Homebrew Node/OpenSSL setups, missing or broken cert bundle links cause OAuth failures like:
OpenAI OAuth failedTypeError: fetch failedUNABLE_TO_GET_ISSUER_CERT_LOCALLYThis change turns that failure mode into an explicit prerequisite check with concrete fixes.
Tests
Ran:
All passed.