Skip to content

fix(x402): do not silently flip HTTP method on 404 - #1405

Open
SashaMIT wants to merge 1 commit into
coinbase:mainfrom
SashaMIT:fix/x402-no-silent-method-flip
Open

fix(x402): do not silently flip HTTP method on 404#1405
SashaMIT wants to merge 1 commit into
coinbase:mainfrom
SashaMIT:fix/x402-no-silent-method-flip

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 6, 2026

Copy link
Copy Markdown

Summary

make_http_request retried a 404 with the HTTP method flipped (GET becomes POST, POST becomes GET) and the caller's body attached. On services that map both methods to one path (common in REST APIs, e.g. GET /items/123 vs POST /items), that silently converts an intended read into a write the agent never chose to make. For an agent framework, silent method mutation is an integrity hazard: the model asked for a read, the tool executed a write.

Fix

Return the 404 with a hint naming the method tried, so switching methods becomes an explicit agent decision:

The service returned 404 for GET. If it expects a different method, call this action again with that method explicitly.

Test plan

  • New regression test: 404 on GET produces exactly one request, method unchanged, hint returned
  • Full x402 suite passes (22/22); tsc --noEmit, eslint, prettier clean

Made with Cursor

make_http_request retried a 404 with the method flipped (GET becomes
POST, POST becomes GET) and the caller's body attached. On services that
map both methods to one path, that converts an intended read into a
write the agent never chose to make.

Return the 404 with a hint naming the method tried, so the agent retries
with a different method only as an explicit decision.

Made-with: Cursor
@SashaMIT
SashaMIT requested a review from murrlincoln as a code owner August 6, 2026 16:35
@cb-heimdall

Copy link
Copy Markdown

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants