Skip to content

feat!: scope node refusals to three classes and recover funding once per fetch - #2354

Merged
thiras merged 22 commits into
mainfrom
adr/refusal-classes
Oct 9, 2026
Merged

thiras merged 22 commits into
mainfrom
adr/refusal-classes

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Why

One node's refusal could end a fetch for the whole network. An operator's local origin denylist answers OriginBlacklisted, and the client maps that to Fault::Fatal(Command) in crates/client/src/fault.rs, so one operator's private policy stopped the fetch everywhere. A node's private floor M could also drive client top-ups. And refusals that look like misses made a drained capability hang the CLI (#2338).

Closes #2338.

What

1. ADR (58fd872, 3c39503)

  • ADR 005 defines three open-time refusal classes and maps every node reason to one. ADR 039 sets the client rules and the exhausted-set outcomes. ADR 003 defines funding recovery.
  • EvictedSinceProbe was never slash evidence. The ADR text and the Rust doc comment that implied it are fixed.
  • ADR 001, 002, 011, 013, 022, 037, 040, the bundles and observability appendices, and architecture.md follow the new classes.
  • A pool with no on-chain record, or a Closed pool, answers NotFound: the node cannot tell either from an RPC fault or a lagging chain view. Unfunded covers a Closing pool. ADR 003 says the buyer reuses its pool only while it is open (ac3ac2b).

2. Wire classes (e59969e)

  • StreamError carries NotFound (not now, try others), Declined (this node will not serve this hash during this fetch) and Unfunded (this node will not serve at the current pool deposit or signer capability).
  • Overloaded, BlobTooLarge, InternalError, EvictedSinceProbe, OriginBlacklisted, HashBlacklisted and InsufficientDeposit leave the wire.
  • VoucherRejected { reason, bundle } stays for the watermark self-heal.

3. Node serve mapping (ae79abc)

  • Every ServeRejectReason maps to one class. The finer reasons stay in the node's per-reason metrics.
  • A below-margin miss and a node's own upstream fill that ends "funding needed" answer NotFound.
  • Unfunded is spoken only to a proven requester. Anyone else gets NotFound, so pool and signer state stay unmappable.

4. Client classification and exhausted-set rules (ef97f52, e76091f, a7dcef7)

  • Every refusal scopes to its node for this fetch. Only local faults are fatal.
  • Declined removes the node for that hash only. In a bundle pull the node stays a candidate for the other entries.
  • Unfunded parks the node at the current funding until a recovery step. The recovery state spans the whole pull.
  • Mid-stream funding rejections act as Unfunded. Other unhealable voucher rejections act as Declined.
  • When the candidate set is exhausted, the first rule that applies decides:
    • a funding recovery step if any candidate refused Unfunded;
    • "no node will serve this", naming the collected reasons, if every candidate refused Declined;
    • otherwise not-found.
  • A delegated fetch that ends "funding needed" names the new-signer-key remedy.

5. Funding recovery (aeded86)

  • A lane never adds funds. On a node's refusal, only the exhausted candidate set runs a recovery step. The low-water refill at a lane build is separate: it reads only the buyer's own pool, so no node can start it (ADR 003, ac3ac2b).
  • Progress rule: the first step of a fetch is free. A further step needs a newly BLAKE3-verified byte since the last one.
  • Owner step:
    • The owner tops its pool up toward the working deposit.
    • When topUp reverts PoolNotOpen, it opens a new pool, makes it current in the local store and runs the remaining work against it. The old pool is never reopened or reclaimed.
  • Owed tail (option B): a lane that a funding refusal ends keeps its delivered but unpaid credit-window span. The next drive on the same lane (same pool, signer and provider) bills it from the paid frontier. A replaced pool, a rotated key, or a fetch that completes without that lane running again leaves the span as the node's credit-window loss.
  • Delegated signer:
    • A CredentialSlot in the SDK holds the key and its dcap1 capability, and the application can swap both at any time.
    • After a swap, lanes on the old key stop at a voucher boundary, paid for what they received. New lanes resume from the delivered frontier.
    • The fetch computes FundingEvent::RunningLow { headroom, projected_need, expires_at } locally, with no chain read.
    • At the exhausted set the fetch waits a bounded time (60 s by default) for a swap. With no swap it ends with a typed FundingNeeded::NewCapability { pool, cause }. If the capability still covers the work, it ends at once with FundingNeeded::PublisherPool { pool }.

6. Review fixes (fd49997, a8c2930)

  • Full pool:
    • A pool that already holds its working deposit runs a gas estimate of topUp(1), with no transaction sent.
    • PoolNotOpen opens a replacement. Anything else settles: the step returns the current deposit, and the settle window asks the stale nodes again.
  • Concurrent fills:
    • A fill shares a sibling fill's step when the pool row is already above the deposit it saw.
    • A fill joins a recovery top-up already in flight instead of escrowing again.
  • First open:
    • The first open uses the same delegated branch and typed outcomes as the acquire loop.
    • It sees a sibling bundle entry's step through the shared lane contexts.
  • Progress counting:
    • A swap that came before the step counts under the progress rule.
    • Re-delivered (re-billed) bytes count no progress.
    • The node's buffered fill counts the bytes its store gained.
  • Owed spans: a span survives a failed merged gap and a bill that faults.
  • Delegate cap: the delegate's spend counts every lane the local buyer store records for the key, at any provider.

7. Second review round

A multi-agent review (code, silent failures, tests, comments, types) found these. Each fix has a test that fails when the fix is taken out.

  • Sibling steps in a bundle (ca3ce7d):
    • A bundle entry with no lane stepped at deposit zero, burned the run's free step and ended the whole pull "funding needed". The step now runs at the deposit a sibling priced the source out at, and RunFunding holds the pool id for the run.
    • A sibling's settle step, or a top-up whose credit had not landed yet, ended a concurrent entry with NoProgress. The gate now counts its top-up and settle steps and keeps the deposit it reached, so a caller that has not seen a step gets one more pass and takes no step of its own.
    • swap_step took the step before it checked the generation, so the second of two concurrent delegated callers ended needing a new capability. It now hands a sibling's swap on.
  • Node waiters on a closing pool (91c1afe): a fill waiting on a sibling's recovery top-up that hits PoolNotOpen joins the replacement open instead of failing as a local fault.
  • Closed pool reuse (ac3ac2b): neither buyer read its own pool before reuse, so a pool closed from another machine, or reclaimed by anyone, failed every fetch as not-found. The CLI reads its tracked pool once per run and replaces a Closing or Closed one. A failed read, or no record yet, keeps the row, so a lagging RPC never escrows a second deposit. The node's reclaim sweep drops a pool someone else reclaimed.
  • Decline scoping (e9efd48): a Declined that removes a node from a hash no longer cools it in the health the bundle's entries share, or stamps its peer-store record.
  • Swallowed errors (e9efd48, 528de31):
    • pool_accepts_funds falls back to a status read when the topUp(1) estimate fails for another reason, and warns when both fail.
    • A dropped drive (the node's pull leg cancels it) notes its owed spans back through a drop guard.
    • A failed recovery step on a ranged pull ends RecoveryFailed, not "funding needed".
    • The CLI warns on two buyer-store reads it used to swallow.
  • Delegated credential (e6a51d8):
    • CredentialSlot::new and swap refuse a key the capability does not name (CredentialMismatch).
    • with_swap_wait sets the wait on the shared slot instead of forking it.
    • One rule, CredentialView::funding_cause, names the capability cause for the first open and the acquire loop.
  • Funding verdict (e6a51d8): a source that declined the blob no longer counts as priced out, so it triggers no funding step.
  • Docs (e1f83fb, ac3ac2b): the docs and ADRs that still described NotFound for open-time funding refusals, removal on Unfunded, or "funds only through recovery" now match the code.

8. Metric rename (a8c2930)

Old New
decdn_node_pull_reactive_topup_total decdn_node_pull_recovery_step_total
decdn_node_pull_reactive_topup_refused_total decdn_node_pull_recovery_step_refused_total

Merge

Merged with main at cdd1db5 (#2369), then at 6e92b21 (e9bf9a4). Where main edited a shim this branch deletes, the deletion stands. #2374's write-once capability wording is merged into ADR 003 § Revocation, ADR 005 and the --capability help.

Testing

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features: no warnings.
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items
  • Before the second review round: cargo nextest run --workspace --exclude decdn-e2e passed 4709, and cargo nextest run -p decdn-e2e --features anvil-e2e passed 98.
  • After it:
    • cargo nextest run -p decdn-client -p decdn-cli -p decdn-node: 3194 passed.
    • cargo nextest run -p decdn-e2e --features anvil-e2e for cli_fetch_topup, cli_fetch_multi_source, cli_fetch_delegated and cli_pool_reclaim_precheck: 7 passed. The full anvil suite was not rerun.
    • decdn-client public_api snapshot regenerated for CredentialMismatch and the fallible CredentialSlot::new/swap.

Key new tests:

  • Progress rule:
    • no_verified_byte_since_the_last_step_ends_funding_needed
    • verified_bytes_since_the_last_step_allow_another
    • a_long_pull_recovers_again_after_verified_progress
  • Owed tail:
    • the_same_lane_bills_its_owed_tail_after_a_funding_refusal
    • a_new_lane_resumes_at_the_delivered_frontier_and_owes_nothing
    • a_fetch_finished_by_other_lanes_leaves_the_owed_span_unpaid
    • the_resumed_leg_does_not_re_pay_for_delivered_bytes (node)
  • Full pool:
    • a_full_open_pool_settles_without_a_top_up (CLI and node)
    • a_full_closing_pool_is_replaced (CLI and node)
    • a_full_pool_refused_by_a_stale_upstream_settles_then_is_served
  • Concurrent fills:
    • concurrent_steps_share_one_recovery_top_up
    • a_recovery_step_shares_a_siblings_landed_top_up
  • Credential slot:
    • a_swap_mid_stream_retires_the_old_lane_paid_and_resumes_under_the_new_key
    • a_swap_inside_the_wait_resumes_the_fetch
    • no_swap_inside_the_wait_ends_needing_a_new_capability
    • a_pool_refusal_under_a_healthy_capability_names_the_publisher_pool
    • spend_recorded_at_another_provider_counts_toward_the_cap
    • running_low_fires_below_the_work_plus_one_credit_window
  • First open:
    • a_delegated_first_open_ends_with_a_typed_funding_needed
    • a_first_open_sees_a_sibling_entrys_step
  • Progress counting: re_delivered_bytes_report_no_progress
  • Second review round:
    • an_entry_with_no_lane_takes_a_siblings_top_up, an_entry_with_no_lane_steps_at_the_siblings_deposit
    • a_siblings_settle_step_answers_a_caller_that_has_not_seen_it, concurrent_callers_share_one_top_up, concurrent_callers_share_one_swap
    • fills_waiting_on_a_top_up_into_a_closing_pool_join_its_replacement, the_reclaim_sweep_drops_a_pool_someone_else_reclaimed
    • a_tracked_pool_is_reused_only_while_the_chain_shows_it_open
    • a_decline_does_not_cool_the_node_for_a_sibling_entry, a_declined_source_priced_out_too_takes_no_funding_step
    • a_dropped_drive_keeps_its_owed_span, an_unreadable_estimate_falls_back_to_the_pools_status
    • a_key_its_capability_does_not_name_is_refused, one_rule_names_the_capability_cause
    • a_replaced_pool_runs_the_work_again_at_most_once, a_block_only_an_unfunded_source_covers_takes_a_recovery_step, stacked_markers_classify_in_a_fixed_order

Follow-ups

  • decdn/devops dashboards:
    • drop the probe_post_eviction query;
    • add a pool_closing panel;
    • apply the metric rename above.
  • Known limits:
    • decdn fetch -o - does not rerun on a replaced pool. It ends, naming the new pool.
    • The bundle manifest fetch is not rerun on a replaced pool.
    • The running-low signal counts persisted lanes and this fetch's lanes only.
    • The CLI swaps no credential: its slot waits zero, and the slot is the seam for a credential source.
    • A dropped drive re-notes its owed spans from the start of the gap in flight, as the scheduler's cancel does, so bytes paid inside that gap can bill again on the lane's next run (at most the owed span).
    • A pool closed while the node runs still gets NotFound from upstreams with no lane on it, until they refuse Unfunded or the sweep reclaims the pool after its dispute window.
  • Tracked elsewhere: the signer revocation stop-serving signal that ADR 003 § Revocation describes (Build the signer revocation stop-serving signal (ADR 003 § Revocation) #2375).
  • Open design questions from the review:
    • the expiry-margin refusal shares the signer_cap_exhausted counter;
    • split the wire type so only VoucherRejected can travel mid-stream;
    • narrow the #[doc(hidden)] pub RecoveryGate surface the node uses;
    • an anvil e2e test against a real Closing pool.

🤖 Generated with Claude Code

@github-code-quality

github-code-quality Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit 0d480cc in the adr/refusal-classes branch is 75%. The line coverage in commit 6e92b21 in the main branch is 74%.

Show a line coverage summary of the most impacted files.
File main 6e92b21 adr/refusal-classes 0d480cc +/-
crates/client/src/ledgers.rs 100% 81% -19%
crates/node/src...gin/pull_leg.rs 88% 85% -3%
crates/client/s...c/source_set.rs 96% 93% -3%
crates/cli/src/.../bundle_pull.rs 62% 60% -2%
crates/cli/src/.../cli_sources.rs 28% 26% -2%
crates/client/src/scheduler.rs 93% 93% 0%
crates/cli/src/...mmands/fetch.rs 54% 55% +1%
crates/node/src...uyer_channel.rs 56% 60% +4%
crates/client/s...c/credential.rs 0% 97% +97%
crates/client/src/recovery.rs 0% 98% +98%

Updated October 09, 2026 05:10 UTC

alpergundogdu and others added 6 commits October 7, 2026 12:59
…nce per fetch

The wire carries three open-time refusal classes: NotFound, Declined and Unfunded.
Each refusal scopes to the node that sent it for the current fetch, so no single
node can end a fetch. A client runs one funding recovery step per fetch, and only
when every candidate is exhausted and at least one refused Unfunded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… note

Funding recovery repeats only after verified progress. A revoked key is Unfunded,
and a node whose own upstream fill needs funding answers NotFound. The all-declined
error names the collected reasons. Drop the post-eviction metric from the registry
and dashboard, and fix the EvictedSinceProbe doc.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
StreamError is NotFound, Declined, Unfunded and VoucherRejected. The node
maps its finer serve reasons onto the classes and keeps them in its
per-reason metrics. The client and the node pull leg classify a refusal
from its class alone, so no refusal reports a degraded node. The
post-eviction probe metric goes with the code that fed it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A spent or expired signer, a lane inside its expiry margin, and a Closing
pool refuse Unfunded to a proven requester; a Closing pool answers anyone
else NotFound. A foreign namespace and a range past this node's size claim
refuse Declined. A withdrawn hash keeps its eviction reason when the
origin-only probe reads it as absent. A node whose own wallet cannot fund a
buyer pool ends its fill "funding needed" and answers NotFound.

Adds decdn_serve_stream_rejected_pool_closing_total.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The size-ceiling refusal that bars a lane from pull-through reaches the
client as the Declined class.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… needed

A node now refuses a spent capability signer Unfunded, so a delegated
fetch on it ends "funding needed". The message tells the owner to top up
or issue a capability for a new signer key, since registered terms are
write-once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alpergundogdu and others added 6 commits October 7, 2026 13:58
…ed set

A Declined refusal, or a mid-stream voucher rejection that no bundle heals
and that names no funding reason, declines its node for the rest of the
fetch. A funding rejection acts as Unfunded from its node. Only local
faults end a fetch. When every known node declined, the fetch ends at once
with "no node will serve this", naming the reasons collected; otherwise a
priced-out set ends "funding needed" and an empty one not-found.

The chain read that explained a drained signer's NotFound goes: the node
now answers such a signer Unfunded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	crates/cli/src/commands/bundle_pull.rs
#	crates/cli/src/commands/fetch.rs
#	crates/client/src/driver.rs
#	crates/client/src/fault.rs
#	crates/client/src/first_open.rs
#	crates/client/src/lib.rs
#	crates/client/src/scheduler.rs
#	crates/client/src/source.rs
#	crates/client/src/source_set.rs
#	crates/node/src/handlers/client/mod.rs
#	crates/node/src/handlers/client/outcome.rs
#	crates/node/src/metrics.rs
#	crates/node/src/node_origin/mod.rs
#	crates/node/src/node_origin/pull_leg.rs
#	crates/node/tests/node_origin_pull.rs
#	crates/protocol/src/client.rs
#	monitoring/dashboard-delivery.json
#	monitoring/grafana-dashboard.json
A lane never adds funds. A source priced out or refusing Unfunded waits,
and only the exhausted candidate set runs one funding recovery step under
a progress rule: the first step is free, a further one needs a newly
verified byte. A self-funded owner tops up, or opens a new pool when the
current one reverts PoolNotOpen and runs the remaining work against it.
A lane that a funding refusal ends keeps its unpaid credit-window span,
and its next drive bills it.

A delegated fetch takes a swappable CredentialSlot: a swap retires the
old-key lanes at a voucher boundary, the fetch publishes a local
RunningLow signal, and the exhausted set waits for a swap before ending
with a typed FundingNeeded (NewCapability or PublisherPool). ADR 003 and
ADR 039 describe both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A recovery step on a pool that already holds its working deposit runs a
topUp gas estimate: PoolNotOpen opens a replacement, anything else
settles so the stale nodes are asked again. Concurrent node fills share
one step, the first open runs the delegated branch, a swap that came
early counts under the progress rule, and the delegate's cap counts the
key's recorded spend. Owed spans survive a failed merged gap and a
faulted bill, and re-delivered bytes report no progress. ADR 003 says an
owed span stays unpaid when its lane does not run again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The node's recovery-step counters become decdn_node_pull_recovery_step
and decdn_node_pull_recovery_step_refused. The buffered fill counts the
bytes its store gained toward the progress rule, so a long pull recovers
again after verified progress. ADR 005, ADR 039 and the bundle appendix
scope Declined to its hash and park Unfunded sources until a recovery
step. Prose that described the removed in-lane top-up is rewritten.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	crates/client/src/driver.rs
#	crates/client/src/driver/tests.rs
#	crates/client/src/lib.rs
#	crates/node/tests/client_loopback.rs
#	crates/node/tests/node_origin_pull.rs
#	crates/protocol/src/client.rs
@alpergundogdu
alpergundogdu marked this pull request as ready for review October 8, 2026 15:04
Copilot AI balanced review requested due to automatic review settings October 8, 2026 15:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It is a wire-breaking protocol change spanning node, client, and CLI with intricate funding-recovery, owed-tail, and credential-swap semantics whose correctness hinges on cross-crate invariants that warrant final human review.

0 open findings

What changed in this PR

This PR collapses the on-wire StreamError enum from eight delivery-side codes down to three open-time refusal classes — NotFound ("not now, try others"), Declined ("will not serve this hash this fetch"), and Unfunded ("not at the current deposit/signer capability") — plus the existing mid-stream VoucherRejected. It then rewires every side of the paid-pull path to that smaller vocabulary: the node maps each finer ServeRejectReason to one class (keeping the detail only in per-reason metrics, and speaking Unfunded only to a proven requester), the client classifies refusals so one node's private policy can no longer end a fetch for everyone, and funding recovery is reworked so a lane never tops up itself — only the exhausted candidate set runs one bounded recovery step per newly-verified byte. It also adds credential-slot key swapping, owed-tail (option B) span tracking so a resumed lane re-bills delivered-but-unpaid bytes, and bundle-pull re-run on a replaced pool. The reactive_topup metric is renamed to recovery_step, and the ADRs/docs are updated to match. This closes the #2338 hang where a drained capability looked like a cache miss and retried until timeout.

Changes:

  • Reduce StreamError to NotFound / Declined / Unfunded / VoucherRejected; map node serve-reject reasons onto the three classes and gate Unfunded behind requester proof.
  • Rework client funding recovery (exhausted-set-driven step, progress rule, owed-tail re-billing, credential slots) and add pool-replacement re-run in bundle pull.
  • Rename reactive_topup metrics to recovery_step, add the pool_closing serve-reject metric, and update ADRs 005/039/003 (and dependents) plus the runbook.
File Description
crates/​protocol/​src/​client.rs Collapses StreamError to the three open-time refusal classes; rewrites the enum/field docs accordingly.
crates/​protocol/​src/​client/​tests.rs Updates frozen variant-order and domain-split tests to the new variant set.
crates/​protocol/​tests/​snapshots/​public_api__public_api.snap Regenerated public-API snapshot for the reduced enum.
crates/​node/​src/​handlers/​client/​mod.rs Maps each ServeRejectReason to one wire class; adds PoolClosing.
crates/​node/​src/​handlers/​client/​dispatch.rs Adds pool-closing and capability-expiry admission gates (proven ⇒ Unfunded, else NotFound).
crates/​node/​src/​node_origin/​ranged_pull.rs Adds Unfunded run outcome and exhausted-set recover() driving FundingNeeded.
crates/​node/​src/​metrics.rs Adds serve_stream_rejected_pool_closing counter; renames reactive_topup → recovery_step.
crates/​client/​src/​fault.rs Rewrites classify() so only local faults/exhausted-set stops are fatal; funding reasons ⇒ Unaffordable.
crates/​client/​src/​pacer.rs Simplifies BudgetPacer to Draw/Done/Refuse; removes self top-up state.
crates/​client/​src/​ledger.rs Adds owed-tail note_unpaid/take_unpaid/merge_spans for re-billing delivered-but-unpaid spans.
crates/​incentive/​src/​pool_open_error.rs Adds PoolNotOpen error marker and is_pool_not_open revert detection.
crates/​client/​src/​buyer_pool.rs Adds pool_accepts_funds gas-estimate probe and PoolNotOpen handling in top_up.
crates/​cli/​src/​commands/​bundle_pull.rs Adds replaced_pool/merge_passes to re-run a bundle pull once on a replaced pool.
crates/​cli/​src/​commands/​cli_sources.rs Adds credentials() building a zero-wait credential slot seeded with prior per-signer spend.
docs/​runbook.md, ADRs (005/​039/​003/​011/​…) Rewrites refusal/funding-recovery prose and metric names to the new model.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

thiras and others added 6 commits October 9, 2026 05:55
# Conflicts:
#	adr/003-payments.md
#	adr/005-protocol.md
#	crates/common/src/cli/fetch.rs
Bundle entries share one RecoveryGate and one PeerHealth, but each entry
judged a sibling's step only by its own deposit view. Three paths ended
the whole pull "funding needed" while a sibling's step had already
answered it:

- A sibling's settle step leaves the deposit where it was, so a caller
  blocked on the step lock saw no raise and hit the progress rule. The
  gate now counts top-up and settle steps; a caller that has seen fewer
  takes one more pass and no step. It also keeps the deposit the last
  step reached, so a caller whose view lags a top-up's credit takes it.
- swap_step took the step before it checked the generation, so the
  second of two concurrent delegated callers got NoProgress. It now
  hands a sibling's swap on without a step.
- An entry that built no lane exhausted at deposit zero, against a
  source a sibling priced out at the real deposit. It stepped at zero,
  and its own CliSources held no pool id, so the run's free step failed
  with "no payment lane is built". The step now runs at the deposit the
  source was priced out at, and RunFunding holds the pool id for the run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…olNotOpen

A fill that waits on a sibling's recovery top-up turned its error into a
plain anyhow string, so a PoolNotOpen revert reached every waiter as a
local fault while only the fill that spawned the top-up replaced the
pool. A waiter now joins the replacement open and reports the new pool.
The "every joined topUp failed" error keeps the marker too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- PoolExhausted and SignerCapExhausted: the open-time equivalent is
  Unfunded to a proven requester, not NotFound (protocol docs, ADR 005).
- Unfunded parks a source until a recovery step; it does not remove it
  (protocol docs, ADR 037).
- Recovery::ToppedUp covers the settle step; Unavailable no longer
  claims a full pool.
- FillOutcome, MissPath, the pool-open LocalPullFault rationale and the
  negative-cache comment name the classes the node actually sends.
- ADR 039: the node pull leg refuses with NotFound; a partial holder's
  Declined bars pull-through only.
- ADR 011 links the VoucherRejected semantics section by name; the
  unpaid span is at most one credit window; drop the stale "seven
  reasons" counts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A node answers a request on a Closed pool, or on a pool it has no record
of, with NotFound: it cannot tell either from an RPC fault or a lagging
chain view. Neither buyer read its own pool before reuse, so a pool the
owner key closed elsewhere, or that anyone reclaimed, failed every fetch
as not-found and never reached a recovery step.

- The CLI reads its tracked pool once per run, before the first lane
  build, and adopts or opens another pool when the chain shows it
  Closing or Closed. A failed read, or a pool with no record yet, keeps
  the row, so a lagging RPC never escrows a second deposit.
- The node's hourly reclaim sweep drops the row of a pool someone else
  already reclaimed.
- ADR 005 moves no-record and Closed pools to the NotFound row; ADR 003
  says the buyer reuses its pool only while it is open.

ADR 003 and architecture.md also scope the "adds funds only through the
recovery step" claim to refusals: the low-water refill at a lane build
reads only the buyer's own pool, so no node can start it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
thiras and others added 4 commits October 9, 2026 07:18
…opped drive

- A wire Declined, or a voucher rejection that acts as one, removes the
  node from that hash only (ADR 005). It also cooled the node in the
  PeerHealth every bundle entry shares, and stamped a failure in its
  peer-store record. A node that leaves the hash now does neither; a
  partial holder's pull-through bar still cools, which backs off a
  holder that declines every block.
- pool_accepts_funds read any estimate failure but PoolNotOpen as open,
  with no log, so an RPC fault on a closing pool settled instead of
  replacing it. It now reads the pool's status as a fallback, and warns
  with both errors when that read fails too.
- drive took the lane's owed spans at its start and put them back only
  on an error. The node's pull leg drops a drive on cancel, which lost
  the spans. An OwedSpans guard now notes them back on any end before
  billing reaches them, from the failed gap's paid frontier on an error
  and from the gap in flight on a drop, as the scheduler's cancel does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rdict

- A source that declined this blob no longer counts as priced out: a
  top-up cannot help it, so a set where it is the only priced-out source
  ends not-found instead of running a funding step.
- One rule, CredentialView::funding_cause, names why a delegated fetch
  needs a new capability. The acquire loop lacked the first open's
  "a cap with nothing left is spent" clause, so with no work priced yet
  it named the wrong cause.
- CredentialSlot::new and swap refuse a key the capability does not
  name (CredentialMismatch); every voucher it signed would be refused.
- with_swap_wait sets the wait on the shared slot instead of forking a
  new one, so a clone taken before it keeps watching the same slot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… gaps

- The ranged pull's recovery seam returns why a step lets no source be
  asked again. A step that failed on this node's own fault ends the
  assembly RecoveryFailed, not "funding needed ... no recovery step can
  raise it", which sent operators the wrong way. The outcome-to-result
  mapping moves into assembly_result.
- node_step names which of "no byte verified" and "the step could not
  add funds" ended a fill.
- The CLI warns when a buyer-store read fails while it seeds a delegated
  key's recorded spend (which then counts from zero) or sizes a settle
  step's deposit (which then is estimated).
- Tests: next_pass runs a replaced pool's work again at most once and
  never for a stdout stream; both full-closing-pool tests now prove the
  replacement open ran; the wire-mapping test lists every NotFound
  reason; a block only an Unfunded source covers takes a recovery step.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thiras thiras changed the title docs(adr): scope node refusals to three classes and recover funding once per fetch feat!: scope node refusals to three classes and recover funding once per fetch Oct 9, 2026
@thiras
thiras merged commit 13373c8 into main Oct 9, 2026
31 checks passed
@thiras
thiras deleted the adr/refusal-classes branch October 9, 2026 05:10
thiras added a commit to decdn/devops that referenced this pull request Oct 9, 2026
…trics (#104)

* feat(monitoring): follow decdn's refusal classes and recovery-step metrics

decdn/decdn#2354 renames the node's reactive top-up counters to recovery
step counters, adds a pool-closing serve refusal counter, and drops the
post-eviction probe metric. The delivery and node dashboards follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(monitoring): describe the refusal panels by decdn's three wire classes

decdn#2354 replaced the per-reason refusal codes with NotFound, Declined
and Unfunded, so the two "Serve refusals by reason" descriptions named
codes the node no longer signs. Map each reason to its class, as
ServeRejectReason::wire_error does.

Drop the stale sibling count from "Unattributed stream failures" (it
said 29; the expression subtracts 31, and the node's
INBOUND_FAILURE_REASONS test holds the list). Describe the pull leg's
pool plumbing panel, and log the change in the chart CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Ant Somers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants