Repository navigation
test(tlon): stop transport fixture rejecting on expected socket resets - #192588
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. What this changesThis PR makes the Tlon HTTP fixture wait for socket closure without rejecting on expected peer resets and awaits closure in streaming tests. Example: The scry test streams 18 MiB while the client enforces its 16 MiB JSON limit.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open for landing: it makes a focused fixture repair, preserves transport coverage, and has a green exact-head CI gate; no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe test fixture serves oversized HTTP responses to the real Tlon transport; client cancellation closes the connection, which the fixture records before test completion. flowchart LR
A[Transport tests] --> B[Local HTTP fixture]
B --> C[Tlon transport client]
C --> D[Bounded response reader]
D --> E[Body cancellation and release]
E --> F[Socket close observation]
Technical reviewBest possible solution: Land the existing fixture-local repair while preserving production cancellation and the retained transport assertions. Do we have a high-confidence way to reproduce the issue? Source and Node's documented event contract establish the rejection path when a socket errors before closing; this read-only review ran no tests, and the full load-dependent failure was not reproduced locally by the author. Is this the best way to solve the issue? The patch repairs the promise-producing fixture directly and adds meaningful closure assertions without retries, weaker size limits, or production changes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 15e38612b4be. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceTests +9. Total +9 across 1 file. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
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 Reviewed November 4, 2026, 1:33 AM ET / 06:33 UTC. |
Keep distinct route, ordering, trigger, publication, custody, and fixture-lifecycle contracts from openclaw#192769, openclaw#192540, openclaw#192250, openclaw#192812, openclaw#191643, openclaw#192584, openclaw#192588, and openclaw#192083. Raise only the scalar by the exact measured inherited deficit; production and test LOC remain unchanged.
Backport 9f088a3 (#192588). Observe socket close without rejecting on bounded-body cancellation and await closure in streaming tests. Preserve error, size and redaction assertions. Hosted regression: plugin shard 131938144549 reports an unhandled ECONNRESET in this fixture. Focused transport suite: 10/10 passed; typed lint, format and diff checks pass. Final exact-candidate hosted qualification is pending. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]> (cherry picked from commit 1be6b63918380893b5b9c8b1f47446257ef52538)
Problem
Plugin prerelease
checks-node-extensions-shard-4failed with a Vitest unhandled rejection,Error: write ECONNRESET(WriteWrap.onWriteComplete), attributed toextensions/tlon/src/urbit/channel-ops.transport.test.ts. All 354 tests passed. The last test before the error was "bounds streaming successful scry responses" (run 41668673112, attempt 2, job 126071690327).The bug is in the test fixture. The product transport is fine.
serve()recorded each non-POST request's socket close withevents.once(request.socket, "close"), andoncerejects if the emitter emitserrorfirst. The streaming tests send 4 to 18 MiB bodies. The product bounds its read, then cancels the body and closes the dispatcher, which is the intended behavior. On Linux, that close sends a TCP RST while the fixture'sstreamBodypipe is still writing. The server socket then emitswrite ECONNRESET. Node's HTTP server handles that socket error by destroying the socket, but the fixture'soncepromise rejects. Neither streaming test awaiteddeps.closed(), so nothing observed the rejection and Vitest reported it as unhandled. The failure depends on timing and platform. macOS did not reproduce it (0 socket errors across 120 amplified iterations).Solution
closelistener that resolves.closealways fires aftererror, so the promise still settles, and an expected peer reset no longer becomes a rejection.deps.closed(). They now assert that the client releases the connection after a bounded read, and no close promise is left unobserved.The product code is unchanged. Nothing in
urbitFetch/channel-opswrites after close. The write that gets reset is the test server's own response stream.Impact
Test-only. Removes a Linux, load-dependent unhandled-error failure that cost a 55-minute shard rerun each time.
Evidence
node:httpserver, undiciAgentclient that reads 16 MiB of an 18 MiB stream then cancels and destroys), in anode:24Linux container, 100 iterations each:once(socket, "close"):socketErrors=34 unhandled=34, eachECONNRESET write. This is the CI signature.socketErrors=40 unhandled=0node:24Linux container (freshpnpm install --frozen-lockfile), 3 parallel vitest processes per round. Fixed: 12 plain runs (10/10) and 6 amplified runs (streaming cases repeated 60x and 20x, 126/126), all with 0 unhandled errors. Gap: base did not reproduce through the real product client in those runs either (12 plain plus 6 amplified, 0 unhandled). The product release path (fetchWithSsrFGuardaborts, cancels, then closes the dispatcher) rarely hits the RST-during-write window on an idle container. The CI shard ran 43 files concurrently. So the red-on-base proof is the mechanism repro above and the CI signature (an unhandled rejectionwrite ECONNRESETfromonWriteComplete, which only the fixture'soncepromise can produce), not a local red run of this file.node scripts/run-vitest.mjs run extensions/tlon/src/urbit/channel-ops.transport.test.tsgives 10/10 passed.oxfmt --checkandoxlinton the file are clean.Fixes #192567