Repository navigation
fix(lore-0046): answer rpc_unavailable when /settle's checks get no answer - #159
Merged
Merged
Conversation
…nswer /settle runs the same checks as /verify before it claims. An RPC that gave them no answer was a thrown error, so /settle answered 500 while /verify now answers 503 for the same outage. It now answers its own settle_exact_stellar_rpc_unavailable in an x402 body, with nothing claimed, so the same payment may be sent again. Co-Authored-By: Claude <209825114+claude[bot]@users.noreply.github.com>
2 of 3 tasks
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.
Summary
/settleruns the same checks as/verifybefore it claims a payment. When the RPC gave those checks no answer,/settleanswered 500, while/verify(#152) answers 503rpc_unavailablefor the same outage./settlenow answers in an x402 body with the reason it already has for an RPC outage.settle(payload, requirements) checked = check(payload, requirements) OutOfTimeError -> settle_exact_stellar_timeout, nothing claimed + UpstreamTimeoutError -> settle_exact_stellar_rpc_unavailable, nothing claimed + RpcUnavailableError -> settle_exact_stellar_rpc_unavailable, nothing claimed anything else -> thrown: 500 internal_errorinternal_errorsuccess: false,settle_exact_stellar_rpc_unavailable, no recordinternal_errorUnchanged: the reason already answers RPC failures after the claim, and it is one of the "nothing sent" reasons, so a seller may repeat the same payment. Upstream's
unexpected_verify_errorin the checks stays a 500./verifydoesn't change here.Evidence
settle.test.ts"answers rpc_unavailable without claiming when the checks' RPC gave no answer", one case per error class: 2 failed, the error thrown out ofsettle().settle.test.tsandsettle-route.test.ts177 of 177. The whole facilitator suite: 1006 passed, 3 skipped. Typecheck,pnpm lintandformat:checkpass.Not run: the MCP e2e or a real RPC outage. The test throws the error from a stubbed check.
Considered and rejected
/verify's —/settleanswers every outcome in an x402 body (AD-6), and the reason already exists.unexpected_verify_errortoo — upstream also gives it for a strange payload, so "repeat the same payment" could repeat forever.Merge Danger
Door: two-way
Revert the commit.
Blast Radius: API
A seller that read a 500 from
/settlein an outage now reads a 200 withsuccess: falseand a reason. Sellers on@x402/coretreat both as a failed settlement. Thehttp-500alarm stops firing for this case;/settlefailures with this reason show in the settled logs.🤖 Generated with Claude Code