Skip to content

fix(client): a late lane build's untracked escrow is dropped at debug by drain_builds #2500

Closed

Description

@thiras

Problem

drain_builds (crates/client/src/scheduler.rs) discards a fatal EscrowUntracked error. The error is logged at debug only, and the command exits 0.

When acquire returns, it waits up to BUILD_DRAIN (30 s) for lane builds still in connecting. A late build can finish refill_if_low (or a lane-build openPool) in that window. When it does:

  1. The topUp mines and its receipt is read. top_up releases its UnconfirmedEscrows entry.
  2. store.add_deposit fails (or store.record for an open). grade_deposit_credit returns EscrowUntracked, which fault::classify grades Fault::Fatal.
  3. drain_builds logs that error with tracing::debug!("a lane build that ended after the fetch failed") and drops it.

The USDC is now escrowed with no local record. The handle does not hold the tx, because its receipt was read. Nothing names the tx. CLI tracing is opt-in, so the user sees nothing, and decdn get exits 0. The low-water check then fires again on later fetches, while nobody reconciles the escrow.

A build that is still waiting for its receipt at the 30 s bound is a different case. It is dropped, and #2491 names it through the handle.

Fix direction

  • drain_builds returns the first drained error that fault::classify grades Fault::Fatal.
  • acquire folds that error into its result:
    • on an Ok, the error replaces it;
    • on an Err, the error is added as context, so the fatal escrow is not hidden.
  • Other drained errors stay at debug.

Checks

  • A late lane build whose refill mines and whose add_deposit fails turns a successful acquire into an error. That error carries EscrowUntracked and names the tx.
  • A late build that fails for any other reason leaves the result unchanged.

Found in the #2499 review (silent-failure pass). This behavior existed before #2499.

Activity

  1. added
    kind:bug
    rust
    on Oct 17, 2026
  2. self-assigned this
    on Oct 17, 2026
  3. added
    area:payments
    on Oct 17, 2026
  4. assigned and unassigned on Oct 17, 2026
  5. moved this from Backlog to In progress in deCDNon Oct 17, 2026
  6. moved this from In progress to Done in deCDNon Oct 17, 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:bugrust

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions