You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
api agent: pre-flight prompt-size cap, and a distinct exit code when --max-cost is exceeded #32
Two suggestions from a reader (Peter) on the DEV.to cost-per-run article, which I said I would write up here.
1. Pre-flight prompt-size cap for the api agent
The api agent sends the brief plus target content to the model. A large target can produce a very large prompt, and the cost is only known after the call.
Proposal: estimate the prompt size before sending and refuse (or warn) if it exceeds a configurable limit, for example a --max-input-tokens flag or a config value. The failure message should say how large the prompt was and which limit applied.
2. Distinct exit code when the budget is exceeded
--max-cost and --fail-on both feed CI exit codes. A CI job cannot currently tell "the scan ran and found issues" apart from "the scan was stopped because the cost ceiling was hit".
Proposal: use a dedicated exit code for budget exceeded, separate from the findings code and the generic error code, and document it next to --max-cost.
Why it matters
Both changes make cost ceilings usable as a real guard in CI, which is the main reason to track cost per run.
Happy to work on a PR for either if the approach sounds right.
Activity
karthickmk2001 commentedon Nov 11, 2026
I'd like to take this. Working on it now; a PR will follow.
Merge pull request #86 from secfoo-com/fix/32-api-prompt-size-cap