Skip to content

Payer keeps paying ahead past a steal split until the reader reaches it #2902

Open

Description

@yigitdot

Found in the PR #2877 review (#2877 fixes the other credit-liveness bugs; this one is deferred because the fix needs new plumbing).

What happens. A steal lowers the leg's end by writing stop_at (an AtomicU64 the store's ingest_stream reads, crates/client/src/driver.rs ~1294-1317). Nothing lowers the pull's pay-ahead target: UpstreamPull.expected_wire_bytes stays at the original range, so need = expected_wire_bytes − cumulative and pay_ahead_due keep paying toward bytes the reader will stop consuming at the split. stop() then correctly pays nothing more and leaves the credit on the lane (crates/client/src/lib.rs stop() doc), but up to one window of prepaid credit can be stranded per steal — recovered only if the same lane pulls again, and counted in NodeTrust.outstanding meanwhile. ADR 003 § Credit Window says the payer stops paying ahead before it ends a stream it controls; today it stops only at the split.

Impact. Bounded: at most one pay-ahead window per steal, not lost (lane credit), released from outstanding when the ledger retires (PoolLedger::drop). Multi-source fetches with frequent steals over-front transiently.

Fix sketch. Plumb the leg's stop_at (or a clamped wire-length watch) into UpstreamPull so need is computed against the lowered end: e.g. open_progressive_pull takes an optional Arc<AtomicU64> content-end, and need uses served_wire_len(byte_offset, stop_at − byte_offset, total) when it is below the original end. Public-API change (snapshot crates/client/tests/snapshots/public_api__public_api.snap moves). The comment at driver.rs ~1294 should then say the pull itself stops paying at the lowered end.

Activity

  1. added
    kind:bug
    area:client
    area:payments
    design:consistency
    prio:low
    on Nov 15, 2026
  2. yigitdot commented on Nov 17, 2026

    @yigitdot
    ContributorAuthor

    This issue is blocked on #2877. The code it describes (pay_ahead_due, NodeTrust and the payer window) exists only on the #2877 branch and not on main (116f9e9). The bug becomes reproducible on main when #2877 merges. If #2877 closes unmerged, this issue closes with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clientarea:paymentsdesign:consistencykind:bugprio:low

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions