Repository navigation
fix(ui): prevent oversized WebRTC SDP answers from hanging Talk setup - #119295
Patrick-Erichsen merged 11 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 7:24 PM ET / 23:24 UTC. ClawSweeper reviewWhat this changesBounds OpenAI WebRTC SDP answer reads in Control UI Talk, cancels discarded response bodies, and adds unit and browser regression coverage. Merge readinessKeep open. Current main still reads WebRTC SDP answers with an unbounded Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherControl UI Talk requests a browser-owned WebRTC session from the Gateway, sends an SDP offer to the provider, then applies the response to the browser peer connection. The changed path decides whether to stream a bounded answer or show a setup error before peer setup. flowchart LR
A[Talk user action] --> B[Gateway browser session]
B --> C[OpenAI session metadata]
C --> D[Browser SDP offer]
D --> E[Bounded response handling]
E --> F[Peer connection]
E --> G[Visible setup error]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +154, Tests +293. Total +447 across 14 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the bounded reader after exact-head checks pass, retaining the provider-declared optional limit so generic provider sessions remain unchanged. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main’s successful SDP path uses unbounded response.text(), while the PR’s focused tests exercise declared and streamed overflow at that owner boundary. Is this the best way to solve the issue? Yes. Passing a provider-declared limit keeps vendor policy in the OpenAI provider and avoids imposing an OpenAI cap on generic WebRTC sessions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9abfc1b4a341. 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
HistoryReview history (17 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
1e555bb to
99691c3
Compare
|
@Patrick-Erichsen The force-push/rebase preserved your bounded-reader commit The current CI red is isolated to Could you please take a look when convenient? |
99691c3 to
39e3058
Compare
|
@Patrick-Erichsen exact-head follow-up for
This external-contributor/secretless path cannot run a credentialed OpenAI browser session. The remaining maintainer decision is therefore one of:
There are no open code findings and no author-side proof that can be added honestly without provider credentials. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
The prior exact-head re-review run was cancelled without publishing a verdict or updating the durable review: The PR head is still @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@Patrick-Erichsen exact-head follow-up for
As an external contributor I cannot expose repository/OpenAI credentials to the contributor checkout. Could you either run the existing credentialed OpenAI browser/WebRTC proof on this reviewed head, or explicitly accept the existing 256 KiB OpenAI realtime contract for this browser boundary? |
|
@clawsweeper re-review The PR Evidence section is now updated with credentialed, after-fix proof on the exact reviewed head A repository-pinned real Chromium No token, account identifier, response body, or full SDP is included. Please reassess the previous |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Patrick-Erichsen
left a comment
There was a problem hiding this comment.
Approved for landing at exact head b342d3abd74d11140c512499235e4fd48b5375f5.
The maintainer repair moves the 256 KiB SDP response policy into optional OpenAI-owned session metadata, keeps the generic WebRTC exchange provider-neutral, shares one bounded browser response reader with custom-theme imports, and cancels stale, failed, or oversized response bodies while releasing reader locks after aborts.
Proof:
- Red Crabbox run captured the two intended provider-contract regressions.
- Green Crabbox run passed 114 focused tests, including Chromium UI proof.
- Exact-head CI completed successfully.
- ClawSweeper reviewed this SHA with no actionable code finding; its exact-head CI rank-up move is complete.
- Fresh autoreview was clean, the independent verifier found no code finding, and
OPENCLAW_TESTBOX=1 scripts/pr prepare-run 119295passed the repository-native prepare gates.
Known proof boundary: the approved root had authenticated Chromium/OpenAI wire proof. A refreshed disposable-state probe had no usable OAuth profile, so no new provider call was made and operator auth was not changed. The repaired exact tree has fresh Crabbox provider-contract and Chromium failure-path proof; ClawSweeper accepted the combined evidence.
HTTP failure remains visible and terminates before peer setup:
Oversized SDP remains visible and terminates before setRemoteDescription:
|
Merged via squash.
|
…openclaw#119295) * fix(ui): bound WebRTC SDP answer reads and release failed bodies * fix(ui): scope WebRTC SDP limits to OpenAI * fix(ui): release bounded response readers * test(ui): split WebRTC SDP browser coverage * fix(ui): reject unsafe declared response lengths * test(ui): reuse pending WebRTC SDP response fixture * test(ui): use native response for pending SDP body * style(ui): align pending SDP fixture formatting * test(ui): capture WebRTC SDP alert proof --------- Co-authored-by: Patrick Erichsen <[email protected]>


What Problem This Solves
Control UI Talk buffered successful WebRTC SDP answers with an unbounded
response.text()call. Stale and failed offer responses could also leave their Fetch bodies unconsumed.Why This Change Was Made
OpenAI's two browser-session producers now declare their existing 256 KiB SDP response contract through optional
offerResponseMaxBytessession metadata. The generic WebRTC exchange consumes that metadata without branching on a provider name, while providers that omit the field retain their prior response behavior.The exchange cancels stale and non-2xx response bodies and uses a shared bounded response reader for opted-in sessions. That reader also replaces the previous custom-theme implementation, so both browser response owners share safe
Content-Length, streaming overflow, cancellation, and reader-lock cleanup behavior.User Impact
OpenAI WebRTC Talk setup no longer buffers an arbitrarily large SDP answer. Oversized, stale, and failed responses terminate cleanly with a visible setup error instead of hanging or retaining the body reader. Custom providers are unchanged unless they explicitly opt into a limit.
Evidence
b342d3abd74d11140c512499235e4fd48b5375f5(treed4bbdf2af13addd95a626fcce44277e8be4e6331).Root cause and owner boundary
RealtimeTalkWebRtcOfferExchange.readAnswerowned an unbounded generic body read, while the OpenAI-specific size policy was not represented in browser-session metadata. The repair keeps the numeric policy with the OpenAI provider and gives the generic Control UI transport one optional contract to enforce it.Production delta is +84/-45 (net +39); tests and test support are +438/-30 (net +408). The production growth is one shared 63-line bounded reader replacing 44 lines of duplicate custom-theme logic, plus the narrow optional provider-session field and its two OpenAI producers.
Live-proof boundary
The approved root already had authenticated Chromium/OpenAI wire proof. A refreshed probe on the current-main reconstruction was attempted only against a disposable imported state copy, but no usable OAuth profile was available, so no new OpenAI call was made and operator auth was not changed. The repaired exact tree instead has fresh Crabbox provider-contract and Chromium UI proof; ClawSweeper accepted that combined evidence as sufficient.