You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Payer keeps paying ahead past a steal split until the reader reaches it #2902
area:clientdecdn-client SDK: paid pull, lanes, buyer poolarea:paymentsPools, vouchers, redeem, reclaim, staking (incentive crate and chain)design:consistencyADRs, code or contracts disagree with each otherkind:bugSomething does not behave as documentedprio:lowWhen convenient
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.
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.
area:clientdecdn-client SDK: paid pull, lanes, buyer poolarea:paymentsPools, vouchers, redeem, reclaim, staking (incentive crate and chain)design:consistencyADRs, code or contracts disagree with each otherkind:bugSomething does not behave as documentedprio:lowWhen convenient
Activity
fix: address the remaining PR 2877 review findings
yigitdot commentedon Nov 17, 2026
This issue is blocked on #2877. The code it describes (
pay_ahead_due,NodeTrustand the payer window) exists only on the #2877 branch and not onmain(116f9e9). The bug becomes reproducible onmainwhen #2877 merges. If #2877 closes unmerged, this issue closes with it.docs(adr)!: the payer fronts credit (#2877)