Repository navigation
fix(node): don't tar honest providers' reputation for buyer-side pull failures (#857) - #882
Conversation
… failures (#857) The node→node cache-miss pull path classified every non-HashMismatch / non-BlobTooLargeClaim stream_fetch error as Outcome::Unreachable, which folds a 0.0 sample into the local EWMA score AND emits a gossiped uptime_observed: Some(false) report. Two of those errors are the buyer's own fault, not the provider's: a local pull_timeout and an upstream voucher rejection (our stale nonce / deposit exhaustion). The result was a buyer systematically down-scoring and publicly defaming providers it had successfully pulled from. Mirror the existing channel-open-failure / BlobTooLargeClaim exoneration pattern: - client_requester: replace the two bare-anyhow errors with typed sentinels PullTimeout and UpstreamVoucherRejected (carrying the typed Copy VoucherRejectReason, not a stringified Debug). Narrow the ack match so only a genuine StreamError::VoucherRejected is exonerated — any other StreamError at the voucher-ack point is an upstream protocol violation and stays provider-attributable. - node_origin: downcast both sentinels in pull_from_candidate and skip the candidate without recording a reputation observation. A failure to sign/encode our OWN voucher still maps to Unreachable by design (catastrophic local fault, not routine provider mis-scoring) — documented at the catch-all arm. - metrics: add node_pull_timeout / node_pull_voucher_rejected counters so the now-silent rejections stay visible to operators. Tests: flip the stalled-candidate test (the timed-out staller now records no observation and its local score stays neutral); add a voucher-rejection exoneration test, an over-exoneration regression guard (a real post-probe transport failure must STILL score Unreachable), and a unit test pinning the downcast-after-anyhow contract. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request addresses issue #857 by introducing typed sentinel errors (PullTimeout and UpstreamVoucherRejected) to distinguish buyer-side failures (such as local timeouts and payment-side voucher rejections) from actual provider reachability or transport failures. This prevents honest providers from having their reputation unfairly penalized. It also adds corresponding metrics and extensive integration tests to verify this behavior. The review feedback suggests updating the unit tests to use root_cause().downcast_ref() to ensure that context-wrapped errors are also successfully recovered.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR fixes provider reputation mis-scoring in the node→node cache-miss pull path by distinguishing buyer-side failures (local pull timeout and upstream voucher rejection) from true provider reachability problems, preventing honest providers from being down-scored locally or via gossiped observations.
Changes:
- Introduces typed buyer-side error sentinels (
PullTimeout,UpstreamVoucherRejected) in the requester and usesdowncast_refinpull_from_candidateto exonerate providers for those cases. - Adds new operational counters for the exonerated cases (
node_pull_timeout,node_pull_voucher_rejected) to keep these failures observable despite no longer emitting reputation observations. - Updates/adds integration tests to assert: no observation/local EWMA penalty for buyer-side timeout/voucher rejection, while real transport failures still score
Unreachable.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/node/src/client_requester.rs | Adds typed error sentinels for buyer-side timeout and voucher rejection; narrows voucher-ack error matching. |
| crates/node/src/node_origin.rs | Exonerates providers on buyer-side sentinel errors (no local/gossip reputation hit) and adds a unit test to pin anyhow downcasting behavior. |
| crates/node/src/metrics.rs | Adds counters for exonerated pull timeout and upstream voucher rejection for operator visibility. |
| crates/node/tests/node_origin_pull.rs | Extends integration coverage for the new exoneration behavior and adds a transport-failure regression guard. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage reportTotal: 86.12% (was 86.13%, ● 0.00%) — 35001/40640 lines
History
|
…(PR #882 review) - serve_then_reject_voucher: bail with a clear message if the buyer stops presenting a closing voucher, instead of silently no-op'ing into a confusing timeout/EOF on the buyer side (Copilot). - buyer_side_sentinels_survive_anyhow_downcast: add a context-wrapped assertion using the SAME plain `downcast_ref` the orchestrator uses (verified anyhow walks the chain), and correct the doc comment that wrongly implied a context layer would break classification. Kept plain `downcast_ref` rather than the suggested `root_cause().downcast_ref()` so the test exercises production's actual call (Gemini). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ay (PR #882 review round 2) Low-severity polish from the second review pass (no Critical/Important found): - node_origin: note the voucher-rejection arm is intentionally reason-agnostic and that RetryLater resend is not yet wired (same terminal behavior as pre-#857), so the carried typed reason isn't mistaken for active per-reason handling. - client_requester: note that UpstreamVoucherRejected's `{:?}` Display is load-bearing for the loopback .contains("RetryLater"/"Expired") assertions. - node_origin_pull: assert the flipped stalled-candidate test leaves the voucher-rejected and corruption counters at 0, for symmetry with the voucher/transport tests (guards a timeout double-classification). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Summary
Fixes #857. In the node→node cache-miss pull path,
pull_from_candidateclassified every non-HashMismatch/ non-BlobTooLargeClaimstream_fetcherror asOutcome::Unreachable, which both folds a hard0.0into the local EWMA score and emits a gossipeduptime_observed: Some(false)report. Two of those errors are the buyer's own fault, not the provider's:pull_timeout(our deadline — possibly mis-sized), andSo a buyer systematically down-scored and publicly defamed honest providers it had successfully pulled from.
Approach
Mirrors the existing channel-open-failure /
BlobTooLargeClaimexoneration pattern (typed sentinel +downcast_ref, skip the candidate without recording a reputation observation):client_requester.rs— replace the two bare-anyhowerrors with typed sentinelsPullTimeoutandUpstreamVoucherRejected. The latter carries the typedCopyVoucherRejectReason(not a lossyformat!("{e:?}")), and the ack match is narrowed so only a genuineStreamError::VoucherRejectedis exonerated — any otherStreamErrorat the voucher-ack point is an upstream protocol violation and stays provider-attributable.node_origin.rs—downcast_refboth sentinels inpull_from_candidateandreturn Nonewith a metric + debug log, no reputation recorded. A failure to sign/encode our own voucher still maps toUnreachableby design (catastrophic local fault, not routine provider mis-scoring) — documented at the catch-all arm.metrics.rs— newdecdn_node_pull_timeout_total/decdn_node_pull_voucher_rejected_totalcounters so the now-silent rejections stay visible to operators.Per the decision on the issue, timeouts are fully exonerated (no local or gossip signal) — accepting that a genuinely stalling provider won't be deprioritized for future pulls.
Tests
node_origin_pull_falls_through_a_stalled_candidate: the timed-out staller now records no observation, and its local score stays neutral (guards a future local/gossip split).node_origin_voucher_rejection_does_not_tar_upstream: serves correct bytes, rejects the closing voucher →NotFound, empty observation buffer, neutral score, onlynode_pull_voucher_rejectedmoves.node_origin_transport_failure_still_scores_unreachable: over-exoneration regression guard — a real post-probe transport failure must still scoreUnreachable.buyer_side_sentinels_survive_anyhow_downcast: pins thedowncast_ref-after-anyhowcontract at the boundary.Review
This PR incorporates findings from a multi-agent review pass (narrowed the over-broad
StreamErrormatch, switched the carried reason to the typed enum, added the over-exoneration + local-score + downcast tests, corrected a doc over-claim).Verification
```
cargo build -p decdn-node && cargo clippy -p decdn-node --all-targets
cargo nextest run -p decdn-node # 593 passed, 0 skipped
cargo fmt -- --check
```
🤖 Generated with Claude Code