fix(x402): never settle for a disconnected buyer + expose agent maxConcurrentRuns - #743
Closed
bussyjd wants to merge 2 commits into
Closed
fix(x402): never settle for a disconnected buyer + expose agent maxConcurrentRuns#743bussyjd wants to merge 2 commits into
bussyjd wants to merge 2 commits into
Conversation
Renders gateway.api_server.max_concurrent_runs into the agent's config.yaml. Nil omits the gateway block (Hermes internal default, 10); 0 disables the in-process cap so edge concurrency middleware governs instead. Existing agents render byte-identical. Part of #742. Claude-Session: https://claude.ai/code/session_014YjPMViNrZ7zBVgUQzwEKk
If the buyer's request context is already canceled when the upstream handler succeeds, do not settle — the buyer would be debited for a response nobody receives (proven on-chain against hyperliquid-analyst, see #742). Reports failure reason client_disconnected; the interceptor hijacks the write path so nothing reaches the dead socket. Fixes the propagated-cancel leg of #742. Claude-Session: https://claude.ai/code/session_014YjPMViNrZ7zBVgUQzwEKk
4 tasks
Contributor
Author
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.
Closes #742.
What
Two config/verifier-side fixes for the paid-agent path (no hermes upstream changes), root-caused from the Bankr bot's failed paid calls and validated live on base mainnet:
Agent.spec.maxConcurrentRuns— rendered asgateway.api_server.max_concurrent_runsin the agent's config.yaml. Nil omits the block (Hermes internal default, 10);0disables the in-process cap so edge concurrency middleware is the single gate. Existing agents render byte-identical (confighash suite untouched and green).client_disconnected; the interceptor hijacks the write path so nothing is written to the dead socket.Why (see #742 for the full trace)
inFlightReqmiddleware was the actually-binding external gate — two inconsistent numbers on the same path.Validation
go build ./...+ full test run:internal/monetizeapi,internal/serviceoffercontroller,internal/x402,internal/embedall green (493 PASS); new tests:TestRenderHermesConfig_MaxConcurrentRunsZero,...NilOmitsGateway,TestForwardAuth_NoSettleOnClientDisconnect(guard fires:verifyCalled=1, settleCalled=0).Note: until the controller image carrying this lands, the live hyperliquid-analyst cap-off is a hash-gated manual ConfigMap edit (flagged ConfigDrift) — any Agent CR spec change wipes it. After merge + controller roll: set
spec.maxConcurrentRuns: 0on the CR to make it durable.https://claude.ai/code/session_014YjPMViNrZ7zBVgUQzwEKk