Repository navigation
fix(solana): recover a payment from the durable ledger fetchPaid used (agent 2.12.3) - #152
Merged
Merged
Conversation
… (agent 2.12.3) Without a daily cap the agent's ledger is in memory, but fetchPaid opens the file ledger for Solana and reserves the purchase there. recoverPaidPayment in a new process read the empty in-memory ledger and failed with "Recovery disagrees with the original spending reservation", so no receipt was ever issued after SOLANA_V14_PENDING. Recovery now opens the same file ledger.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A Solana
fetchPaidchecks the signature status once, right after sending. A transaction that is not finalized yet ends inSOLANA_V14_PENDINGwith a recovery object, and the documented next step isrecoverPaidPayment.On the devnet E2E (2026-11-02) every such recovery failed with "Recovery disagrees with the original spending reservation". Without a daily cap,
this.ledgeris aMemorySpendLedger.fetchPaidopensFileSpendLedger.forAgent(...)for Solana and reserves the purchase there. A new process, or any agent instance other than the one that paid, then recovered against the empty in-memory ledger. As a result no receipt was ever issued for a pending Solana payment.Change
node/src/unifiedAgent.ts:recoverPaidPaymentfor a Solana recovery opens the same file ledger thatfetchPaiduses, unless aspendLedgeroverride was given. The fix is one line.Python is not affected: it reads the ledger from the journal path it is given.
Tests
spendLedgeroverride and no daily cap, then recovers from a freshly constructed agent. Without the fix it fails with exactly the devnet error.tsc --noEmitpasses, vitest 876/876, MCP cohort test passes, version gate passes.rcpt_aa90ab7c…for the second payment andrcpt_91b347c4…for the first. The local AIFP-1 gate answered200with the recovered receipt.Agent 2.12.3; the MCP cohort pin moves to match.
Linked surfaces