# Class BSV::Wallet::Engine::Reaper <a id="class-BSV-Wallet-Engine-Reaper"></a>

**Inherits:** `Object`
**Includes:** `BSV::Wallet::Engine::OmqSupport`

Background reaper — logical model for walletd (#325 / #326).

Reclaims abandoned actions: inputs locked but never carried to a terminal
state (a crash between `lock_inputs` and `sign_action`, an abandoned
funding-loop top-up). Deleting the action cascades its `inputs` rows,
releasing the locked UTXOs back to the spendable set. Promoted actions are
protected; the internal `no_send` path is left to #327.

Follows the same discovery → PULL → `process` shape as Engine::Broadcast and
Engine::TxProof, so it participates in the Scheduler's cooperative drain (one
<code>task.dispatched</code> + one terminal event per action) and rides the
same OMQ seam rather than being a bespoke loop.

## Constants
### `ENDPOINT` <a id="constant-ENDPOINT"></a> <a id="ENDPOINT-constant"></a>
Not documented.

## Public Class Methods
### `pending(store, limit:, threshold:)` <a id="method-c-pending"></a> <a id="pending-class_method"></a>
Discovery side, called by the Scheduler loop — mirrors
<code>Engine::Broadcast.pending_submissions</code> etc.
- **@param** `store` [BSV::Wallet::Store]
- **@param** `limit` [Integer] max IDs per pass
- **@param** `threshold` [Integer] staleness age in seconds
- **@return** [Array<Integer>] stale action IDs

## Public Instance Methods
### `initialize(store:)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
- **@param** `store` [BSV::Wallet::Store]
- **@return** [Reaper] a new instance of Reaper

### `process(action_id)` <a id="method-i-process"></a> <a id="process-instance_method"></a>
Reap one action. Emits exactly one <code>task.dispatched</code> on entry, then
exactly one terminal event: <code>task.succeeded</code> when reclaimed,
<code>task.skipped</code> when the action advanced past reapability since
discovery, <code>task.failed</code> on error. The single-dispatched/single-
terminal pairing is the Scheduler drain contract.
- **@param** `action_id` [Integer]

### `pull!(task:)` <a id="method-i-pull-21"></a> <a id="pull!-instance_method"></a>
Bind the PULL socket and reap each pushed action ID. Runs as a fiber in the
Daemon's Async reactor.
