Repository navigation
Fix Seer billing for empty questions - #59
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Tool Seer gates billed PAYG credits (or consumed the free tool-seer instance) before routes returned 400 for a missing question. Main Seer had the same leak for whitespace-only messages. Reject empty input before consumeBillingAction. Co-authored-by: Andy Oliver Rozario <andyrozario7@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Aug 27, 2026
3 of 8 tasks
This branch was successfully deployed
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.
What changed
enforceToolSeerGatebefore rate-limit andconsumeBillingAction, so PAYG credits and free tool-seer instances are not spent on 400s.messagevalues before debitingmain_seer.Why this change is safe
blockSeerQuestionIfNeededreturns null for"") so the route could return 400, but billing was later added inside the gate before that 400.Bug and impact
Authenticated PAYG user (or first free tool-seer use) posts
{"userId":"<own uid>","question":""}to any/api/ask-*-seerroute. The gate billed 1 credit (or burned the free instance), then the route returned 400. Whitespace-only Main Seer messages had the same leak. A client retry loop could drain a credit pack without any LLM call.Verification
pnpm exec eslinton touched files (0 errors).pnpm test tests/unit/enforceToolSeerGate.test.ts— 6/6 including new empty/whitespace no-bill cases.pnpm test— 69 suites / 382 tests passed.pnpm run securitypassed (audit + security lint).Regression prevention
consumeBillingAction.consumeBillingActionafter the gate.Release checklist (solo-friendly)
CI / Lint + JestCI / Playwright smokemain.Note
Does not duplicate open #24–#58. Those cover regen lock/hash billing, cache IDORs, and on-demand persist races. LLM-failure refund after a valid question is still unfixed by design.