Repository navigation
feat(openai): add Sign in with ChatGPT through Responses - #148567
stevenlee-oai merged 17 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here. ClawSweeper will not retry this unchanged revision. Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it. |
|
Codex review: needs real behavior proof before merge. Reviewed September 14, 2026, 6:28 PM ET / 22:28 UTC. ClawSweeper reviewWhat this changesAdds ChatGPT token-sharing sign-in, provider-owned credential routing, and a host-managed Responses relay for Codex while preserving separate API-key and Codex subscription choices. Merge readiness⛔ Blocked before merge - 9 items remain Keep open as a meaningful preview that current main does not provide. The contributor clearly documents the simulated evidence and outstanding prerequisites; neither closure nor merge readiness is supported. Priority: P2 Review scores
Verification
How this fits togetherThe OpenAI plugin turns sign-in results into credentials managed by OpenClaw’s existing auth store. Agent execution selects an eligible endpoint; managed Codex requests pass through a local relay that supplies the selected bearer before sending inference to OpenAI. flowchart TD
A[Browser sign-in] --> B[OpenAI consent and identity]
B --> C[OpenClaw credential store]
C --> D[Provider route policy]
D --> E[OpenClaw Responses transport]
D --> F[Managed Codex local relay]
E --> G[Public Responses API]
F --> G
Decision needed
Why: The new grant family, supported SDK contract, and OpenAI registration require explicit product and owner acceptance that source review cannot supply. Before merge
Findings
Agent review detailsSecurityNeeds attention: No concrete bypass or supply-chain defect was established, but the new bearer boundary needs composed revocation proof and security-owner involvement. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep consent and refresh with their existing owners, establish a documented SDK contract, and enable the preview only with approved-client, authority-boundary, and existing-profile compatibility proof. Do we have a high-confidence way to reproduce the issue? Not applicable: this adds a new sign-in capability rather than repairing an established failure; no definite introduced runtime defect was established. Is this the best way to solve the issue? Unclear. Provider-owned grant policy and reuse of the existing refresh owner are coherent, but SDK acceptance and real consent-to-inference evidence are needed to establish the complete solution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1b0b0fd60cb1. LabelsLabel justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
d018af4 to
36f435f
Compare
9585d72 to
234c22d
Compare
…8567) * feat(auth): route renewable OAuth grants by provider policy * feat(openai): add Sign in with ChatGPT preview * feat(codex): bridge host-owned token sharing to Responses * feat(status): show the selected model endpoint * feat(openai): register and reuse SIWC OAuth clients * docs(openai): explain authentication choices and identity * refactor(siwc): clarify sign-in choices and credential preparation * test(openai): await expired SIWC wizard before retry * test(agents): await foreign maintenance startup * feat(ui): show provider accounts and connection methods together * test(ui): select API key from provider connection dialog
What Problem This Solves
OpenClaw needs Sign in with ChatGPT (SIWC) as an authentication choice alongside Codex login and API keys, with model calls using the separately granted token-sharing capability through the public Responses API. This PR adds the sign-in flow and carries that credential through routing, the OpenClaw and managed local Codex runtimes, setup, and status.
Changes by area
SIWC provider, credential lifecycle, and sign-in UI
openclaw models auth login --provider openai --method siwc. The OpenAI plugin implements PKCE/OIDC verification, the IPv4 loopback callback on port 8080, identity-only versus token-sharing outcomes, and SIWC-specific refresh through the existing auth manager.store:false, and the temporary preview header. The provider removes unsupported request controls after caller transforms and rejects unsupported service tiers before dispatch. API-key and ordinary OAuth request behavior is preserved.Provider connection dialog
Before/after screenshots and browser coverage.
Dynamic client registration and reconnect
dynamic_agent_client, validates the real client ID returned by authorization, and saves it with the credential. The issued ID is used for token exchange, refresh, and subsequent authorization.Credential selection and provider routing
SIWC credentials with the managed Codex runtime
Model/auth endpoint visibility in status
/status, using the same resolved selection as the credential label. This distinguishes public Responses routing from the Codex backend and fixes a configured API key being labeled as a different saved OAuth credential./responses. Credentials, query strings, fragments, and custom paths are hidden; unresolved routes displayunknown.Operator documentation
Existing Codex login remains the default. This change adds no database schema, separate credential store, operator configuration option, or telemetry collection.
Scope and size
Most production growth is the SIWC protocol lifecycle, credential-aware routing, and the managed Codex adapter. The provider-dialog increment adds 216 production lines and removes 88, adds 217 test lines and removes 38, plus five documentation/manifest lines. That growth adds account summaries, visible method choices, and provider-owned comparison links while reusing the existing auth owners.
Evidence
Current-main merge (
7ef1b220c9b): merged main59c02b8cb7a, preserving its extracted compaction lifecycle and SIWC refusal before manual native inference. The status fixture now uses the current auth-binding owner without dropping profile data. Manual resolutions change imports/fixture binding only; no new production behavior or test cases. All seven focused files pass (219 tests), covering status, auth-store ownership, native compaction/cancellation, activity persistence, native auth handoff, and SIWC credential preparation. Extension production type checking, targeted lint/formatting, and diff checks pass. Independent correctness and maintainability review found no actionable issues. Direct sibling Codex source inspection confirmed that manual compaction accepts only the thread ID. Native Periphery cannot run on this Linux host; its inherited main-side finding is documented below.Provider-dialog browser follow-up (
1b86a2ea6a9): CI exposed two older tests that expected provider selection to skip directly to the API-key form. Both now select the explicit API-key method. All credential-save, no-write, and agent-switch cleanup assertions remain. Both complete browser suites pass (11/11, 40.85 seconds); formatting and fresh independent review pass. Production delta is zero; test delta is +2/-0.Provider connection dialog (
a24f2b654be): 58 focused tests and four mocked-Gateway browser scenarios pass. Final layout changes were rechecked with 35 profile/login tests and the browser scenario at desktop and 390px widths. The account-summary regression failed against the previous implementation. Core/UI/plugin production and test type checks pass. Fresh correctness and maintainability review found no actionable issues. These tests cover account display, credential-owner aliases, API-key setup, and the existing browser sign-in/wait/completion path; they do not repeat live SIWC authentication or inference. The final production/full-tree/script unused-export scans pass. The remaining local lint run was interrupted when the temporary validation workspace disappeared; no full local lint result is claimed. The previous whole-PR file-size limitation remains.Maintenance test repair (
944236e5f9a): both foreign-durable-work cases reproduced the implicit one-second polling failure in a fresh unmodified whole-file run (2 failed, 8 passed), and CI attempt 2 failed both cases too. The test now races an explicit callback-start signal against captured background completion, then retains the call-count assertion. Real SQLite admission, ownership checks, the release gate, and final settlement/cleanup are unchanged; production delta is zero, test delta is +4/-1. The complete file passes all 10 tests withnode scripts/run-vitest.mjs src/agents/embedded-agent-runner/context-engine-maintenance.ownership.test.ts --reporter=verbose;node scripts/check-changed.mjs --base a79c672f357 -- src/agents/embedded-agent-runner/context-engine-maintenance.ownership.test.tsand independent source plus automated P2 review pass.Original large-43 inventory replay: all five recorded groups were exercised on CI-matching Node 24.19.0, retaining their file selection and order. The affected file passes all 10 cases within the 64-file storage group (1,165 passed, 15 unrelated backup failures, 1 skipped). Gateway, subagent, and command groups pass 605, 917, and 197 tests respectively. The host has non-sticky mode-0777
/tmp: all 15 backup failures clear when the whole backup file is rerun with a private temporary root (28 passed, 1 skipped). The CLI group remains 28 passed / 32 failed: its explicit preferred/tmp/openclawroot still reaches that insecure ancestor despite privateTMPDIR. This is a named local validation limitation; no source, security checks, credentials, or shared permissions were changed to mask it. The initial sandbox also interfered with four Gateway fixtures; all four pass outside it.Merge reconciliation (
2662f544b29): merged mainb933613c861and reconciled the two maintenance-test startup fixes. Retains upstream naming and the PR's early-completion/failure observation; assertions and cleanup remain intact. All 10 maintenance ownership tests and the SIWC callback regression pass (11 tests total, 132.63 seconds including cold worker preparation). Formatting and diff checks pass; independent review found no actionable issues. GitHub reports the new head as mergeable; hosted CI is running.Live sign-in: user-run dynamic registration persisted an issued client ID and grant. The user subsequently confirmed that the rebuilt Mac app displays the browser controls and completes SIWC sign-in.
Live inference: on September 24 the user confirmed a successful Responses API request using the SIWC token. This clears the previously reported server-side model
404blocker. This is user-reported direct API proof; it does not establish a full managed-Codex run, live refresh, or allowance attribution.Automated coverage: focused suites cover routing, PKCE/OIDC and loopback callbacks, credential persistence after database reopen, client reuse, refresh scope changes, Responses request policy, Codex relay behavior, utility completions, and status sanitization. Current-main validation results are recorded below.
Regression proof: wrong-account adoption, legacy replacement, and refresh-fence reconnect cases failed before their fixes. After repair, the OAuth suite passes 31 tests and the real-manager identity/fence cases pass. The new real-wizard timeout integration test demonstrates listener reuse after an unacknowledged note expires; both catalog downgrade cases failed before repair and the full catalog-context suite passes 4 tests. The 4 dashboard provider-login browser cases and 22 Models-page unit cases pass; the targeted setup registration test passes.
Earlier merge validation (
f078050fbbb): resolved the CLI import overlap with main while preserving stored SIWC registrations for reconnect. All 115 focused tests pass: CLI auth (62), web-push (29), SQLite schema facts (18), and managed-Codex OAuth (6). The complete export checks pass in production, full-tree, and scripts scans. Formatting passes with the current pinned formatter. Production type checks pass across core, UI, and plugins using TypeScript 7.0.2. Test wall time was 222 seconds including 58 seconds of cold worker preparation; no test cases were added by the merge repair.Callback fixture repair (
a79c672f357): CI exposed a test that started a replacement sign-in before the expired runner had settled. The test now awaits the existing settlement barrier before asserting same-port reuse; production is unchanged. The focused test passes (64 ms test time, 22.56 s wrapper), and independent source plus automated P2 review found no actionable issues. The unmodified test also passed in a focused local replay, so that replay alone is not claimed as proof of the race.Earlier feature coverage: 448 focused tests passed for provider sign-in, request policy, routing, and Codex credential preparation. CI-regression shards cover missing-profile handling, callback port reuse, stream selection, status, wrapper closure, plugin boundaries, and Codex fixtures. Docs MDX/link checks and production/plugin-test type checks passed on the previous head.
Review: Kevin approved the preceding head; GitHub dismissed that approval after the merge update, and follow-up review has been requested. A fresh independent correctness and maintainability review found no actionable merge issues. Native Codex source was inspected directly for route construction, account auth, and request-header behavior. The automated review scanner stopped on synthetic credential URLs in the endpoint-sanitization tests; no automated clean verdict is claimed.
Build and proof limits: the earlier full build passed at
2a3a051fe38; it is not exact-head build proof. Earlier full changed-file validation stopped at the file-size ratchet. Composed persisted-grant-to-physical-egress rejection, live refresh, and allowance attribution remain unverified. Prior boundary tests and user-reported inference are not presented as proof of those paths.The automated browser recording uses Chromium and a simulated provider. The live Mac sign-in result above is user-reported verification of the embedded app flow.
Recorded dashboard recovery · Callback completion
The provider picker also distinguishes Codex access from SIWC. These screenshots use the real Control UI with canonical before/after provider metadata from a simulated Gateway; no authentication or inference was performed for this capture.
GitHub accepted the media uploads. The provider-dialog images are embedded in the linked comment; their URLs redirect publicly after attachment, but this environment cannot retrieve the image CDN, so PR image rendering remains unverified. Earlier video CDN playback also remains unverified.
Preview limits and remaining work
GatewayExternalAuthorizationError, its initializer, anderrorDescription. This type was introduced on main by #157454 as a staged iOS prerequisite; no production caller creates it yet. #157516 documents the same baseline failure. The SIWC candidate leaves the shared Swift sources identical to main and adds no suppression. Its owner needs to resolve activation/retention; removing that unrelated feature here would be incorrect. The previous release-tooling and eager-import failures did not recur on1b86a2ea6a9.