Do not charge for empty HTTP agent searches - #203
Merged
Merged
Conversation
Build the filtered shortlist before metering and return empty results at zero cost. Preserve completed payment recovery and normal nonempty search charges. Cover money, sandbox credits, trust cutoffs, and cached recovery; give payment protocol fixtures actual matching supply.
The bot-updated branch has successful dispatched CI, but GitHub still shows all twelve required checks as Expected. Trigger the ordinary authenticated push checks with the exact same tree; preserve protection and the normal ship/deployment gate.
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.
HTTP
/searchcurrently charges even when no agent matches the capability or every match falls belowmin_trust. Build the filtered shortlist before metering and return the existing empty response withX-Guild-Cost: 0. Nonempty results keep the existing price, demand recording stays free, and completed paid responses are recovered before checking current supply. Empty searches use a separate event rather than a paid-operation completion.Validation: 262 focused tests passed, including 16 regressions across JSON and SQLite for empty searches, payment credentials, sandbox balances, trust filters and completed-response recovery. Payment-protocol fixtures now provide matching suppliers so they continue to exercise charging. Full storage suites and official x402-client compatibility are covered by CI.
Release uses the existing protected ship workflow and deployment gate.