Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThis PR flushes voice-call capacity and shutdown HTTP 503 responses before closing rejected WebSocket connections. Example: A second media-stream connection arrives when maxConnections is 1 and one connection is already open.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR: current main retains the premature socket destruction, and the related merged fix covers a different rejection path. No introduced correctness defect was found; GitHub confirms a merge conflict. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe voice-call webhook server dispatches recognized media-stream upgrades to MediaStreamHandler, which accepts connections or returns an HTTP rejection through the shared SDK transport helper. flowchart TD
A[Media stream client] --> B[Voice call webhook server]
B --> C[MediaStreamHandler]
C --> D[Accepted WebSocket]
C --> E[Capacity or shutdown rejection]
E --> F[Shared SDK rejection helper]
F --> G[Flush HTTP 503 then close]
Technical reviewBest possible solution: Retain the shared rejection helper and error ownership while resolving the conflict without reverting current-main media-stream refactors. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the write-then-destroy path, and the contributor supplies after-fix loopback transport output; no target code was executed during this read-only review. Is this the best way to solve the issue? Reusing the existing SDK flush-before-destroy owner is a focused repair that preserves rejection status, bodies, admission limits, and successful upgrade handling. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0ce08d269ff8. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +9, Tests +282. Total +291 across 3 files. Added test files: 1. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (10 earlier review cycles; latest 8 shown)
Reviewed November 1, 2026, 6:32 PM ET / 23:32 UTC (Revision 11). |
c5411d5 to
0358c59
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
0358c59 to
a1f08f4
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Reject media-stream WebSocket upgrades through shared rejectWebSocketUpgrade so 503 bodies flush before socket destroy, and split oversized upgrade tests into media-stream.upgrade.test.ts to satisfy oxlint max-lines.
a1f08f4 to
6f3ec86
Compare
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
@vincentkoc friendly bump — ClawSweeper has this at No open contributor proof blockers. Could you review/merge when you have bandwidth? Marked |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
What Problem This Solves
Voice-call media-stream upgrade rejects (shutdown and connection-cap) could destroy the HTTP socket before rejection bytes flushed, so clients saw a hard disconnect instead of HTTP 503. Peer reset during that write could also become
uncaughtException.Why This Change Was Made
rejectMediaStreamUpgradeattachessocket.once("error", () => {})then reusesrejectWebSocketUpgrade, which callssocket.end(response, () => destroy()). Cap and shutdown rejects share that owner.User Impact
Before: Capacity/shutdown upgrade rejects could reset the client with no HTTP status, and a reset peer during write could crash the process.
After: Clients receive
HTTP/1.1 503with the reject body; peer-reset errors during flush are swallowed.Evidence
extensions/voice-call/src/media-stream.tsrejectMediaStreamUpgradeextensions/voice-call/src/media-stream.test.ts— real HTTP 503, injected-hold flush on a real TCP socket, and RST during pendingsocket.endReal behavior proof
MediaStreamHandler.handleUpgrade→rejectMediaStreamUpgrade→rejectWebSocketUpgradeagainst a live loopback upgrade.node:http/net.connecttransport. Buffering is injected by holdingsocket.endon that real socket, then releasing so the 503 bytes flush. RST destroys the client only after the server has enteredsocket.end.openclaw/plugin-sdk/websocket-runtimerejectWebSocketUpgrade.Observed result after fix: Real transport returns HTTP 503. Holding
socket.endkeeps the reject pending until release, then the client reads the 503 body. Destroying the client atsocket.enddoes not emituncaughtException.What was not tested: Live Twilio/Telnyx media-stream against a full carrier call.
Fix classification: Root cause fix
AI-assisted (Cursor)
I understand what the code does
Change is focused and does not mix unrelated concerns