Print x402 settlement and Bazaar status - #1493
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2fab519caf
ℹ️ 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".
| req.Header.Set("Authorization", h) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Run gofmt on the changed client
The closing brace is misindented, and gofmt -l service/wallet/x402client.go reports this file. The repository's CI explicitly fails whenever gofmt -l . produces output, so this commit cannot pass CI until the file is formatted.
AGENTS.md reference: AGENTS.md:L170-L175
Useful? React with 👍 / 👎.
| } | ||
| fmt.Println(out) | ||
|
|
||
| if out.Settlement != nil { |
There was a problem hiding this comment.
Report extension status independently of settlement
When a paid retry returns EXTENSION-RESPONSES but omits or malforms PAYMENT-RESPONSE, PayAndCallMCPWithReceipt preserves the extension response while this outer condition suppresses it. That makes the Bazaar acknowledgement invisible precisely when the three outcomes are meant to be diagnosed independently; print the extension status outside the settlement-only branch.
Useful? React with 👍 / 👎.
| if err := json.Unmarshal(raw, &settle); err != nil { | ||
| return nil | ||
| } | ||
| return &settle |
There was a problem hiding this comment.
Reject unsuccessful receipts before reporting settlement
If an x402 server returns a valid SettleResponse with success:false, this parser still returns a non-nil settlement, causing the CLI to print settled: even though the payment failed. Validate settle.Success (and surface its failure reason) before treating the response as proof of settlement.
Useful? React with 👍 / 👎.
Why
We need to distinguish three different outcomes when testing M3O Bazaar discovery:
EXTENSION-RESPONSESacknowledgement for BazaarUntil now
mu x402 callprinted only the tool result, so a successful paid call gave no visibility into settlement or discovery status.What
PayAndCallMCPWithReceipt, preserving the existingPayAndCallMCPtext-only APIPAYMENT-RESPONSEinto the settlement transaction/networkEXTENSION-RESPONSESwhen presentmu x402 callprint settlement details and extension status before the tool resultprocessingresponseIf the server does not expose
EXTENSION-RESPONSES, the CLI saysextensions: none returned by serverexplicitly rather than silently hiding the missing diagnostic.