Repository navigation
fix(gateway): deliver upgrade rejection responses under Bun - #139516
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 maintainer review before merge. Reviewed September 5, 2026, 9:27 PM ET / September 6, 2026, 01:27 UTC. ClawSweeper reviewWhat this changesThe PR flushes Gateway WebSocket rejection responses before closing connections, adds reused-connection coverage, and makes timeout assertions portable across runtimes. Merge readiness✅ Ready for maintainer review The fix remains necessary on the supplied main and latest release. No actionable introduced defect remains, and the earlier payload-limit warning is addressed. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway checks incoming WebSocket upgrades for authentication and admission before handing accepted connections to their handlers. Rejected connections receive an HTTP explanation before closing. flowchart TD
A[Client upgrade request] --> B[Gateway routing]
B --> C{Authentication and admission}
C -->|Accepted| D[WebSocket handler]
C -->|Rejected| E[HTTP rejection response]
E --> F[Finish writing]
F --> G[Close socket]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -16, Tests +75. Total +59 across 5 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep rejection shutdown in the transport owner, preserving existing admission decisions and complete HTTP responses across Node and Bun. Do we have a high-confidence way to reproduce the issue? Yes: the focused regression sends an ordinary request followed by an upgrade on a reused connection under Bun. Main's immediate destruction establishes the source-level failure mechanism; this review did not execute it. Is this the best way to solve the issue? Yes: moving closure into the response-completion callback repairs the owning transport boundary without adding configuration, changing authorization, or duplicating routing. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against abd18df28d85. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
7382128 to
06ce847
Compare
06ce847 to
d86c67d
Compare
* commit '047587a542ce205ee78354fbd88ba8ec05c07844': (45 commits) chore(ui): refresh control ui locales (#139481) fix(slack): keep prototype-named emoji shortcodes intact (#136374) fix(gateway): deliver upgrade rejection responses under Bun (#139516) refactor(test): simplify catalog guards and fix native report fixture (#139496) fix(macos): prevent dashboard fixture loopback timeouts (#139556) fix(matrix): preserve selected reply targets inside threads (#139479) test(gateway): preserve held-work close failures (#139593) refactor(exec): share package argument scanning (#139560) fix(audit): preserve sequence range validation before numeric decoding (#139587) fix(transcripts): retain capture ownership through failed cleanup (#139572) refactor(models): share selector reference traversal (#139571) perf(agents): classify allowlists without intermediate sets (#138392) chore(release): update appcast for 2026.9.2 (#139575) fix(ci): synchronize cloud retries and board widget input (#139506) fix(plugins): explain SDK incompatibilities after core updates (#139458) fix(voice-call): retain installed WebSocket behavior under Bun (#139567) test(text): consolidate literal sanitizer cases (#139579) test(gateway): observe native drain without a lint exception (#139576) test(memory): consolidate visibility fixtures without policy defaults (#139569) fix(ui): show shimmer skeletons while loading Control UI (#139525) ...
|
Merged via squash.
|
* origin/main: fix(cli): keep note text with Windows and Unicode line endings (#139512) fix(agents): keep isolated completion context on its admitted generation (#139607) fix: avoid declaration builds during source-server updates (#139392) fix(models): keep discovered models after catalog refresh failures (#139357) fix(gateway): record a transcript notice when a run fails before replying (#139439) refactor(ios): reuse shared integer conversion (#139581) fix(sessions): prevent database lock failures during reclamation (#139469) perf(test): reuse transforms within owned scheduler slots (#139553) test(agents): share sparse transcript input fixtures (#139589) chore(ui): refresh control ui locales (#139481) fix(slack): keep prototype-named emoji shortcodes intact (#136374) fix(gateway): deliver upgrade rejection responses under Bun (#139516) refactor(test): simplify catalog guards and fix native report fixture (#139496) fix(macos): prevent dashboard fixture loopback timeouts (#139556) fix(matrix): preserve selected reply targets inside threads (#139479)
* commit 'refs/openclaw/tasks/pr-135167-main': (2467 commits) refactor(ios): reuse shared integer conversion (#139581) fix(sessions): prevent database lock failures during reclamation (#139469) perf(test): reuse transforms within owned scheduler slots (#139553) test(agents): share sparse transcript input fixtures (#139589) chore(ui): refresh control ui locales (#139481) fix(slack): keep prototype-named emoji shortcodes intact (#136374) fix(gateway): deliver upgrade rejection responses under Bun (#139516) refactor(test): simplify catalog guards and fix native report fixture (#139496) fix(macos): prevent dashboard fixture loopback timeouts (#139556) fix(matrix): preserve selected reply targets inside threads (#139479) test(gateway): preserve held-work close failures (#139593) refactor(exec): share package argument scanning (#139560) fix(audit): preserve sequence range validation before numeric decoding (#139587) fix(transcripts): retain capture ownership through failed cleanup (#139572) refactor(models): share selector reference traversal (#139571) perf(agents): classify allowlists without intermediate sets (#138392) chore(release): update appcast for 2026.9.2 (#139575) fix(ci): synchronize cloud retries and board widget input (#139506) fix(plugins): explain SDK incompatibilities after core updates (#139458) fix(voice-call): retain installed WebSocket behavior under Bun (#139567) ...
…#139516) * fix(gateway): flush upgrade rejections before closing sockets * test(gateway): model rejection flush and bound upgrade fixtures
What Problem This Solves
Fixes an issue where Gateway clients could receive a connection reset instead of the HTTP rejection response when attempting a WebSocket upgrade on a reused connection under Bun.
Why This Change Was Made
Upgrade rejection helpers now own shutdown: they end the response and destroy the socket only after its buffered bytes finish writing. Existing admission decisions, status codes, headers, and response bodies stay intact. The background completion timeout assertion also checks the standard TimeoutError identity instead of runtime-specific wording.
User Impact
Clients receive the intended rejection and explanation when WebSocket admission is unavailable or authentication fails.
Evidence