Probe sample envelope always carries resource; thread extensions - #109
Merged
Conversation
…p to 2.9.0 x402 v2 envelope validators (mppx, and the shared discovery engine behind x402scan and MPPScan) refuse a PAYMENT-REQUIRED header without a resource block, so a discovery-probe sample that omitted it read as 'no valid x402 response' on every probe-configured merchant however correct its accepts were. The same engines read the Bazaar extension's example input to build valid bodies for their follow-up probes, so a probe without extensions got re-probed with junk bodies and the merchant's validation answers (400/404) were reported as paywall failures. - buildDiscoveryProbeResponse: the sample envelope now always carries a v2 resource (explicit resource, resourceUrl shorthand, or synthesized from the realm) and threads optional extensions into the header and body. - Checkout: when discoveryProbe is configured with an x402Sample, the sample inherits resource (checkout url + resourceInfo) and enriched Bazaar extensions from discoveryExtensions; explicit values still win. - Tests pin all three resource sources, the extensions passthrough, and the Checkout inheritance; README/CLAUDE.md document the behavior. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
x402 v2 envelope validators (mppx, and the shared discovery engine behind x402scan and MPPScan) refuse a PAYMENT-REQUIRED header without a
resourceblock, so a discovery-probe sample that omitted it read as "no valid x402 response" on every probe-configured merchant, however correct its accepts were. The same engines read the Bazaar extension's example input to build valid bodies for their follow-up probes, so a probe withoutextensionsgot re-probed with junk bodies and the merchant's own validation answers (400/404) were reported as paywall failures.buildDiscoveryProbeResponse: the sample envelope now always carries a v2resource(explicitresource, theresourceUrlshorthand, or synthesized from the realm, with an http-prefix guard) and threads optionalextensionsinto both the header and the body mirror.Checkout: whendiscoveryProbeis configured with anx402Sample, the sample inheritsresource(the checkout's ownurl+resourceInfo) and enriched BazaarextensionsfromdiscoveryExtensions; explicit values still win.Type of change
Public API
DiscoveryProbeConfig.x402SampleandbuildDiscoveryProbeResponse'sx402Samplegain optionalresourceandextensionsfields. No caller migration needed: existing configs keep working, and their emitted probes gain theresource(and, underCheckout, the inheritedextensions) that validators require. The real 402 path is untouched.Test plan
New tests: probe emits resource from all three sources (explicit, resourceUrl, synthesized) and mirrors it in the body; extensions thread into header and body; Checkout inheritance test (resource from url+resourceInfo, extensions from discoveryExtensions).
bun run test(1817 passed),bun run typecheck,bun run lintall green locally. Deployed-path smoke with mppx validate and the @agentcash/discovery engine follows the consumer bumps in each store repo, this session.Checklist