Skip to content

node: buyer voucher progress is never persisted (record_progress has zero production callers) — every reused buyer channel signs stale vouchers and repeat pulls fail #852

Closed

Description

@thiras

Severity: HIGH — from the 2026-06-10 full-repository review (#834 surface). Two independent reviewers converged on this finding.

Location

  • crates/node/src/buyer_channel.rs:450 — record_progress exists but is called from nowhere in production (grep: only tests/anvil_settlement_e2e.rs:815)
  • crates/node/src/node_origin.rs:382-405 — pull_from_candidate calls stream_fetch and returns the bytes on success without recording voucher totals
  • crates/node/src/client_requester.rs:291,304-347 — self_pay advances nonce/bytes/amount only in locals; stream_fetch returns only Bytes, discarding them

Scenario

First cache-miss pull to provider X opens a channel (prior_* = 0), pays vouchers nonce=1..N; the upstream advances its accepted-voucher watermark to those totals. The buyer's persisted BuyerChannelState.last_* stays at the open-time zeros. The channel is reused per-provider (~90 days, try_reuse_live fast-path). The next pull rebuilds ChannelContext::for_buyer_channel from the stale stored state and re-signs nonce=1 with regressed cumulative bytes_delivered → upstream rejects (StaleNonce/BytesRegression) → delivery aborts at the first voucher boundary. Same shape after a node restart.

Over time every previously-used provider becomes permanently unusable for this buyer until channel expiry — the headline #834 feature works exactly once per provider. (top_up is likewise uncalled, so deposit exhaustion has the same terminal shape.)

Knock-on: each self-inflicted rejection is recorded as a negative reputation observation against the honest provider (filed separately).

Not a duplicate

#838 is a read-modify-write race between top_up and record_progress calls; this is that record_progress is never called at all. #763 is the unpersisted-open orphan deposit. #746 (closed) is the integration test ask.

Fix direction

Have stream_fetch report the final signed (nonce, bytes_delivered, amount) (return value or progress callback), and have pull_from_candidate call record_progress after every stream — including failed streams that sent ≥1 acked voucher. Expose it on the ChannelOpener seam.

Activity

  1. added
    kind:bug
    prio:high
    rust
    on Jun 10, 2026
  2. github-actions commented on Jun 10, 2026

    @github-actions

    🎯 Triage report

    record_progress has exactly zero production callers (only anvil_settlement_e2e.rs:815 in tests). Consequently, BuyerChannelState.last_* is never updated after a stream, so every channel reuse re-signs from nonce=1 with regressed cumulative bytes — the upstream provider rejects with StaleNonce/BytesRegression and the channel becomes permanently unusable until expiry. The #834 payment-channel feature effectively works once per provider. A secondary knock-on is that each self-inflicted rejection produces a false negative reputation event against the honest provider (tracked separately).

    📊 Assessment

    Dimension Value Reasoning
    Type Bug Missing call site causes systematic data loss and feature failure
    Labels technical, poc-blocking added (existing bug, high, rust retained) Core channel reuse broken; PoC can't ship with payment channels working only once per provider
    Coding agent Suitable Precise file:line anchors, concrete fix direction, self-contained scope; main complexity is safely threading final voucher state out of stream_fetch without regressing the API

    🔗 Similar issues

    💡 Notes and suggestions

    Root cause in one sentence: stream_fetch returns only Bytes and discards the final signed voucher state; pull_from_candidate and self_pay never see the final (nonce, bytes_delivered, amount) to persist.

    Fix checklist:

    • Change stream_fetch return type (or add a progress callback) to surface the final signed (nonce, bytes_delivered, amount) after each successful or partially-acknowledged stream
    • Have pull_from_candidate (node_origin.rs:382-405) call record_progress on the channel after the stream, including failure paths where ≥1 voucher was already acked (look for the partial-ack completion signal)
    • Have self_pay (client_requester.rs:291,304-347) do the same — it advances nonce/bytes/amount in locals only today
    • Expose the final voucher state on the ChannelOpener seam so callers outside the channel-service boundary can invoke record_progress without holding the service's internal lock
    • Wire top_up call site (also currently uncalled) in the same pass — deposit-exhaustion failure has the same terminal shape
    • Add a regression test: open channel, stream, restart node (or re-load from store), stream again to the same provider — assert second stream succeeds and the persisted watermark matches

    Interaction with #838: fixing #838's RMW race is a prerequisite for safe concurrent record_progress + top_up calls once both are wired; sequence the fixes accordingly or land them together.

    Reputation damage: the false-negative reputation events against honest providers caused by self-inflicted StaleNonce rejections should be verified fixed or tracked as a follow-up once this is resolved.

    Generated by Agentic Triage for issue #852 · sonnet46 550.2K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

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

Metadata

Metadata

Assignees

Labels

kind:bugprio:highrust

Type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions