Repository navigation
fix(platform): keep a lane's error and fail its leaked SSE tails - #5124
Closed
tale-code-bot wants to merge 3 commits into
Closed
tale-code-bot wants to merge 3 commits into
tale-code-bot wants to merge 3 commits into
Conversation
checkBellHintWire cleaned up in nested `finally` blocks. A `finally` that throws replaces the error in flight, so a lane that failed and whose tail then would not close (or whose DELETE failed) truncated the run under the cleanup's error, and the lane's own failure was lost. Its Promise.all over the two closes also dropped the second close's error. withCleanup(steps, body) runs every step in order, on every path. When the body threw, its error propagates and each cleanup failure is logged, naming its step; when the body passed, the first cleanup failure fails the lane, named the same way. The bell-wire lane uses it with three steps. Refs #4152
Since #4133 the harness's teardown closes the backend the way a deployment does: it ends every live SSE stream, logs `ended N open SSE stream(s)`, and the run exits 0. A lane that leaked a tail on its passing path, which used to hang the run, now went unnoticed. recordOpenStreams counts the backend's live streams (liveStreamCount, the size of the registry the shutdown drains) after every lane that completed, and once before the lanes for the checks that open tails of their own. It gives a closing stream a few seconds to leave the registry; whatever is still open is recorded as `harness: <lane> leaves no SSE stream open` and ended, so the next lane starts with none. With no stream open it records nothing: a clean run's tally and exit code are unchanged. A truncated run already fails and gets no such check. Refs #4152
The test proves the harness's outbound boundary ends a streamed response on abort after a garbage collection, with native fetch as its control. The Unit job runs whatever Node its image brings, and an undici without the fix for nodejs/undici#4627 loses that abort in fetch itself: the control then failed the test deterministically, and said nothing about the boundary. The control now runs first. When fetch itself loses the abort, the test is skipped with a note naming the Node and undici versions; otherwise the routed assertion runs as before. The Unit job's Node stays unpinned: that would be a workflow change, a maintainer's call. Refs #4152
Contributor
|
The autonomous cycle now lands each task through the merge train instead of its own pull request ( |
yannickmonney
deleted the
fix/itest-cleanup-errors-and-leaked-sse-tails
branch
October 30, 2026 10:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4152. Board task: TALE-65.
This fixes the three LOW follow-ups from the independent review of #4133, one commit each. The INFO item (the chat-stream readers abort without awaiting) is unchanged. They do abort on their passing path, so the new per-lane check covers them.
LOW 1: a cleanup error no longer hides the lane's error
checkBellHintWirecleaned up in nestedfinallyblocks.finallythat throws replaces the error in flight. A lane that failed, and whose tail then would not close (or whose DELETE failed), truncated the run asRUN TRUNCATED … threw <the cleanup's error>. The lane's own failure was lost.Promise.allover the two closes also dropped the second close's error.The fix is
withCleanup(steps, body)inintegration-lane-helpers.ts. It takes theTeardownStepshape thatsettleTeardownalready uses.[itest]warning that names its step.the cleanup step that <what> failed: …), and the others are warned.LOW 2: a lane that leaves an SSE stream open fails, and the check names the lane
Since #4133 the teardown's graceful close ends a leaked tail and logs
ended N open SSE stream(s), and the run still exits 0.realtime/sse.tsexposesliveStreamCount(). It returns the size of the registry the shutdown drains, which holds both/eventsand the chat progress streams.recordOpenStreams(subject, record)runs in two places:runLanes, after every lane that completed, next to the env, boundary and membership checks;checkAuthAndSseopens tails of its own and a leak there would otherwise be charged to the first lane.harness: <lane> leaves no SSE stream open, and then ended. The next lane starts with none, and teardown has nothing left to end silently.LOW 3: the GC test's control is handled in code; Node is not pinned
Choice: the code-only option. I did not pin Node in the Unit job. That would be a workflow change, which is a maintainer's call, and triage on TALE-65 said the same.
fetchcontrol first.ctx.skip) with a note that names the Node and undici versions, instead of failing for a reason unrelated to the boundary.Tested
All runs were local, with the credential removed, on the tree of
99594c3f273f119a413cb7553439506c55f0798b.Tests
bunx vitest --run --project server backend/integration-lane-helpers.test.ts backend/integration-vendor-stub.test.ts: 46 passed. That is 41 before this change plus 5 new.tests/guards/integration-{scope,skips}.guard.test.ts), the touched tests,http-shutdownandrealtime/*: 10 files, 102 tests passed.Each new test fails without its fix. Each mutation was applied, run, then reverted:
finallysemanticswithCleanuptest fails.expected 'still open 2 s after the abort' to be 'AbortError').Static checks
oxfmt --checkandoxlint --type-awareon the touched files: clean.tsc --noEmiton the platform, under CI'sNODE_OPTIONS=--max-old-space-size=6144: 0 errors.bun run knip:check: exit 0, with no finding for the new exports.bun run lint:links: clean.Not tested here
bun run backend:integration). It needs Postgres withpg_searchandvector, and an object store. This PR's own Backend integration check runs it. That run is what proves no lane onmaintrips the new per-lane check. The lastmainintegration log I read (merge-group run 40836489004 at9be5cad) showed noended N open SSE stream(s)at teardown.lint-stagedskips it when uncached. CI runs it.