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
Commit 3c0ec1c
Browse filesBrowse the repository at this point in the historyBrowse files
feat: stop a hosted run before static analysis when the CodeBoarding quota is spent (#712)
* feat: stop a hosted run before static analysis when the CodeBoarding quota is spent
A large repository's Action run spent many minutes on static analysis before
its first LLM call, and only then learned the free-tier quota was spent. The
hosted proxy gates every request on the caller's weekly quota before
forwarding it and meters only completions, so a GET /models through the same
client answers 402 at no token cost. bootstrap_environment now makes that one
request on hosted credentials and raises the same LLMQuotaError the runtime
path raises, so full, incremental and partial runs exit 3 with Core's message.
Any other answer lets the run go on. Own provider keys are never checked.
Replaces the Action-side probe removed from CodeBoarding/CodeBoarding-action#184.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: log the quota check's trace, report its stop, and check full runs only
- A check that gets no usable answer is logged with logger.exception, so its
traceback is kept (AGENTS.md: never lose the trace).
- A quota it finds is sent to PostHog via capture_error("quota_check"):
mid-run quota errors reach it through track_analysis, this one stops the
run before any tracked analysis starts.
- Only full runs are checked up front. They spend minutes on tool installs
and static analysis before the first LLM call; an incremental run may need
no LLM call, so a spent quota stops it only if it reaches one.
- The client is built inside the try, so any failure lets the run go on, and
uses the provider's own key instead of the placeholder constant.
- LLMQuotaError.is_codeboarding_quota is gone: only its own __init__ read it.
- Tests use the relay's real base URL (no /v1), assert tool installs never
start and the stop is reported, and share one copy of the 402 body.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: type the recorded requests in the quota CLI tests
CI runs mypy over the tests too; the two empty lists needed their type.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: check the quota in every CLI bootstrap, without a flag
Hosted credentials reach Core only through the Action, which runs the CLI, and every CLI run starts in bootstrap_environment. Checking there unconditionally covers full, incremental and partial runs, including the full run an incremental starts after an engine change, which the full_run flag missed.
The check reports its own stop to PostHog, so bootstrap calls it in one line; its docstring is down to a summary and a Why.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
0 commit comments