Skip to content

Node reactive mid-pull top-up (node-to-node buyer leg) #1530

Description

@alpergundogdu

Context

The two-tier buyer deposit feature (initial + working deposit, PR for claude/cli-config-auto-top-up-71bc18) ships:

  • Config split: buyer_initial_deposit_micro_usdc / buyer_working_deposit_micro_usdc
  • CLI: opens at initial, proactive low-water refill toward working, and a reactive mid-fetch top-up on genuine InsufficientDeposit (with content-space paid-frontier resume, funder-gated)
  • Node node-to-node: opens at initial + proactive graduation toward working on reuse

The one piece intentionally deferred is the reactive mid-pull top-up on the node's node-to-node cache-miss buyer leg.

Why it was deferred (architecture)

The node's node-to-node buyer leg always calls stream_fetch_shared with byte_offset == 0 (crates/node/src/node_origin.rs, ~line 2000): it buffers the whole blob and has no partial/paid-frontier resume. A reactive top-up there would retry from zero and re-download + re-pay the entire delivered prefix — the same double/under-pay class the CLI leg had to solve with sink::content_paid_frontier. Worse, after genuine exhaustion, re-fetching from 0 re-spends the fresh working deposit on already-delivered bytes and can immediately re-exhaust, so it cannot make progress.

What it needs

Convert the node miss path from the buffered stream_fetch_shared (byte_offset==0) to a resumable progressive pull (as the CLI already uses via open_progressive_pull + content_paid_frontier), so the node can top up and resume at the paid frontier without re-paying. Then add the reactive top-up (funder-gated — the node is its own funder, so the gate passes) bounded by a top-up attempt budget, reusing the genuine_exhaustion validator and content_paid_frontier from crates/client-pull.

Scope note

Lower urgency than the CLI leg: the node already graduates channels across pulls (proactive refill on reuse handles the common "channel drains over many pulls" case). The gap is only a single node-to-node pull larger than the initial deposit.

Activity

  1. added
    kind:feature
    prio:medium
    rust
    on Jul 30, 2026
  2. github-actions commented on Jul 30, 2026

    @github-actions

    🎯 Triage report

    This is a well-scoped, clearly deferred follow-up to the two-tier buyer deposit feature (initial + working). The node's node-to-node cache-miss buyer path currently buffers the entire blob via stream_fetch_shared (byte_offset == 0), making reactive mid-pull top-up impossible without re-downloading and re-paying the already-delivered prefix. The fix requires converting the node miss path to the same resumable progressive pull mechanism the CLI already uses (open_progressive_pull + content_paid_frontier), then wiring in the reactive top-up bounded by an attempt budget. The issue author explicitly flags this as lower urgency — the proactive graduation on channel reuse already handles the common case; the gap is only a single node-to-node pull exceeding the initial deposit.

    📊 Assessment

    Dimension Value Reasoning
    Type Feature Deliberate follow-up / deferred enhancement, not a bug
    Labels enhancement, technical, prod-blocking, rust, medium Deferred post-PoC, Rust impl, medium urgency per author
    Coding agent Suitable Clear requirements, self-contained scope, well-defined success criteria, prior art (CLI leg) to follow
    💡 Notes and suggestions

    Approach:
    The CLI leg is the direct template. The path is:

    1. In crates/node/src/node_origin.rs (~line 2000), replace the stream_fetch_shared(byte_offset=0) + buffered sink with open_progressive_pull from crates/client-pull.
    2. Thread through content_paid_frontier to track the paid progress point.
    3. Add reactive top-up on InsufficientDeposit using genuine_exhaustion validator + the node-is-own-funder gate (already true, so the gate passes unconditionally).
    4. Bound top-up retries with an attempt budget (reuse whatever constant the CLI leg defines).

    Key files:

    • crates/node/src/node_origin.rs — the miss path to convert
    • crates/client-pull/src/lib.rs — open_progressive_pull, content_paid_frontier, genuine_exhaustion
    • crates/client-pull/src/sink.rs — content_paid_frontier implementation

    Success criteria (from issue):

    • Node can top up mid-pull on a blob larger than the initial deposit without re-paying already-delivered bytes
    • The top-up is funder-gated (passes by default since node is its own funder)
    • Top-up attempts are bounded (no infinite retry)

    Generated by Agentic Triage for #1530 · sonnet46 · 21.6 AIC · ⌖ 5.67 AIC · ⊞ 6.2K · ◷

    Add this agentic workflow to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  3. self-assigned this
    on Aug 4, 2026
  4. added a commit that references this issue on Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:featureprio:mediumrust

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions