Repository navigation
Description
Problem
The node has a detached background cache-fill (#859, #1254): on a serve-miss where the foreground pull misses its deadline or can't open, the node sends the requesting client a refusal and then tokio::spawns a warm that re-pulls the blob from offset 0 — either from a peer (paid, USDC) or from the operator's own backend (unpaid, backend egress).
Both variants ingest with no client waiting on the bytes and nobody paying for the result. They are speculative bets on a future request.
The paid variant is an economic attack surface — unpaid egress forces paid ingress:
- A client requests a rare/large blob the node lacks.
- Node misses; foreground pull times out / can't open; node returns a refusal (no revenue).
- Node then pays an upstream peer from offset 0 to warm that blob.
- Cheaply repeatable. The requester never pays; the node keeps spending USDC on blobs nobody ends up wanting → payment-channel deposit drain.
Re-pulling from zero makes each attempt re-pay the full blob. The unpaid (own-backend) variant can't drain USDC but has the same shape: a flood of forced foreground timeouts drives repeated backend egress (S3/R2 egress is not free) for blobs whose client already gave up.
This is not a scale-deferral concern — the economics are wrong at any node count. The core principle: a node should never initiate a from-zero pull off its own back; it should only ingest while a live client is waiting on (and paying for) the bytes.
Decision
Remove both background-warm variants — paid (node→node) and unpaid (own-backend). Keep every foreground, client-waiting fill.
Remove
maybe_spawn_background_fill(crates/node/src/handlers/client/fill.rs:18) + its 3 call sites:window.rs:195,window.rs:204,fill.rs:486.spawn_local_warm+on_local_populate_timeout(fill.rs).- The
BackgroundFillsubsystem inhandlers/client/mod.rs(BackgroundFill,arm_background_fill, the inflight-dedup guard,warm_budget_mb,MAX_BACKGROUND_FILL_MB = 2048,ClientHandlerDeps::background_fill) and itsBackgroundFill::newwiring inruntime/mod.rs. - The
node_pull_through_background_spawned/_shedmetrics (metrics.rs) and the background-fill notes inselection.rs/node_origin/mod.rs. - The associated background-warm config knob(s), per pre-launch policy (delete the shape, no deprecation shim).
Keep (client-waiting, unchanged)
- The serve-miss tee (
window.rs:181,open_progressive_pull) — client streaming while the store ingests. - Foreground buffered
populate/populate_localbounded by the pull-through deadline (fill.rs:174,fill.rs:229).
Resulting invariant
A node only ingests while a live client is waiting on the bytes. It never initiates a from-zero paid pull speculatively.
cache-admitnever occurs without a consumer sink alongside it.
Non-impact
- Advertising is independent. The node announces its own origin content from a HEAD/stat metadata index (
rescan_originsbuildsorigin_held), not from warmed bytes — so dropping the warm does not change what the node advertises or serves. Un-cached assigned blobs are still pulled on the next real request (foreground, client paying). - No change to serve/export, DHT routing, or the namespace/origin-role model.
Relationship to the ingest refactor
Recorded in specs/2026-08-05-unify-blob-source-ingest-design.md. Removing this collapses the client-less {cache}-only sink combination out of the source/sink model entirely, so the refactored PeerSource never has to support a paid pull with no consumer sink. It also removes a consumer of MAX_BACKGROUND_FILL_MB (sized against max_blob_size_mb), simplifying the max_blob_size_mb removal in the ingest-unification work.
Severity
Bounded today by warm-slot count + per-hash dedup, so it is rate-limited rather than unbounded — but it is a genuine fund-loss / cost-amplification surface that triggers automatically and silently. Worth closing before launch.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
refactor(node): remove client-less background cache-warm (#1610) (#1611)
feat(node): multi-observer coalescing for the serve-miss (B3, #1656) (#…
perf(node): last-out serve-miss observer joins the pull, freeing a fi…