Skip to content

fix(gateway): reconcile enforced receipts from failed executions - #51

Merged
drewstone merged 1 commit into
mainfrom
fix/failed-execution-receipts
Sep 9, 2026
Merged

fix(gateway): reconcile enforced receipts from failed executions#51
drewstone merged 1 commit into
mainfrom
fix/failed-execution-receipts

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

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.

@tangletools tangletools left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@drewstone
drewstone merged commit 1da5df4 into main Sep 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants