Skip to content

cli: a fetch with a drained capability retries until its timeout instead of failing #2338

Description

@alpergundogdu

Problem

When a voucher signer's registered cap - spent no longer covers the serve floor, the node refuses the stream at admission with ServeRejectReason::SignerCapExhausted (crates/node/src/handlers/client/dispatch.rs, signer_refusal). That refusal is signed on the wire as NotFound, the same as a cache miss. The client cannot tell it apart, so decdn fetch treats it as a miss, fails over and rediscovers, and keeps going until its own timeout. The user waits out the timeout and gets no clear error.

Mid-stream the node already says what happened: a drain during a stream ends with an in-band VoucherRejected { SignerCapExhausted }, and the client fails fast.

#2333 makes the admission refusal the normal path. The node now holds a registered signer's read for good and adds the spent the event projection folds, so the first request after the cap is spent is refused at admission. Before #2333 a stale 60 s cache often let that request in and the mid-stream reject ended it. Seen in the cli_fetch_delegated clamp journey: after the cap was spent, each retry hung for the 60 s test timeout.

Options

  1. Client-side pre-check, no wire change. Before it opens a stream with a capability, the client reads getAuthorization(pool, signer) (or keeps the last read) and fails at once with a clear error when the registered cap - spent is below one interval at the provider's rate. It can do the same when it sees NotFound from every holder of a blob that discovery says they hold.
  2. Distinct admission reason on the wire. Sign SignerCapExhausted at admission as its own reason instead of NotFound. This touches the deliberate NotFound conflation (see the StreamError notes in metrics.rs and dispatch.rs), so it needs a protocol decision and an ADR check first.

Option 1 keeps the wire unchanged and fixes the user-facing hang.

Activity

  1. added
    prio:medium
    area:cli
    area:node
    area:payments
    on Oct 6, 2026
  2. self-assigned this
    on Oct 7, 2026
  3. added a commit that references this issue on Oct 7, 2026
    2e091fe
  4. alpergundogdu commented on Oct 7, 2026

    @alpergundogdu
    ContributorAuthor

    Direction decided: neither option above.

    • The client does not pre-check or confirm refusals on-chain (option 1): that adds an RPC dependency to every client.
    • The wire does not grow per-reason variants (option 2). Open-time refusals collapse to three classes instead: NotFound ("no", try others), Declined ("no, stop asking" for this hash this fetch) and Unfunded ("no at the current funding", spoken only to a proven lane or signer).
    • A node's refusal is never fatal to a fetch; it removes only that node. When the candidates are exhausted and at least one said Unfunded, the client runs one funding recovery step (owner: topUp, or a new pool if the old one is closing or closed; delegate: a new capability from the funder), then retries those nodes once. If every node said Declined, the fetch ends at once with "no node will serve this", which removes the hang described here.

    The ADR change is being written on branch adr/refusal-classes; the implementation lands on the same branch.

  5. moved this from In progress to Done in deCDNon Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:cliarea:nodearea:paymentsprio:medium

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions