Skip to content

Decision: is FIND_VALUE-driven speculative prefetch still worth building, given reactive pull-through warming + pinning? #822

Closed

Description

@alpergundogdu

Why now

We're at the natural decision point for the prefetch surface. The decision + metering layer of DHT speculative prefetch has landed behind prefetch.enabled = false (#650 / PR #819: PopularityTracker, PrefetchPolicy, config, metrics). #820 is the open follow-up that would wire the actual acquisition (FindValue → probe → pull-through), plus the live OriginAssignment event subscription for the origin gate and the ledger feedback loop. #821 is a third spawned surface (no opt-out symmetry on the reactive path) that only exists because of prefetch's gate.

Before we spend the #820 effort, this issue evaluates whether the FIND_VALUE-driven speculative acquisition path earns its keep against the mechanisms that have shipped or landed since ADR 022 was written, and asks for an explicit keep/defer/drop decision.

Scope: this is only about the speculative-acquisition decision — "pre-pull hash H because FIND_VALUE traffic for H crossed a threshold." It is not about the FIND_VALUE popularity oracle itself (a fine observability signal), STORE-on-commit, the DHT, reactive pull-through, or pinning. Those stay regardless.

What prefetch is (ADR 022 § Prefetch Decision)

A node sitting close to hash H in Kademlia keyspace receives every FindValue(H) query the network routes, whether or not it holds H (a non-suppressible popularity oracle). When the query count crosses prefetch.find_value_threshold (default 5 / 300s), the node MAY speculatively pull H and publish a STORE, converting its routing position into paid-delivery opportunities. Ships off by default (prefetch.enabled = false), gated by require_authorized_origin, a budget_usdc_per_hour circuit-breaker, and a served/acquired demand-quality auto-throttle.

The mechanisms it overlaps with

Mechanism Status What it does
Origin cache-miss pull-through shipped (crates/cache/src/engine.rs) On a real paid miss, pull from configured origin, BLAKE3-verify, cache, STORE-on-commit.
Node-to-node window-paced pull-through landing (ADR 037 § Node serving; integration test #746, commit 101f043) On a real paid miss for an unheld blob, pull from a holder while serving, bounded by pull_ahead_bytes + seed-leech caps. Warms the cache as a paid side effect.
Latency-driven proxy warming shipped (ADR 037 / #723) Bootstraps the first regional copy by routing a real request through a nearby non-holder, ranked by measured RTT.
Operator pinning shipped (engine.rs, set_pinned/SIGHUP) Deterministic, operator-chosen protection of specific hashes — the explicit "I want this content cached here" lever.

Does prefetch increase locality? No — and ADR 037 says so

This is the load-bearing finding. Prefetch does not improve locality, because keyspace position and geography are independent coordinate systems. ADR 037 § Context spells it out:

FIND_VALUE query frequency accrues at the K nodes closest to H in keyspace, which are geographically uniform-random. The node that observes "H is in demand" is, with high probability, not near the clients generating the demand.

ADR 037 was written specifically to solve the regional cold-start trap that prefetch cannot, and it does so reactively (RTT-routed, on real paid demand, with bounded loss). In doing so it explicitly hollowed out prefetch's remit — ADR 037 § Cross-ADR Impact:

It supersedes the local cache-miss prefetch trigger — realized local demand is served reactively here, not by speculative prefetch — and narrows the FIND_VALUE-frequency prefetch to keyspace-position monetization.

So after ADR 037, the entire residual justification for prefetch is: a keyspace-positioned node pre-acquiring globally-hot content to monetize its routing position and add a replica. Not locality. Not local demand. Just global-popularity replication at a geographically-random node.

Steelman: KEEP it

  1. Global-popularity replication that reactive paths can't front-run. Reactive warming only ever makes a copy where a real request already routed. A keyspace-positioned node sees globally-distributed demand and can pre-position a copy that becomes FIND_VALUE-discoverable for the whole network before the first request reaches it — raising replica count and availability for hot content, and absorbing load spikes on a single origin holder before they become slow/failed requests.
  2. The demand signal is free and honest-by-construction. The node already receives the FIND_VALUE traffic; the oracle "cannot be suppressed" by gossip and reflects real client demand. Not acting on a signal you already have is leaving an incentive on the table.
  3. Rewards running DHT routing nodes. Without prefetch, being near a hot hash in keyspace earns nothing — you just route queries for free. Prefetch turns that positional luck into revenue, which is a deliberate incentive-design property.
  4. The expensive part is already built and the threat model is closed. PR feat(node): add DHT prefetch popularity signal + decision engine (#650) #819 landed the decision engine, config, metrics, and the with_prefetch seam. ADR 022's recommended defaults close both the demand-only and demand-supply Sybil attacks. It's opt-in, off by default. The marginal cost of finishing (DHT prefetch: live FindValue→probe→pull-through acquisition + OriginAssignment subscription (AC 7 of #650) #820) is the acquisition wiring, not the analysis.
  5. Cheap to retain even unimplemented. Keeping the ADR analysis + the off-by-default decision layer costs little and preserves optionality if operational data later shows hot-content under-replication.

Steelman: DROP it (i.e. close #820, keep the oracle as observability only)

  1. Zero locality value. The benefit operators would most expect — content near clients — is explicitly not delivered (keyspace ≠ geography). ADR 037 owns locality and disengages cleanly once a copy exists. Prefetch's marquee selling point is already covered better, by a different mechanism.
  2. It's the only path that spends ahead of any paying customer. Every other path (origin pull-through, node-to-node window-paced pull-through, proxy warming) pays USDC only against a real in-flight paid request, bounded by pull_ahead_bytes. Prefetch acquires on speculation — it pays for bytes no customer has requested, defended only by a budget circuit-breaker + origin gate + demand-quality throttle. That is a strictly worse, unbounded-loss-shaped profile, and it's unique to this one feature.
  3. It generates a disproportionate attack/complexity surface. FIND_VALUE is cheap (no payment, only a QUIC NodeId), so prefetch drags in the entire demand-only / demand-supply Sybil analysis, the require_authorized_origin gate, a live OriginAssignment event subscription with fail-closed semantics, a spend budget, a demand-quality auto-throttle, 7 config knobs, and 7 observability metrics. No require_authorized_origin equivalent on the cache-miss pull-through path: operators cannot opt out of relaying/warming unclaimed content #821 is a fourth surface (operators wanting opt-out symmetry on the reactive path) spawned by the existence of the gate. Drop the speculative-acquisition decision and most of that evaporates.
  4. Replication already happens on real demand. Globally-hot content generates real paid requests across the network; origin + node-to-node pull-through already create replicas where demand actually lands (which is where they're useful), with STORE-on-commit making each discoverable. Prefetch adds a replica at a keyspace-random node that is, by construction, far from all of the demand.
  5. Pinning covers the deterministic intent without the speculation. An operator who knows certain content is strategic/hot pins it — explicit, deterministic, no spend-on-acquisition, no manufactured-demand exposure. The "I want to cache popular content here" intent has a safe lever already.
  6. Off-by-default + acquisition-unbuilt + hollowed-out remit is a strong negative signal. It ships disabled, the acquisition half isn't built, and ADR 037 already carved away its biggest use case. If no operator turns it on, DHT prefetch: live FindValue→probe→pull-through acquisition + OriginAssignment subscription (AC 7 of #650) #820 builds a speculative-spend engine and a fail-closed RPC subscription that sit dead — pure carrying cost in the design corpus and the dependency graph.

Recommendation

Lean: defer #820 / demote prefetch to "oracle-only," and put a decision in ADR 022. Concretely:

  • Keep the FIND_VALUE PopularityTracker as an observability signal (decdn_prefetch_* popularity metrics) — it's honest and free.
  • Keep STORE-on-commit and the reactive warming + pinning paths — they already deliver locality and demand-driven replication with bounded, customer-anchored loss.
  • Do not build the speculative acquisition path (DHT prefetch: live FindValue→probe→pull-through acquisition + OriginAssignment subscription (AC 7 of #650) #820) in the initial network. The only thing it adds over the reactive paths is global-popularity replication at a geographically-random node, bought with the system's only spend-ahead-of-customer surface and its heaviest Sybil/gate complexity — a poor trade when no current data shows hot content is under-replicated.
  • If we later observe real hot-content under-replication or single-origin overload that reactive paths don't absorb, revisit with that data — the decision layer from PR feat(node): add DHT prefetch popularity signal + decision engine (#650) #819 keeps that option cheap.

This is a recommendation, not a foregone conclusion — the strongest KEEP argument (the expensive analysis/decision layer is already built and closed) is real. The question is whether global-popularity replication at a keyspace-random node is worth the only speculative-spend path in the protocol.

Decision requested

References

Activity

  1. added
    design:economics
    design:missing-decision
    on Jun 5, 2026
  2. github-actions commented on Jun 5, 2026

    @github-actions

    🎯 Triage report

    This is a well-scoped architectural decision issue requesting an explicit keep/defer/drop call on FIND_VALUE-driven speculative prefetch acquisition (ADR 022). The decision layer has already shipped behind prefetch.enabled = false (PR #819); this issue gates whether to build the acquisition wiring in #820. The author presents a balanced steelman analysis and leans toward deferral, on the grounds that ADR 037's reactive proxy warming has taken over prefetch's primary locality use case, leaving only global-popularity replication at a geographically-random keyspace node — bought at the cost of the protocol's only spend-ahead-of-customer surface and its heaviest Sybil/gate complexity.

    📊 Assessment

    Dimension Value Reasoning
    Type Task Explicit decision request on a feature gate; no bug, no new feature build requested yet
    Labels Existing labels adequate (adr-review, economics, missing-decision, architecture) All four existing labels are accurate; high could reflect that this is blocking #820 active work, but urgency is self-described as a "natural decision point" rather than critical
    Coding agent Not suitable Requires architectural judgment and product trade-off resolution between three explicitly named options; no implementation work until the decision is recorded

    🔗 Similar issues

    💡 Notes and suggestions

    Key framing for the decision:

    The KEEP steelman's strongest point is that the expensive part (analysis engine, config, metrics, threat-model closure) is already sunk cost in PR #819 — the marginal effort is only the acquisition wiring in #820. The DROP/DEFER steelman's strongest point is that prefetch.enabled = false + unbuilt acquisition + ADR 037 having carved away the locality use case is a three-signal negative indicator: the feature's primary justification dissolved before it shipped.

    Decision implications by path:

    Suggested sub-tasks once a decision is made:

    Note: The issue already carries all appropriate labels. No additional label changes are needed.

    Generated by Agentic Triage for issue #822 · sonnet46 616.3K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  3. alpergundogdu commented on Jun 15, 2026

    @alpergundogdu
    ContributorAuthor

    Decision: KEEP — off by default, dormant, operator-opt-in

    Full memo: adr/_decisions/822-find-value-prefetch.md.

    The premise has gone stale

    This issue asks whether to spend the #820 effort "before we spend the #820 effort." That effort is already merged — 1d92267 (PR #899) wired the live FindValue → probe → pull-through acquisition, the OriginAssignment subscription (ChainOriginDirectory), and the ledger feedback loop; #900/#909 added test coverage. So the question is no longer "should we build it" but "should we keep what's built," and that inverts the cost ledger:

    • Keep ≈ free — the feature is inert behind prefetch.enabled = false.
    • Drop = reverting working, tested, merged code.
    • Defer = moot.

    Why keep on the merits (not just sunk cost)

    Speculative prefetch is not redundant with the shipped mechanisms. Origin pull-through, ADR 037 proxy warming, and pinning all warm a node only when it receives a real paid request (or a manual pin). Prefetch is the only mechanism that warms a node close to H in Kademlia keyspace that never gets a paid request for H — the keyspace-positioned node's non-suppressible view of global demand. The ADRs already designed these as complements (ADR 022 §Popularity Signals; ADR 037 Cross-ADR note: "narrows the FIND_VALUE-frequency prefetch to keyspace-position monetization"). Without prefetch, the FIND_VALUE oracle is pure observability — the node sees demand it can never act on.

    The fair counter-arguments — speculative value, real Sybil surface, ~nil benefit at the current "tens of nodes" testnet scale — argue against enabling by default (which we also reject), not against keeping an off-by-default, gated, tested capability.

    Conditions on KEEP

    1. Stays off by default.
    2. Label it experimental/unproven in operator docs.
    3. Revisit only the default (not the code) once the network reaches a scale where keyspace-position monetization is plausible — order hundreds of nodes, well past the current testnet target.

    Dispositions

    Independent finding (separate from this decision)

    ChainOriginDirectory (#651) is currently wired only to prefetch; the node-origin FIND_VALUE fallback gets an empty directory (deliberate "initial network" deferral, runtime/mod.rs:1349-1353), while ADR 022 §Origin discovery mandates the on-chain origin set as the FIND_VALUE last-resort fallback independent of prefetch. Filed separately as a follow-up.

    Closing as decided: KEEP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    design:economicsdesign:missing-decision

    Type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions