Repository navigation
fix: save the base as soon as it is built, and explain refused pushes - #184
Conversation
…d stop early on a spent quota - Review uploads the base right after generating it, before the head analysis, so a head that fails or times out no longer discards it. - Sync publishes the analyzed commit's base whatever the delivery did; the baseline-commit copy still needs a delivered commit. - A push refused by branch protection or a ruleset (GH006/GH013) fails with the branch and the fix. - A spent hosted quota or OpenRouter key limit stops the run before checkout and install, with the reason in the review comment or sync summary. - README workflow examples use timeout-minutes: 180. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
CodeBoarding reviewStatus: 0 changed components (no analysed file changed) See the full change in CodeBoarding. graph LR
n_Action_Execution_And_Relay["Action Execution And Relay"]
n_Remote_Analysis_Integration["Remote Analysis Integration"]
classDef added fill:#1f883d,stroke:#0b5d23,color:#ffffff;
classDef modified fill:#bf8700,stroke:#7d4e00,color:#ffffff;
classDef deleted fill:#cf222e,stroke:#82071e,color:#ffffff,stroke-dasharray:5 3;
|
…er outputs - The quota message matches Core's and links to pricing; it no longer tells a license user to switch to a license. - "Remove in_place" is advised only for the default branch; any other branch gets the bypass-actor fix. - baseline_sha is set only when in_place writes a commit, so its publish step needs one plain condition. - refused_by_rule lives next to baseline_fail; clearer names, shorter comments, shared test helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ivanmilevtues
left a comment
There was a problem hiding this comment.
I would like to reconsider the quota handling as we are already doing it via core and I am unsure how does this fit into that.
After prompting it said this:
The existing path is:
- Engine [`LLMQuotaError`](https://github.com/CodeBoarding/CodeBoarding/blob/main/agents/llm_errors.py#L109-L132) produces: “Your CodeBoarding quota is exhausted. Buy a CodeBoarding license at https://codeboarding.org/pricing, or wait for your weekly reset.”
- The CLI exits with code `3`.
- The Action’s [`analyze_repository.py`](https://github.com/CodeBoarding/CodeBoarding-action/blob/main/scripts/analyze_repository.py#L111-L124) preserves that message as `failure_reason`, which the workflow displays.
**What [PR #184](https://app.codeboarding.org/CodeBoarding/CodeBoarding-action/pull/184) adds is an earlier check, not a previously missing upgrade message.** It probes quota before checkout and engine installation, rather than discovering exhaustion when analysis makes an LLM request. That can save wasted setup and static-analysis time. The runtime handling still needs to exist because quota can run out during analysis.
There is nevertheless a legitimate duplication concern: **the new script reimplements the classification and upgrade copy, less precisely.** It treats any HTTP `402` from the hosted endpoint as the user’s CodeBoarding quota being exhausted. The existing engine distinguishes that from CodeBoarding’s upstream provider running out of credits, which tells the user to contact support rather than buy a license.
|
|
||
| OPENROUTER_KEY_URL = "https://openrouter.ai/api/v1/key" | ||
|
|
||
| HOSTED_SPENT = ( |
There was a problem hiding this comment.
We already handle exhausted quota and show the upgrade/reset guidance through LLMQuotaError and analyze_repository.py. I understand the benefit here is checking before expensive setup.
This probably has to be handled within the core or feature itself rather than here, it is a bit odd to make a request we also have just openrouter_key here.
Could you revise this so it is handled a bit mroe centralized not one time in core, one in action and so on. I am not sure how we can do that, but I preferred the way with the exception from core and then we should proly also have something for the cloud part (which is the llm lambda proxy itself I think)
There was a problem hiding this comment.
Agreed, took it out of this PR (07c63d2). The early check now lives in Core instead: https://app.codeboarding.org/CodeBoarding/CodeBoarding/pull/712
- One free
GET /modelscall inbootstrap_environment(), before tool installs and static analysis, only for the Action's hosted credentials. - It raises the existing
LLMQuotaErroronly when_is_codeboarding_quotasays so, so the message and the upstream-out-of-credits split are the same code as at runtime. The CLI exits 3 and the Action shows Core's message, so the Action has no quota code left. - No cloud change: the proxy's gate already answers before forwarding, and
/modelsis not metered.
On the time it saves: across 11 recent jobs on our repos, the Action spends 37–59 s before Core starts (mostly the pip install), while Core's static analysis takes minutes on our repos and tens of minutes on a 1.3M-line C# repo. So checking inside Core catches nearly all the waste, without a second copy in the Action.
| contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
| timeout-minutes: 180 |
Review asked for quota handling in one place: Core's LLMQuotaError already tells the user's CodeBoarding quota apart from the hosted provider running out, and the Action shows its message. The early check moves to Core, so the Action gets it without its own request or copy of the message. Authentication is configured where it was before, and credentials are cleared in review mode only, as on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…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>
…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>
What
Three fixes so a run's work is not thrown away, and so a failing run says why.
GH006/GH013), the run fails with the fix instead of "Could not push":in_place: removecodeboarding_analysis_location: in_placeso sync saves tocodeboarding/baseline;The early quota check that was here moves to Core, following review: CodeBoarding/CodeBoarding#712. Core already tells the user's CodeBoarding quota apart from the hosted provider running out, and the Action already shows Core's message, so the Action needs no quota code.
The README's example workflow now uses
timeout-minutes: 180, anddocs/COMMIT_STRATEGY.mdsays when each analysis is published.Why
A customer's reviews kept rebuilding the base from scratch, about 50 minutes each on a 1.3M-line C# repository:
Tests
python3 -m unittest discover -s tests: 379 pass, 9 skipped. Refused pushes are simulated with pre-receive hooks.actionlint,shellcheck -x scripts/action/*.sh, black: clean.Not yet seen on a real runner: GitHub's exact refusal text.
🤖 Generated with Claude Code