mcp: require prepared send intents#1027
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP wallet payment process into a two-phase flow by splitting the single send tool into send.prepare (which validates and returns a send_intent_id) and send (which dispatches the payment using the intent ID). This change is documented across several markdown files and is supported by new unit tests. The review feedback suggests adding nil checks for the client interface in both prepareMCPWalletSend and dispatchMCPWalletSend to prevent potential nil pointer dereference panics, especially during testing.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd314a0942
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Advertise the two-phase send schemas explicitly. Reject disabled wallet clients instead of allowing handler-time nil dereferences.
Addresses P0-5 from #997.
Before:
sendcall accepted payment parameters, prepared the payment, and immediately dispatched itAfter:
send.prepareaccepts payment parameters, validates them, and returns the daemon's exact preview plus a short-lived single-usesend_intent_idsendaccepts onlysend_intent_id, consumes the already prepared intent, and may move fundssend.prepareas MCP-only and advertises the distinct MCP parameters forsendConcrete consequence: MCP agents must observe the resolved transaction before authorizing dispatch, and the final call cannot silently substitute a different destination, amount, rail, or fee limit.
This reuses the daemon's existing send-intent mechanism; it adds no new persistence or approval subsystem.
Validation:
make unit pkg=./cmd/wavecli/...go test ./cmd/wavecli/... -racemake lint-changed-localmake commitmsg-lint range="origin/main..HEAD"This PR is independent from the other #997 slices and targets
main.