Skip to content

x402 settlement race is still reachable: only the fast paid-data tools are serialized #89

Description

@VickyXAI

serializePaidRequest (added 0.33.0) covers markets, surf, exa, search, rpc, defi, and paid price. Everything else that spends from the same wallet still fires concurrently: chat, image, video, music, speech, modal, phone.

So the failure it was added to prevent — two concurrent x402 authorizations from one wallet racing at the settlement layer, one otherwise-funded call getting rejected — is still reachable across any media/chat call overlapping a data call.

This was a deliberate scope choice, not an oversight. The excluded tools are long-running: video and music are 60–180s, image and modal tens of seconds, chat streams. Queueing a 5ms price lookup behind a 3-minute video render trades a rare failure for a guaranteed stall. Extending the queue is the wrong fix.

The real fix belongs at the wallet/nonce layer in @blockrun/llm — serializing authorization construction while leaving request execution concurrent. That is where the nonce is chosen, and it is cheap to hold a lock for.

Recorded because the current state is documented only in a comment in src/utils/payment-serialization.ts, which is where things go to be forgotten.

Related: BlockRunAI/blockrun-llm-ts#19 (the Solana side of the same problem).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions