Repository navigation
Conversation
vishkaty
force-pushed
the
proposal/checkout-revalidation
branch
from
September 18, 2026 13:15
b3cfe06 to
8b7f9b9
Compare
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.
Reference implementation available (2026-09-18): the implementation this note describes is published in https://github.com/vishkaty/commerce-agents-medusa (a Medusa v2 backend and host), checked by https://github.com/vishkaty/commerce-agents-conformance. Issues and pull requests are taken there; this draft stays as the design note.
Proposal: cart re-validation at checkout
The gap
checkoutrenders the cart the backend returns and putscheckout_handoff's URL on thecard. Between the card and the payment, a line can sell out or move in price; on a live
platform (Medusa v2) a cart line keeps its add-time price after the merchant reprices,
so the card and the hosted checkout charge a stale price. The contract says nothing
about re-validation and no example backend re-validates. When a handoff does raise
Unavailable, the executor relays it (domain_errorinshopping_agent/executor.py),but with the add-to-cart wording, "Nothing was added: … add that only once they choose
it", which misdescribes a checkout refused because the cart went stale.
What this adds
docs/backends.md,checkout_handoff: "re-validate every line against the livecatalog before returning a URL; a line that can no longer be fulfilled raises
Unavailablenaming it; a line whose price moved is refreshed and reported so thenext checkout shows what will be charged."
enrich_checkoutcatchesUnavailablefrom the handoff and raisesPresentationRefusedwith its message, so the refusal is worded for a checkout (thecart, not an add).
matches the cart's total at completion; otherwise hold it for review.
Reference implementation
Done over Medusa v2 in a lab adapter:
_revalidate(sold out, short, repriced), aCartStale(Unavailable, ValueError), whichrun_presentationrelays with its ownwording today, and a host that holds a mismatched payment. Verified live with a repricing between add and pay.
Correction, 2026-09-18. An earlier version of this note said the executor reports a
handoff
Unavailableas an outage. It does not:BaseToolExecutor.executepasses itthrough
domain_error, which relays it with the add-to-cart wording (checked by runningcheckoutatfd4d592over a backend whose handoff raisesUnavailable). The review inSanHsien's fork (
docs/DECISIONS.mdthere) caught it; the design note is corrected above.Opened as a draft: this is a design note for discussion before code is written against the interface. A reference implementation exists and can follow as a pull request in the agreed shape.