fix(gateway): reconcile enforced receipts from failed executions - #51
Merged
Conversation
tangletools
approved these changes
Sep 9, 2026
tangletools
left a comment
There was a problem hiding this comment.
Independently reviewed the failed-receipt dispatch, settlement, and A2A recovery changes at this exact head. Validated usage is forwarded before the terminal execution error; durable settlement preserves measured receipts across acknowledgement loss. A2A clears only reconciled recovery markers and retains failed task status. Reviewed the composed test against registry agent-app 0.47.6 and the receipt-removal mutation evidence. Both configured CI runtimes passed 498 tests. These are synthetic transport/payment fixtures, not a claim of live provider or paid-customer proof. No blocking findings.
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.
A sandbox error could discard an authoritative receipt emitted after paid inference. Payment cleanup then retained the quote despite having measured usage.
Validate and forward enforced usage before terminal protocol errors, then settle the measured amount while preserving OpenAI errors and failed A2A tasks. Missing or unenforced receipts retain ownership under the existing recovery policy. Settlement acknowledgement failures preserve the durable measured receipt. Ordinary finalization failures keep their existing recovery behavior.
Validation: 498 tests pass on Node 24.18.0 and 22.22.2; typecheck and build pass. New coverage exercises OpenAI JSON/SSE, both A2A methods, real SQLite capped-key reservations, acknowledgement-loss recovery, and published agent-app 0.47.6 with the maintained Runtime producer, persisted chat route, and gateway bridge. Removing the failed-receipt handoff fails the composed regression.
All remote inference and payment effects use synthetic callbacks. The tests establish local accounting and protocol behavior, not external payment transfer or live provider enforcement. Version 0.11.1 contains this correction.