Skip to content

fix(client): a lane build failing at the backoff cap logs WARN; GaveUp carries the last fault - #3014

Open
yigitdot wants to merge 4 commits into
mainfrom
fix/2371-build-fault-warn
Open

yigitdot wants to merge 4 commits into
mainfrom
fix/2371-build-fault-warn

Conversation

@yigitdot

@yigitdot yigitdot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2371.

Mapping to the issue's proposal

  1. Build faults escalate (implemented). SourceSet::log_build_fault replaces the DEBUG "lane build failed" lines in scheduler.rs and first_open.rs. It logs DEBUG until the provider's build backoff reaches BUILD_RETRY_CAP (BUILD_RETRY_WARN_AT = 6 failures in a row, pinned by a test against Backoff::fail), then WARN with provider, failures and the sanitized error chain. Past the cap the backoff holds each provider to one build per 30 s, which bounds the WARN line. A lane that builds resets the count. GaveUp is unchanged (no new field): SourceSet::give_up wraps it with a crate-private LastBuildFault context naming the provider with the most build failures in a row, once that count reaches BUILD_RETRY_WARN_AT and while it has built no lane. It does so only while no built lane can serve, and never names a provider that declined the blob or is marked absent. Its text ends with the give-up text, so a plain {} still reads as the stop line. Each provider keeps its fault beside its backoff in build_retry, so a success clears only its own provider. The full chain names what kept failing and downcast_ref::<GaveUp>() keeps working. fold_late_build stays at DEBUG: those builds end after the fetch did and never reach lane_built.
  2. Repeated TopUpFailed (already fixed). feat!: scope node refusals to three classes and recover funding once per fetch #2354 deleted TopUpFailed; a top-up runs at most once per fetch through RecoveryGate::step and its failure ends the fetch, so nothing persists to escalate.
  3. Throttle on client WARN lines (resolved by documentation). adr/appendix-observability.md now states the client-side bounds: lane-fault WARN lines are bounded by the health cooldown (2 s doubling to 60 s), build-fault WARN lines by the 30 s backoff cap, so no per-cause throttle is added.

The extra-stream refusal rule from the issue comment is deliberately not included: per the maintainer note it needs evidence from real pull logs first.

Note

The CLI's stop_message prints only GaveUp's own line, so decdn get does not show the new context yet; the full chain reaches {:#} callers (node logs, SDK users, activity records). Deferred to a follow-up because #3015 also edits interrupt.rs. The backoff, count and decline bounds are per SourceSet (a blob fetch uses one for the size open and one for the drive); the ADR says so.

Tests

  • source_set::tests::the_build_warn_threshold_is_where_the_backoff_reaches_its_cap
  • source_set::tests::a_lane_build_logs_warn_once_its_backoff_reaches_the_cap (DEBUG below the cap, WARN at and past it naming provider + failures, success resets to DEBUG)
  • source_set::tests::a_give_up_names_a_persistent_build_fault_and_stays_a_gave_up, a_give_up_does_not_name_a_build_fault_below_the_threshold, a_give_up_names_the_provider_with_the_most_build_failures, a_give_up_names_no_build_fault_while_a_lane_is_built, a_give_up_does_not_name_a_provider_that_left, a_prebuilt_lane_clears_the_build_fault
  • scheduler::tests::an_acquire_whose_builds_keep_failing_gives_up_naming_the_fault
  • first_open::tests::a_give_up_while_builds_fail_names_the_last_build_fault (end to end through first_open)

cargo nextest run -p decdn-client --no-fail-fast: 1196/1196 pass. cargo clippy --workspace --all-targets -- -D warnings and cargo fmt -- --check are clean.

…p carries the last fault

A lane build that keeps failing logged every fault at DEBUG, so an RPC
outage during pool open or reuse looked like a silent stall to a monitor
that filters on WARN. The build fault now logs at WARN once its
provider's retry wait reaches BUILD_RETRY_CAP (the sixth failure in a
row), and DEBUG below it. The backoff bounds the line to one per 30 s per
provider.

A fetch that gives up while a lane build is failing carries the last
build fault as LastBuildFault context on its GaveUp, so the give-up names
what kept failing; downcast_ref::<GaveUp>() still finds it.

The observability ADR now states how the client bounds its
provider-triggered WARN lines without a per-cause throttle.

Closes #2371
Copilot AI balanced review requested due to automatic review settings November 26, 2026 17:41

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-code-quality

github-code-quality Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: Rust, Solidity

Rust / code-coverage/cargo-llvm-cov

main d769020 fix/2371-build-fault... 24f7b5a +/-
78% 78% 0%
View coverage of the 7 most impacted files.
File main d769020 fix/2371-build-fault... 24f7b5a +/-
crates/client/s...c/source_set.rs 91% 91% 0%
crates/node/src...s/client/mod.rs 89% 89% 0%
crates/client/src/lib.rs 89% 89% 0%
crates/node/src...gin/pull_leg.rs 84% 84% 0%
crates/client/src/fault.rs 94% 94% 0%
crates/protocol/src/framing.rs 92% 93% +1%
crates/client/s...c/first_open.rs 90% 92% +2%

Solidity / code-coverage/forge

main d769020 fix/2371-build-fault... 24f7b5a +/-
93% 93% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 27, 2026 23:39 UTC

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.

🟡 Changes recommended

The observability documentation omits cooldown exceptions and misstates the 30-second warning bound, which applies per SourceSet while concurrent fetches emit independently.

2 open issues

Review effort: Balanced

Comment thread adr/appendix-observability.md Outdated
Comment on lines +395 to +397
**Provider-triggered warnings in the client.** The client (`decdn-client`) runs in the CLI and on the upstream leg of the node, so a remote provider can also fire client `WARN` lines. The client has no per-cause throttle. Its backoffs bound these lines:

- A lane fault logs at `WARN` when the fault is a source fault or a fatal fault. A source fault cools its provider for 2 s. Each further fault in a row doubles the cooldown, up to 60 s. A cooling provider starts no new stream. A verified byte resets the streak, so a provider can fire a faster line only after it serves paid bytes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in f3b5884. The bullet no longer says a faster line needs paid bytes. It now lists the three exceptions: streams already running can still fault; a decline that leaves the hash does not cool the provider, though declined stops new starts for that hash; and a successful first open resets the streak with no payload bytes.

Comment thread adr/appendix-observability.md Outdated
**Provider-triggered warnings in the client.** The client (`decdn-client`) runs in the CLI and on the upstream leg of the node, so a remote provider can also fire client `WARN` lines. The client has no per-cause throttle. Its backoffs bound these lines:

- A lane fault logs at `WARN` when the fault is a source fault or a fatal fault. A source fault cools its provider for 2 s. Each further fault in a row doubles the cooldown, up to 60 s. A cooling provider starts no new stream. A verified byte resets the streak, so a provider can fire a faster line only after it serves paid bytes.
- A lane build fault is chain-side. It logs at `DEBUG` until the retry wait of its provider reaches the 30 s cap, at the sixth failure in a row. From then on it logs at `WARN` with `provider`, `failures`, and `error`. The backoff holds the provider to one build per 30 s, so the line repeats at most once per 30 s per provider. A lane that builds resets the count.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in f3b5884. The ADR line and the comment at the log site now give the bound as one line per 30 s per provider within one fetch. Each fetch has its own backoff, so concurrent fetches, such as bundle entries, log independently.

@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

…ource set

Each provider keeps its own last build fault beside its build backoff, so
a build that succeeds clears only its own provider. A give-up names the
provider with the most failures in a row, and only once that count
reaches BUILD_RETRY_WARN_AT, so a one-off failure is never named as what
kept failing. The context drops the repeated LaneBuildFault prefix and is
crate-private until the CLI reads it.

The ADR and the log-site comment scope the backoff bound to one source
set: a blob fetch uses one set for its size open and one for its drive.

@alpergundogdu alpergundogdu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The WARN threshold, the reset on success and the caller compatibility all check out. Three changes before merge:

1. A plain {} of a give-up must still read as the stop line. give_up wraps GaveUp in a LastBuildFault context, and anyhow shows only the outermost context for {}, %err and to_string(). An SDK user logging {err} then sees "lane builds for 0x... failed 6 times in a row: ..." and loses "no progress for Xm; rerun to resume". Please make LastBuildFault's Display start with the give-up itself (for example "gave up while lane builds for 0x... kept failing: ..."), or carry the GaveUp text in it, so a bare {} still says the fetch stopped and can be rerun.

2. Name a build fault only when it explains the stall. give_up (crates/client/src/source_set.rs ~L697) picks the provider with the most failures from all of build_retry, and nothing removes an entry when a provider leaves the holder set or declines. So if A's builds fail 6+ times and A then leaves, while B holds a lane whose streams stall, the give-up blames A's fault and the operator chases the wrong cause. Please:

  • attach LastBuildFault only when self.lanes is empty (no working lane), and
  • consider only providers still in the holder set and not declined.

Add a test for each: a provider no longer held is not named, and no fault is named while a lane exists.

3. Nit: log_build_fault sanitizes the fault chain a second time. lane_built already stored the sanitized text in BuildRetry.fault, so read it from there.

…erve

The context text ends with the give-up's own, so a plain {} of the error
still says the fetch stopped and a rerun resumes. A provider that declined
the blob or is marked absent is never named, and its lane does not count
as one that can serve. log_build_fault reads the fault lane_built stored.
@yigitdot

Copy link
Copy Markdown
Contributor Author

All three addressed in 24f7b5a.

1. Plain {}. LastBuildFault now carries the GaveUp, and its text ends with the give-up's own: lane builds for 0x… failed 6 times in a row (<fault>); no progress for 10m; rerun to resume. A bare {} still says the fetch stopped and a rerun resumes. sanitize_err_chain drops a layer whose text the previous layer ends with, so the logged chain names the give-up once. The test checks both. (anyhow's own {:#} repeats the give-up text once; nothing in the tree logs it that way.)

2. Only a fault that explains the stall. give_up names a build fault only when no built lane can serve, and only for a provider that has not left the blob. A provider leaves when it declines or is marked absent. Note: holders never shrinks (merge only adds or updates), so declined/absent is how a provider stops being a source. A lane whose provider left does not count as one that can serve. New tests: a_give_up_names_no_build_fault_while_a_lane_is_built and a_give_up_does_not_name_a_provider_that_left. The ADR bullet says the same.

3. Nit. log_build_fault(provider) reads the stored BuildRetry.fault. build_failures is now test-only.

This branch has not been deployed

No deployments
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.

client: persistent chain-side faults never reach WARN

3 participants