Repository navigation
fix(net): a JS group a copy's abort left buffered reads on past a later short close - #9451
Conversation
Quest-Claim: 1b92bfb029b6a9a8
…er short close A track abort released every failed group still buffered for a subscriber. That release only marked the reader handle released: the group's state had already failed. A front then took the group, attached its recovery, and continued it from another route, but `#continues` refused to read past that route's short close once it failed too, so the group ended early. Leave the buffered groups to their subscribers. Pins the JS resume sweep's seed-10 case in `regressions` and finishes quest/m0/nightly/js-resume-fetched-short-close.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. It removes the release that caused the bug rather than clearing #released again later, which would let a released handle come back to life.
Reviewed changes: I reviewed the full diff and the group.ts release and continuation paths the change relies on.
Producer.#closeno longer releases sink-buffered groups: The removed loop only ran when the group's state already held anError. In that case#releasejust set#released.#failneeds a#recover, which is attached only at hand-out.#abandonhas no attempt to cancel.state.closed.setchanges nothing.groupReleasedwaiters are added only after hand-out. Dropping the loop therefore changes only#continues: it no longer refuses to read on past a short close once a front adopts the group.- Partial frames stay safe without the flag:
group.ts#endsettles the cut frame (cut?.done.set(outcome)), so#joingets an outcome instead of waiting on the#releasedexit. - Regression case added: I checked locally that the new
regressionsentry fails onmain'strack.tswithcase 47: reader 1: group 7 ended after 1 frames where a failed route closed itand passes on this branch.track.test.ts,resume.test.tsandgroup.test.tsalso pass (547 tests).
claude-opus-5-5 | 𝕏
|
quest land watch: the merge queue removed this pull request at 9003778 because it conflicts with The land fixer works on it in the background, and the watcher re-enqueues it at the back of the queue once it is fixed or judged flaky, or hands it back here with what it needs. (written by quest land watch) |
|
quest land watch: armed auto-merge on this pull request at ee5debc, so it joins the back of the merge queue once its required checks pass, with the land fixer's fix ( (written by quest land watch) |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: The only commit since the last review merges main. It changes nothing in js/net.
- Kept the quest file deletion during the merge:
mainhad edited the## Relatedlink inquest/m0/nightly/js-resume-fetched-short-close.md, and the merge deletes the file anyway. Nothing in the repo still links to the deleted quest. Thetrack.tsfix and theregressionscase are unchanged from the approved head9003778.
claude-opus-5-5 | 𝕏
# Conflicts: # js/net/src/resume.model.test.ts
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: The only commit since the last review merges main. The PR's own changes are the same as the approved version.
- Merged
mainwithout changing the PR's own changes:mainbrought in #9389, which affectsjs/net. It adds ahooks.takingcheck for stale groups to theresume.tsdrain walk, andSubscribernow marks a group that is stale at the bound as handed out. Neither change involves releasing groups, so the fix that removes the release fromProducer.#closestill applies. I ranbun test src/resume.model.test.ts -t regressionsat97563d7and it passes.
claude-opus-5-5 | 𝕏

Finishes quest/m0/nightly/js-resume-fetched-short-close.md and deletes it.
The JS resume sweep failed at
MOQ_RESUME_SEED=10(reader 1: group 7 ended after 1 frames where a failed route closed it), which Rust passes. moq-dev/moq#9450 does not fix it: its body confirms seed 10 still fails onmainat1fd8509de7, and I reproduced that here.Root cause
The quest's hypothesis was that nothing asks
Recover.wantsagain after the fetched copy's short close. That turned out not to be the cause. Traced with debug prints on the shrunk case:down 0/0).track.tsProducer.#closethen released every buffered sink group whose state had failed (hooks.releaseGroupReader(group, abort)). That release had no other effect: the group's state already held the abort. It only set the consumer's#releasedflag.#released, so it fetches the rest from slot 2 and adopts it.group.ts#continuesbails on#releasedbefore ever askingRecover.wants, so the read ends at the close instead of reading on from slot 1.Changes
js/net/src/track.ts: a track abort no longer releases groups still buffered for its subscribers. An unfinished one already ended with the abort, a finished one stays readable (as moq-dev/moq#9396 already made it), and a front that takes either continues it from another copy.js/net/src/resume.model.test.ts: the shrunk seed-10 case joinsregressions.Public API: none. Wire: none. Behavior: a plain subscriber is unaffected: it never gets an aborted, unfinished group handed out (
an abort keeps finished groups for a slow reader, then reports itintrack.test.ts), and a group's abort also ends a partial frame (group.tscut?.done.set(outcome)), so no read waits on the missing release. Only a front, which takes groups from a failed copy, sees a difference.Caused by
#continues, whose#releasedcheck refuses to read past a short close for a group that an earlier track abort had released before a front took it (found by check: nightly JS resume sweep, seed 10). moq-dev/moq#9396 narrowed the release to unfinished groups, which fixed only the finished-group half.Decisions
Choices I made without asking, for review:
#releasedwhen a front attaches its recovery. The release did nothing but set the flag, so removing it is the net simpler fix. A reset inhooks.recoverGroupwould let a handle come back to life after its reader released it.resume.test.tsandtrack.test.ts. A plain subscriber getserrorfromtryRecvGroup/tryNextGrouponce its track aborts. A front only takes a failed copy's buffered unfinished group through the model's received-route chain (receiveTrack,dropAnchors,Upstream, cache pool, origin routing), and rebuilding that in a unit test would duplicate the model. Theregressionscase is the deterministic test: it fails onmainwith the quest's exact error and passes here.Validation
bun test src/resume.model.test.ts -t regressionswith the new case andmain'strack.tsfailscase 47: reader 1: group 7 ended after 1 frames where a failed route closed it. The seed-10 sweep at 4096 cases fails after 1486 cases with that error.regressionspasses, andMOQ_RESUME_SEED=10 MOQ_RESUME_CASES=4096passes all 4096 cases.Producer.#closeatdown 0/0with no recovery attached, then gets its recovery at hand-out, adopts the fetched copy, and ends with#continuesreturning false onreleased: true.js/netsuite: 3650 pass.nix develop --command just check: exit 0 (biome, JS build and tests, dead-code, quest, markdown).origin/mainat1fd8509de7: this branch passes all 30.mainfails seed 10 and also seed 26 (reader 0: group 2 ended after 1 frames where a failed route closed it), the same failure class, which this fix covers too.Follow-ups
None.
Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown effort
(Written by Claude Opus 5.5)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: 97563d7
Base: origin/main at a843d23
Risk: medium,
It changes shipped JS code in js/net/src/track.ts so a subscriber's buffered group is no longer released when a producer closes, which could alter read behavior for JS consumers of the net package, but the API and wire format stay the same and a revert fully undoes it, so it is a bug fix (medium), not a break (high).Classified: medium by Claude Code, claude-haiku-5-5, low effort, session
6cb42c77-02b0-4ca3-a3eb-835f5acc0a67Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a2065d-ab08-7253-96ce-76d95ca6e9d9, round 2Score: 9/10,
The merge preserves the previously reviewed fix and regression case with no new actionable findings, but runtime validation remains unverified because builds and tests were not run as instructed.Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none