Repository navigation
fix(moq-net): a finished track a read holds outlives its linger, and the failover and resume models mirror the code - #9048
Conversation
Quest-Claim: 2f864b501ccbbd15
…the failover and resume models mirror the code The front's driver forgot a finished track once its linger ran out even while a fetch or group read still held it, since a closed track counted as unread and `abort_unwanted` reports a closed track gone. A held read then could no longer move off a dying route. A finished track whose reads move with the front is now read while anything holds it. FailoverChain.tla models the linger (`Forget`), where a finished track's fetch goes first (`Route::answering`), and that it keeps the copy it ended on; the pre-fix linger broke NoSkipWhileHeld in Mesh. ResumeReader.tla's comments name the current code. Both skills' sync commits move forward. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/failover-models-sync # Conflicts: # .claude/skills/verify-failover/SKILL.md
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 8 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Maintainer pick: (Written by Claude Opus 5.5 with high) |
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound — the front now decides whether a track is read from the consumer count rather than the open-channel demand level, so a finished track's resume producer survives its linger while a fetch or group read still holds it, and both TLA+ models are moved to match the code they cover.
Reviewed changes
The whole 12-file diff was read end to end, with the driver, resume, kio, and model sides cross-checked against each other.
- The linger —
TrackIo::readtreats a finished track whose reads still move as read while any consumer holds it; the demand edge polls the holder count in that case, andAction::Forgetkeeps the track and re-feedsWantedso the linger re-arms once the holder leaves. The newa_held_finished_track_outlives_its_lingerpins both halves and genuinely fails onmain. - kio — additive
ProducerWeak::poll_held_changedcounts consumers past closure, withheld_changed_outlives_the_closecovering the drain and the wake. The extraction leavespoll_wanted_changedunchanged. - Failover chain model —
Forget/Reads,Answering, theLetGoguard on the copy the track ended on, reader-onlyDemand, andSubscribewaiting for a reader all line up withRoute::answering,Recover::poll_fetch, andPhase::Finished. The addedlastfield is maintained at every record construction. - Resume model and skills —
ResumeReader.tlais comment-only and the renamed symbols exist; the Coverage rows validate, and the sync commits are ancestors ofmainwith no covered-file commits after them.
ℹ️ Validation is the author's report, not a local run
Cargo and TLC cannot run in this environment, so this review is static: the model and test results above are as reported in the PR. The static checks that did run are listed below.
Technical details
# What was checked without running the suite
## Verified
- `python3 sh/coverage-tables.py` passes with the new Coverage rows.
- `61f8956839` and `74e05ddc70` are ancestors of `origin/main`, and `git log <sync>..origin/main --` over each skill's covered files is empty.
- `Route::answering` picks `Phase::Finished.last` while that copy has not failed and the serving copy otherwise, matching `Answering`.
- `Recover::poll_fetch` fetches from `route.copy` (the `short` arm) while `Fetching` goes through `answering()` (the `missing` arm).
- `Copy::bound` and `Copy::send` do not `reopen()`; `Reader::sync` reads `Phase::Finished.last`; `Action::Reroute` already guards `is_held()`.
- `TrackWeak::abort_unwanted` has exactly one caller, the `Forget` arm this PR fixes.
- No lost wakeup in the new edge: `Action::Conclude` wakes `io.ready` and a close wakes the consumer waiter list, so every moving-to-non-moving phase change still reaches `Unwanted`.
- A relay's `Forget` drops `routes` and the retained copy, so the held-handle pin chain unwinds with the client.
- `js/net` has no linger/`Forget` driver, so no JS counterpart is owed.
## Environment
- `cargo` cannot build here: the pinned `1.98.1` toolchain install fails with a `clippy-preview` conflict, and TLC needs nix.deepseek-v4.1-flash | 𝕏

Problem
Quest failover-models-sync (from the 2026-11-17 pre-cut audit) found three problems:
verify-failoverandverify-resumestill named their old sync commits, though about 60 commits had touched the covered code since.FailoverChain.tladid not model the linger.TrackWeak::is_wanted), andTrackWeak::abort_unwantedreports a closed track as gone. Once the track was forgotten, its resume producer concluded, so a held read whose upstream route then died failed instead of moving to another route.Approach
Forgetplus a guided search overMesh.cfg(a state constraint that prunes only states off the path). It brokeNoSkipWhileHeldin 32 steps:Efails over toB, which serves throughA.Efetches group 0 fromB, andBfetches it fromA.B's linger runs out whileE's fetch still holds the track.Adies, andBcan no longer move the fetch toO.Estill has a route.a_held_finished_track_outlives_its_linger(model/origin.rs) fails onmain: no replacement route is asked for the held finished track after the linger.model/origin.rs):resume::Producer::moves) counts as read while anything holds it (TrackIo::read).Forgetarm keeps a track that is still read.a_track_ending_while_read_lets_its_front_retirepins that.ProducerWeak::poll_held_changedispoll_wanted_changedthat keeps counting consumers after the channel closes.Forgetlets a relay's finished track go only once no downstream copy reads it (Reads).Answering,Route::answering).LetGo,Phase::Finished).Demandcounts only open downstream subscriptions, andSubscribewaits for a reader.Phase::Finishedinstead of the removedRoute::finished,Copy::bound,latest_key).Decisions
Each can be undone in review:
rs/AGENTS.md, a parked clone keeping something alive is the holder's bug.Guideoperator in the model.Mesh.cfgstays sampled, as fix(moq-net): a relay whose track ended moves a fetch off a dying route #8896 settled.61f8956839(newestmaincommit touching its files) plus this PR, which mirrors its own change.74e05ddc70. This PR'strack.rschange is outside the resume model.Validation
FailoverChain.cfg: pass, 2,588,648 distinct states (2.0M before), 55 s.Leave.cfg: pass, 2,831,737 distinct states, 66 s.Mesh.cfg, 200k-trace sample at depth 100: pass, 80M states, 7 min.Mesh.cfg:NoSkipWhileHeldviolated at depth 32.ResumeReader.cfg: pass, 14,334,670 distinct states.ThreeRoutes.cfg: pass, 7,053,230.a_held_finished_track_outlives_its_lingerfails onmain(the front rerouted the held track: Elapsed) and passes here.held_changed_outlives_the_close(kio).just rs test -p moq-net -p kio --all-features: 4304 passed.just check: pass.failover_chain.rsrelay chain, a relay's track parks rather than finishes, because downstream readers leave before the copy closes. The origin test and the model cover the path instead.Impact
ProducerWeak::poll_held_changed(additive). moq-net: none; everything changed is crate-private.Caused by
Forgetdropping a closed track whatever held it (found by the pre-cut audit).Follow-ups
None.
Models
Size: M
Implementer: Claude Code, claude-opus-5-5 (arm B)
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)
Review
Rewritten by
quest reviewafter each round.Head: 19af1ad
Base: origin/main at d8ec56d
Risk: high,
The branch adds a public kio polling API that downstream libraries can depend on, so reverting after adoption could require coordinated changes in those libraries.Classified: medium by default
Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a1eca5-53b2-7601-ad5d-5810cb20b352, round 2Score: 8/10,
No actionable defects were found in the incremental changes or merge resolution, while builds, tests, and model checks remain unverified as instructed.Raised the risk to high:
The branch adds a public kio polling API that downstream libraries can depend on, so reverting after adoption could require coordinated changes in those libraries.Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none