Repository navigation
Description
Summary
FillRegistry::claim (crates/cache/src/fill_session.rs:1144-1241) returns Attach whenever the requested range is fully covered by a live session's covered — and an Owner that claimed the whole blob covers everything. Once bounded and resumed requests route through the two-leg spine (#2060 option B), a request at offset X inside a live whole-blob fill attaches as an observer.
The attached serve leg publishes its paid frontier with FillSession::extend_served_from(fetch_start, served) (fill_session.rs:597-601), which only raises the shared served_paid once the owner's paid prefix has reached fetch_start. That guard is correct — it stops an observer from lifting the frontier past bytes nobody paid for — but it means the pull leg is paced by the owner's payments alone until the owner reaches X.
Failure
Owner (whole-blob client) stops paying or disconnects while another observer holds a lease, so the session is not last-out and the pull is not cancelled:
served_paidfreezes at the owner's last frontier< X.- The pull leg's
WindowPacer(crates/client-pull/src/pacer.rs:264-313) reachespulled − served_paid == windowandWaits. - The observer's serve leg parks on data at
X(serve_encoder.rsAwaitingDataReader::read_at). Itsserve_demandis far pastpulled_frontier(> CHUNK_GROUP_BYTES), so the demand override does not fire. - Nothing moves until the observer's client trips its own
--stall-timeout-msand disconnects; that last-out teardown then cancels the pull.
The observer is a paying client that is refused service for the length of its stall budget because a different client stopped paying. Before B this request went to the buffered range tier and got an independent origin fetch.
Proposed fix
In claim, treat a request whose fetch_start lies beyond best.served_paid() + credit_max (the furthest the live pull can reach on the owner's current payments) as Owner of its own span rather than Attach — the registry already has the Mixed shape for a partial overlap, so this is a routing decision inside the existing lock, not a new mechanism. The overlap byte is then fetched at most twice (once per owner), bounded by credit_max, instead of never.
Alternative: on a non-last-out teardown, if the leaving lease was the session's owner (its served_start), promote the remaining observer with the lowest fetch_start by resetting served_paid to that observer's frontier. Smaller blast radius but changes frontier semantics mid-fill.
Surfaced while planning #2060 option B; the plan's Task 4 keeps the extend_served_from guard as-is and records this as the known residual.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
fix(cache): a request ahead of a live fill's paid frontier owns its o…
yigitdot commentedon Sep 19, 2026
Landed in #2064 (commit
d28bae33):FillRegistry::claimtreats a live session as an attach candidate only when the request starts at or behind that session's paid frontier; otherwise the request owns its own span. It turned out not to be a follow-up — the anvil journeybundle_pull_reuses_unchanged_and_splices_changedhit it on every cold spliced tail once bounded requests routed through the spine.🤖 Generated with Claude Code
yigitdot commentedon Sep 19, 2026
The #2064 review surfaced two residuals of this fix, both addressed on that branch: the refused attach is now observable (
decdn_cache_fill_not_coalesced_total+ a debug line at the skip site) andclaim's doc states the frontier precondition. The duplicate-egress economics question (a request ahead of a paying-but-lagging owner's frontier opens an overlapping pull) is tracked in #2069 §4; the attach arm now has end-to-end coverage (mid_blob_open_behind_a_paying_owners_frontier_attaches).🤖 Generated with Claude Code
feat(cache): count and log a fill claim not coalesced ahead of the pa…
test(node): close the review's spine coverage gaps
test(node): wait for the owner's first voucher before the mid-blob at…