Skip to content

fix(client): a halted bundle pull can leave a pool replacement, unrun entries and a pending escrow unreported #2517

Closed

Description

@thiras

Problem

A bundle pull halts its sibling entries when one entry ends the pull, and waits for their drain (#2509). Three gaps remain at the end of such a pull.

1. A pool replacement can go unreported

replaced_pool reads only the pull's stopped error. Two cases lose the replacement:

  • A sibling replaces the pool during the drain. Entry A gives up and halts the pull. Sibling B is in a funding recovery step, which runs to its outcome, and opens a new pool. run_groups drops B's PoolReplaced, because only an untracked escrow is folded in. BundleOutcome.replaced is None, so observer.pool_replaced does not run and the CLI skips its "reclaim it with: decdn pool reclaim" note.
  • A late escrow folds over a PoolReplaced. The escrow is the root and PoolReplaced survives only as text, so replaced_pool misses it. This was noted (low) in fix(client): a bundle pull drops sibling entries mid-drain, losing a late escrow and allowing exit 75 #2509.

No funds are lost: open_replacement records the new pool before it returns. But the user is not told that the closed pool may hold a balance to reclaim.

2. Entries the pull did not run are not in the summary

A halted entry's destinations are EntryOutcome::NotRun. bundle_report does not count them, so fetched + linked + skipped + failed is less than the entry count, and neither the summary nor --json says how many entries the pull did not run.

3. A dropped entry's pending escrow reaches only the CLI

GROUP_DRAIN (40 s) is shorter than RECEIPT_TIMEOUT (3 min). An entry in a slow recovery step can still be dropped while its receipt read is pending. The UnconfirmedEscrows handle keeps the tx, and decdn get names it (name_held_escrows). But pull_end folds only untracked() into a Stopped end, so a library caller of BundlePuller gets the bare stop unless it reads BundlePuller::unconfirmed_escrows itself.

Fix direction

  1. Take replaced from the recovery gate (GateState.replaced), read before start_next_pass clears it, not from the error. Keep the second-pass trigger on a PoolReplaced stop only, so a give-up never starts a second pass.
  2. Add a not_run count to BundleReport, and print it in the summary.
  3. Fold escrows.pending() into a non-interrupted Stopped end in pull_end, as it folds untracked().

Checks

  • A pull that gives up while a sibling's step replaces the pool reports the replaced pool, and the CLI prints the reclaim note. No second pass runs.
  • A late escrow that folds over a PoolReplaced still reports the replaced pool.
  • A halted pull's summary counts the entries it did not run.
  • A BundlePuller pull that drops an entry with a pending topUp ends Stopped, naming that tx.

Found in the #2509 review (silent-failure and code-review passes).

Activity

  1. added
    kind:bug
    rust
    prio:low
    area:payments
    on Oct 18, 2026
  2. self-assigned this
    on Oct 18, 2026
  3. moved this from Backlog to In progress in deCDNon Oct 18, 2026
  4. moved this from In progress to Done in deCDNon Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:paymentskind:bugprio:lowrust

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions