Repository navigation
refactor(openai): split realtime voice by layer - #122414
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
8989bd3 to
1ecd93b
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 12:56 AM ET / 04:56 UTC. ClawSweeper reviewWhat this changesThe PR splits OpenAI realtime voice session policy, protocol state, event handling, WebSocket transport, and tests into focused modules while retaining the existing provider export. Merge readinessKeep open for normal maintainer review. Current main still has the monolithic realtime voice provider, while this branch preserves the public factory and internal hook contract; no blocking source defect was found in the refactor pass. Priority: P2 Review scores
Verification
How this fits togetherThe bundled OpenAI plugin turns browser or gateway voice requests into managed realtime WebSocket sessions, then reports audio, transcripts, response state, and tool events back to OpenClaw. This refactor separates those responsibilities inside the plugin without changing the provider registration path. flowchart LR
A[Browser or gateway request] --> B[OpenAI voice provider]
B --> C[Session policy and routing]
C --> D[Realtime WebSocket bridge]
D --> E[Protocol and event state]
E --> F[Audio, transcript, and tool callbacks]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +437, Tests +590, Other -2. Total +1025 across 15 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single provider factory and private core hook, then land only after exact-head CI confirms the split preserves native, Azure, browser, GPT-Live, tool, and reconnect behavior. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor rather than a report of a user-facing defect; the relevant check is preservation of the existing voice-session paths. Is this the best way to solve the issue? Yes: separating policy, protocol, events, and transport follows the existing xAI realtime pattern while preserving the public provider factory and core-private hook. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e30df720459b. LabelsLabel changes:
Label justifications:
EvidenceWhat 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
|
|
Merged via squash.
|
* refactor(openai): split realtime voice by layer * refactor(openai): delete dead realtime auth branches * chore(lint): ratchet max-lines baseline after realtime-voice split * style(openai): prune split leftovers
What Problem This Solves
The OpenAI realtime voice provider and its main unit suite had grown into two oversized files that mixed authentication, session policy, outbound response state, inbound event projection, transport lifecycle, browser routing, and test fixtures. That made ownership and safe maintenance difficult, especially around response/tool state and reconnect ordering.
Why This Change Was Made
This follows the landed xAI realtime layering: session policy, protocol, events, bridge, and provider facade.
buildOpenAIRealtimeVoiceProviderremains the sole public export at the unchanged path, theapi.tsre-export and private capability symbol remain intact, and Quicksilver keeps its type-only peer-runtime edge plus dynamic load in the gateway bridge.The second commit removes only the four approved dead paths: the redundant configured-profile result branch, duplicated GPT-Live browser auth selection, the browser cancel pass-through helper, and the impossible
response.donetype check. GA/Azure/browser payload distinctions, legacy audio/transcript aliases, and Azure deployment behavior remain unchanged.User Impact
No user-visible behavior change is intended. Maintainers get smaller owner-focused modules and suites, while existing OpenAI realtime, Azure, browser, GPT-Live, tool, response-control, and reconnect behavior remains covered.
Evidence
Remote proof was attempted first. The local Testbox executable was unavailable and managed Crabbox broker authentication was unavailable, so trusted-source proof fell back to serialized local execution as required.
pnpm test:extension openai: 51 files passed, 839 tests passed.pnpm lint:tmp:export-name-collisions: passed.pnpm check:wrapper-shadowing: passed, 0 current and 0 baselined.pnpm plugin-sdk:surface:check: passed; all 152 public SDK subpaths verified.pnpm check:import-cycles: passed, 0 runtime value cycles.pnpm build: passed in 6m38s, including CLI bootstrap, plugin SDK export, runtime postbuild, and Control UI checks.realtime-quicksilver-peer.runtime.tsremains dynamically loaded only by the gateway bridge.node scripts/check-changed.mjs: local fallback after remote unavailability; all selected checks passed except the repository-wide plugin-boundary report, which reports one pre-existing compatibility record already due for removal.pnpm lint:tmp:dynamic-import-warts -- --fail: reports 113 repository-wide pre-existing advisories and exits 1; none is in the five split OpenAI modules or the Quicksilver gateway bridge.LOC classification from
git diff --numstat origin/main...HEAD:Test LOC grew net +908 from splitting the 4,259-line suite into per-owner files with suite-local hoisted mocks, the proposal's explicit anti-leak choice for Vitest's non-isolated runner. Consolidating more pure fixtures without sharing hoisted state is a possible follow-up.