Repository navigation
Description
Summary
open_fetch_prelude (crates/cli/src/commands/fetch.rs:1944-1980) opens every entry twice: a throwaway (byte_offset=0, byte_len=0) open_progressive_pull whose only purpose is to read the signed StreamResponse.total_bytes (the ranged store is keyed on (root, total_bytes)), then drop(first_pull) — which closes the connection — and then drive opens the real (0, total_bytes) leg.
Once every miss routes through the two-leg spine (#2060 option B), that throwaway open is a full serve-miss on the node: serve_via_backend_origin / serve_via_window_pull_through sign the response, claim_fill, and spawn a pull leg that draws its first PULL_WINDOW_FLOOR (1 MiB + 48 KiB) from origin before the node notices the client is gone (the serve leg only learns of the close on its first write, after frame 1 lands).
Cost per entry
- One
{H}.obao4GET for the dispatch serviceability probe (plus the sizeHEAD), then the same probe again on the real open. - Up to one
PULL_WINDOW_FLOORorigin draw that nobody pays for. In the ordering where the throwaway's teardown lands before the real open'sclaim_fill, that draw is cancelled mid-flight and the real open's fresh owner re-draws the same span — a duplicate origin GET. - In the other ordering the real open attaches to the live fill and nothing is wasted. The bundle pull: cold-miss whole-blob request hits the buffered range tier; CLI 30s stall clock fires on multi-GB files #2060 PR pins both orderings (
throwaway_open_then_real_open_coalesces_onto_the_live_fill,throwaway_open_torn_down_before_real_open_still_servesincrates/node/tests/origin_range_pull.rs); the torn-down variant assertsranged_gets <= 2because of this duplicate.
On the node→node path the same shape costs a real upstream open + header handshake per entry.
Proposed fix (CLI side)
Do not claim on the prelude. Options:
- Reuse the first open as the real leg: open
(0, 0)once, keep theUpstreamPull, create the ranged store from its header, and hand the live pull todriveas the first leg instead of re-opening. The driver already has the resume/gap machinery; the prelude just needs to become leg 1. - Learn
total_byteswithout a stream claim: acdn/probe/v1response already carries the blob size for a holder; for a miss-serving node it does not, so this only removes the prelude on hits.
Option 1 is the real fix. Filed from the #2060 plan (Task 6 note); not in that PR because it changes the CLI's fetch structure rather than the node's routing.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
yigitdot commentedon Sep 19, 2026
Measured while pinning this sequence in
crates/node/tests/origin_range_pull.rs(#2060 PR, teststhrowaway_open_then_real_open_shares_one_multi_draw_fill/throwaway_open_torn_down_before_real_open_still_serves):The real
(0, total)open does not reachclaim_fillwhile the throwaway's draw is in flight. It parks earlier, inserve_audit→ iroh-blobsstatus(hash), which serialises behind the same hash's in-flightimport_bao. With a 3 s origin delay on the throwaway's first draw, the real open's signedStreamResponsearrived after 3.08 s and no second origin probe ran — the 200 KiB blob was already complete, so the real open was served as a cache hit.Consequence for every cold CLI entry today: time-to-first-byte on the real open is delayed by the throwaway's first draw (one
PULL_WINDOW_FLOOR≈ 1 MiB from origin) before the real open even probes. On a multi-draw blob the real open then attaches or owns a fresh session (both pinned); no span is fetched twice in full. Option 1 here (reuse the first open as the real leg) removes the delay and the wasted draw together.🤖 Generated with Claude Code
feat(node): stream bounded and resumed cache-miss requests through th…
fix(cli,client-pull): harden bundle pull failover, dedup complement, …
feat(cli,node): prime the multi-source probe and the node's upstream …