Repository navigation
feat(talk): enable GPT Live with Codex OAuth - #113354
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9eb5606102
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
Adds an explicit, experimental talk.realtime.providers.openai.authMode: "codex-oauth" route so browser/iOS WebRTC Talk can use the Gateway’s existing Codex OAuth subscription (via the bundled Codex plugin) instead of requiring an OpenAI Platform API key, while keeping the default API-key flow intact.
Changes:
- Adds a plugin-SDK “browser session broker” registry and wires the OpenAI realtime voice provider to delegate
codex-oauthbrowser sessions to a registered broker. - Implements the Codex plugin broker + HTTP route to perform a one-time WebRTC SDP exchange via the Codex app-server and start an ephemeral read-only v3 thread seeded with bounded context.
- Updates Talk/Gateway/UI to pass bounded recent transcript items into session creation and refactors UI WebRTC support helpers.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/pages/chat/realtime-talk-webrtc.ts | Refactors WebRTC Talk transport, delegates SDP exchange, adds new server event handling, and improves autoplay/playback retry logic. |
| ui/src/pages/chat/realtime-talk-webrtc-support.ts | New helper module for SDP offer exchange and shared WebRTC utilities/constants. |
| src/talk/provider-types.ts | Extends browser session create request for broker-based flows (agent/workspace + initialItems) and adds broker type. |
| src/talk/client-voice-session.ts | Returns the created sessionId from ensureClientVoiceAgentSessionEntry for downstream use. |
| src/talk/client-voice-session.test.ts | Updates tests to assert returned sessionId is stored. |
| src/talk/browser-session-broker-registry.ts | Adds a process-scoped registry for provider/authMode browser-session brokers. |
| src/talk/browser-session-broker-registry.test.ts | Adds coverage for normalization + stale cleanup behavior in the broker registry. |
| src/plugin-sdk/realtime-voice.ts | Exposes broker APIs/types via the plugin SDK. |
| src/gateway/server-methods/talk.test.ts | Adds coverage for bounded initialItems selection and verifies broker inputs include agent/workspace/context items. |
| src/gateway/server-methods/talk-client.ts | Plumbs agent session id + workspace dir + bounded transcript preview into browser session creation. |
| src/config/schema.labels.ts | Adds label for talk.realtime.providers.*.authMode. |
| src/config/schema.help.core.ts | Documents the new authMode config field. |
| extensions/openai/realtime-voice-provider.ts | Adds explicit codex-oauth delegation to a registered broker; disables external CLI auth for Platform-key resolution. |
| extensions/openai/realtime-voice-provider.test.ts | Adds tests for codex-oauth broker delegation and updates provider-auth expectations. |
| extensions/codex/src/realtime-browser-session.ts | Implements the Codex OAuth realtime browser-session broker + one-time reservation and SDP handler. |
| extensions/codex/src/realtime-browser-session.test.ts | Adds tests for reservations, disconnect cleanup, handler behavior, and request shape. |
| extensions/codex/openclaw.plugin.json | Adds config path trigger for talk.realtime.providers.openai.authMode. |
| extensions/codex/index.ts | Registers the broker and HTTP route when the plugin is in full registration mode; adds lifecycle cleanup on disable. |
| docs/web/control-ui.md | Updates Control UI docs to describe the explicit Codex OAuth WebRTC Talk route. |
| docs/providers/openai.md | Updates OpenAI provider docs to mention experimental Codex OAuth for browser WebRTC Talk. |
| docs/nodes/talk.md | Documents configuration for selecting authMode: "codex-oauth" and its limitations. |
Comments suppressed due to low confidence (1)
extensions/codex/src/realtime-browser-session.ts:232
- This check uses
reservations.size(which includes active sessions) but the error message says "pending". If the intent is to cap total concurrent Codex realtime sessions, the message should reflect that and the constant name should align (see rename above).
prunePendingOffers();
if (reservations.size >= CODEX_REALTIME_MAX_PENDING) {
throw new Error("Too many pending Codex OAuth realtime sessions; try again in a minute");
}
This comment has been minimized.
This comment has been minimized.
# Conflicts: # src/gateway/server-methods/talk-client.ts
|
Addressed the architecture concern from the current ClawSweeper review and refreshed the branch onto current What changed:
Exact head: Fresh proof:
Direct Codex contract check used sibling Codex
Current exact-head CI is running: https://github.com/openclaw/openclaw/actions/runs/30178371315 @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Final-head refresh is pushed at
The public Plugin SDK broker/registrar called out in the prior review is gone; the fallback is now an internal bundled Codex/OpenAI seam. There is still no auth-mode config, env var, or UI selector. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Final cleanup is pushed at This resolves the remaining SDK concern:
Exact-head proof:
@clawsweeper re-review Final CI update: exact-head run 30180149181 passed on attempt 2 with 69 successful jobs, 5 expected skips, and zero failures. Attempt 1\u0027s only failure was an untouched macOS Swift retain-cycle test; the targeted rerun passed, including OpenClawKit tests and the full Swift test step. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Closes #113353
What Problem This Solves
This PR enables GPT Live (
gpt-realtime-2.1) in browser and iOS Talk for users already signed in with Codex OAuth.Browser Talk currently requires an OpenAI Platform API key even when Codex already has a working subscription login and native realtime session support. The OAuth credential cannot be exposed to the browser or sent to the public Platform Realtime endpoint.
Why This Change Was Made
OpenAI realtime authentication is now selected automatically in this order:
talk.realtime.providers.openai.apiKeyopenaiAPI-key auth profileOPENAI_API_KEYThere is no auth-mode setting, new environment variable, provider alias, or UI selector. If neither Platform auth nor Codex OAuth is available, Talk remains unavailable. An authored Platform credential remains authoritative if it is invalid, so OAuth does not hide configuration errors.
The OAuth fallback is internal to the bundled Codex and OpenAI plugins; it adds no public Plugin SDK broker/registry surface, and the public realtime provider types are unchanged from
main. The browser receives only a bounded, single-use WebRTC exchange token. The Codex plugin starts an ephemeral read-only V3 realtime thread with the Talk instructions and bounded recent session context, then stops and unsubscribes it on completion, failure, disconnect, or shutdown.Platform auth remains first and keeps the full Realtime feature set, including direct tools and Video Talk. The Codex OAuth fallback is browser/iOS WebRTC-only and advertises only what the Codex realtime contract supports.
Cross-origin Control UI deployments use the existing
gateway.controlUi.allowedOriginspolicy for the SDP preflight. This PR adds no config surface.User Impact
Users with an existing Codex subscription login can open Talk and speak with GPT Live without adding an OpenAI API key or choosing an auth mode. The session starts with recent OpenClaw conversation context and persists completed user and assistant transcript turns back to the active session.
Users with an OpenAI Platform key keep the current Platform-first behavior and features.
Evidence
OAuth-only live proof
Live-tested commit
ec59b607831347910b577014308ed3555d15b226. Current head4b464fd443cb804be0655949a9669390dbce20efmerges currentmain81b7a0a00657a6b6cfbc808cfa914a53c75659cb; the incomingmaincommits have no file overlap with the PR, and the exact-head build and managed Gateway install are green.OPENAI_API_KEYfrom the proof process.talk.catalogreported OpenAI ready through Codex OAuth with WebRTC browser-session support and no unsupported direct tools or video frames.RTCPeerConnectionsent generated microphone audio through/plugins/codex/realtime/calls.200 application/sdp; remote description, data channel, and one remote audio track all completed.session.started,input_transcript.added,turn.created,turn.delta,output_transcript.added, andturn.done.401; an expired token also returned401.talk.client.closesucceeded.Checks
git diff --checkpassed.4b464fd443cb804be0655949a9669390dbce20efbuilds successfully, verifies all 142 public Plugin SDK subpaths, passes Control UI performance gates, and is installed as the managed Gateway LaunchAgent with healthy RPC on OpenClaw2026.7.2.Direct Codex contract check
Checked sibling Codex source at
000d2540ad73996f3589ae178bfe447bfd67cef2:codex-rs/app-server-protocol/src/protocol/common.rs:848-876declaresthread/realtime/startandthread/realtime/stop.codex-rs/app-server-protocol/src/protocol/v2/realtime.rs:95-148defines model/output/startup context, V3 initial items, and browser-generated WebRTC SDP transport.codex-rs/app-server/src/request_processors/turn_processor.rs:1029-1112validates and maps realtime start.codex-rs/app-server/src/bespoke_event_handling.rs:399-480emits started, SDP, and transcript notifications.codex-rs/app-server/src/request_processors/turn_processor.rs:1195-1211andbespoke_event_handling.rs:548-555implement stop and closed notification behavior.Related: #87273
AI-assisted implementation: Codex.