Repository navigation
feat(task): restart silent runners under the doubling strategy - #191
Draft
greenhat616 wants to merge 1 commit into
Draft
greenhat616 wants to merge 1 commit into
greenhat616 wants to merge 1 commit into
Conversation
This was referenced Nov 8, 2026
greenhat616
force-pushed
the
feat/hardening-29-silent-restart
branch
from
November 13, 2026 07:44
823497c to
3f2a39b
Compare
greenhat616
marked this pull request as draft
November 13, 2026 08:55
Under Doubling, the download loop now stops a running runner that has read no body for 4.5 s, has at least twice the minimum chunk size left and has no frames queued in its data channel. It does not wait for full slow-restart windows or three runners. The runner is stopped as Slow, with the same budget rules as a slow stop: a restart if it delivered data, a charged attempt if not. The slow and the silent path share a tick, and at most one runner is stopped per tick. Legacy is unchanged. Silence is measured from the runner's own reads. The runner and the loop share a ReadActivity. The runner stamps it on every non-empty item and when it resumes reading after a push, and marks itself as emitting while it waits on the data channel; the stamp and the flag change under one lock. Accepted frames and writer recovery no longer count as activity, so a full writer cannot push a stall back. The hedge's own silence clock is unchanged. Check 5 of the growth gate no longer waits on a runner that has been silent for hedge_idle. A tick with such a runner judges no doubling: a doubling that reached the limit stays held, one below the limit is dropped and growth goes on. A slow or silent restart drops the pending doubling, at the limit too, by the maintainer's decision, so the restarted range can be split again.
greenhat616
force-pushed
the
feat/hardening-29-silent-restart
branch
from
November 13, 2026 22:25
3f2a39b to
ed815b5
Compare
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.
C29 (T29, PR-7d) of the download strategy hardening stack. It is stacked on #189, the doubling cap, and that branch is its base. The design notes are in §14.19.
Why
T14 (#188, §14.17) found that
Doublingwaited out the 30 s idle timeout when a runner stalled with plenty of work left (s4b, s4c, about 38 s), and that a stalled runner froze growth through check 5. T13's slow path needs three full windows and three runners, so it never fires in these shapes.The maintainer decided on 2026-11-08 to add a restart path for silent runners, and later that a slow or silent restart releases a doubling held at the cap (C28).
What
Read activity (
runner/mod.rs,run_loop/stream.rs)ReadActivityis shared by the runner and the loop: the last readInstantand an "emitting" flag, behind one mutex.resume_reading(at)stamps the read and clears emitting under one lock. Terminal pushes only clear emitting.RunnerManager::silent_sinceis the runner's last read, or its spawn, ornowwhile it is emitting.last_delivery(§9.6) is unchanged.Silent path (
download_loop/restart.rs),DoublingonlyA runner is stopped as
Slowwhen all of these hold:may_restart, unchanged from C12).2 × min_chunk_sizeleft, so it never competes with the endgame hedge.SILENT_RESTART_AFTER), and it was already running at a sample 4.5 s ago.The longest-silent runner goes first, the lower ID on a tie. At most one runner is stopped per tick, and the slow path goes first. The stop is charged like a slow stop: a restart if it delivered data, a charged attempt if not.
Growth (
throughput.rs,doubling_strategy.rs)hedge_idle(2 s) by the same signal, unless the writer is full or it has queued frames.StrategyControl::on_restartedis called by the slow and the silent path after a stop.Doublingdrops the pending doubling unjudged, at the limit too. This narrows C28's third known limitation.Results
10 runs each, alternating. Median / p90 in seconds,
Doubling. Full table in §14.19.unmatchedis 0 everywhere.Known limitations (§14.19)
2 × min_chunk_sizeleft is still left to the hedge.Dependencies
PR-7b, which switches the default to
Doubling, depends on PR-7, on #189 (C28) and on this PR.Tests
test_read_activity_follows_the_body;test_a_resumed_runner_is_never_seen_silent, which checks every published state across the emit-to-read transition.download_loop/tests/silent.rs, explicit time). Covers:2 × min_chunk_sizeboundary;growth.rscovers a small stalled chunk that no longer freezes growth. The T13 tests inrestart.rsare adapted to the read signal.doubling_strategy.rs,throughput.rsandrunner_manager.rs, including ID reuse.tests/silent_restart.rs, a smoke test on a real download. The stalled range is requested again well before the 30 s idle timeout, and the file is correct.on_restartedremoved on each path separately;may_restartconditions.Review
Reviewed with
/ccg:review, using the codex backend only (a single-model review).Round 1 (71). A reference rate killed healthy slow runners, the evidence expired, and growth froze below the cap. Replaced by a read-activity signal; a silent tick drops a doubling below the cap.
Round 2 (85). Backpressure from the data channel was seen as silence. Fixed with the queued-frames guard.
Round 3 (89). The guard in
may_restartbroke C12's median. It moved to the silent path and check 5.Between rounds 3 and 4, the loop's side-effect reconstruction of liveness was replaced by the runner-owned
ReadActivity. A writer-recovery reset was found to delay stops in s4b and s4c, and accepted frames and writer recovery no longer count.Round 4 (90). One Major: clearing emitting and stamping the read ran under separate locks, so a tick could see a healthy runner as silent. Fixed with the atomic
resume_readingand a deterministic regression.Round 5: PASS (98/100).
tasks.md, is fixed.Checks
All on
+nightly-2026-11-06. Clippy allowsunnecessary_lazy_evaluationsuntil #183 merges.cargo fmt --all -- --check.-D warnings.cargo test --workspace --all-features --locked: lib 573, integration tests pass.cargo test --workspace --locked: lib 542, integration tests pass.RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features -p bolt-load: the same 19 errors as its base.