Repository navigation
Description
The reactive half of the two-tier buyer deposit (ADR 003 § Two-tier deposit) now covers two of the three paid fetch paths:
| Path | Proactive low-water refill | Reactive mid-transfer top-up |
|---|---|---|
decdn fetch (streaming) |
yes | yes (#1497) |
| daemon node-to-node cache-miss pull | yes | yes (#1530) |
decdn bundle pull |
yes | no |
Why it is missing
bundle_pull.rs:683 fetches through the buffered fetch::fetch_blob, which — like the daemon's leg before #1530 — has no paid-frontier resume, so answering a genuine InsufficientDeposit would mean re-downloading and re-paying for the delivered prefix. It gets the proactive refill only, via open_or_reuse (bundle_pull.rs:625-638).
What it needs
The same conversion #1530 did for the node, with the CLI's own machinery rather than the node's:
- Route the per-blob fetch through the streaming path (
fetch_blob_streaming) instead of the bufferedfetch_blob, so it already hasopen_progressive_pull+content_paid_frontier+genuine_exhaustion+ theMAX_TOPUP_ATTEMPTSbudget. - Thread
working_deposit, the funder gate (top_up_decision— a bundle pull CAN be a publisher-pays delegate, unlike the node, so this one is load-bearing), and the.partialfile handling per blob.
Urgency
Low. A bundle is many small-to-medium blobs sharing one channel, so the proactive refill on reuse covers the common case; the gap is a SINGLE blob in the bundle larger than the remaining deposit.
Prior art: #1530 (crates/node/src/node_origin/resume.rs) and #1497 (crates/cli/src/commands/fetch.rs, the fetch_blob_streaming loop).
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
alpergundogdu commentedon Aug 5, 2026
Resolve via a shared
client-pulldriver, not a third copyFlagging a coupling before anyone picks this up: the reactive top-up / resume-at-paid-frontier control loop is currently written twice — inline in
crates/cli/src/commands/fetch.rs(#1497) and re-derived incrates/node/src/node_origin/resume.rs(#1530). They share only the leaf primitives inclient-pull(content_paid_frontier,genuine_exhaustion,resumable_watermark, the budget constants); the orchestration loop, leg anchoring, top-up/settle-wait/reseed arms are hand-parallel in both.Doing this issue the naive way ("what #1530 did, a third time") lands a third copy of that loop, because neither existing one is reusable from the CLI:
node_origin::resume::pull_blobispub(super)and bound toNodeOriginDeps, andfetch_blob_streamingis private +.partial-file-shaped.Interaction with #1608. #1608 relocates the node leg into a
PeerSource(BlobSourceseam) and — per its own text — moves the reactive top-up inside it, swapping the sink to the #1607 range-awareadmitpath. That's node-only, though: #1607/#1608 don't touch either CLI leg, so this gap does not close as a byproduct of that work.Suggested sequencing:
admitfoundation).PeerSourceon a sharedclient-pulldriver (Sink+Fundertrait + budgets) rather than hand-relocating the resume loop.If the driver seam is too much scope for #1608, defer this until #1608 is in — but do not hand-write the PeerSource loop, or the shared extraction gets more expensive and this issue pulls toward a third copy.
The pure
decide()/ResumeAction/ResumeBudgetscore already inresume.rsis the extractable seam; the only per-site differences are the sink (disk.partialvsVecvsadmit), the funder (CLItop_upvs nodedeps.buyer.top_up_channel), and budgets — all parameterizable.alpergundogdu commentedon Aug 13, 2026
Resolved.
bundle pullwas routed through the samefetch::drive_fetchgap-driven coredecdn fetchuses (#1633), whose reactive top-up arm (funder.top_up, bounded bymax_topups—crates/client-pull/src/driver.rs:452) fires withworking_depositwired in viaopen_or_reuse. Seecrates/cli/src/commands/bundle_pull.rs:604("bundle pull gets reactive top-up too"). Closing as done.