Repository navigation
π fix(proxy): An agent refused because the hive's shared GitHub budget is low is told so, with the reset time, and keeps working - #17378
Conversation
β¦ when it resets
When the App installation's shared core budget fell under
github.agent_reserve_floor, the proxy's 429 body and pane nudge used the
per-agent cap wording ("hourly cap reached ... stop all GitHub reads for
this session"). On knuckle (2026-11-08 11:35:22Z) sec-check was refused at
379/400 with reason=reserve and abandoned its whole audit.
The reserve refusal now says the hive's shared GitHub API budget is low
(not the agent's own cap), gives the reset time and Retry-After, warns that
git fetch or clone may be refused too while github.com is intercepted, and
tells the agent to pause and carry on with local work. The cap refusal's
wording is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Read the proxy path end to end; this looks correct to me.
src/crux/proxy/agent_github_budget.go:162-164β the reserve status is built withCount: remaining, Cap: floor, so the new body's "N left, reserve floor F" reads the right fields (379/400 in the knuckle log is remaining/floor, not count/cap).agentGitHubBudgetNow()mirrors the existing clock-injection at:157-160, andnewAgentGitHubBudget(:31-34)never leavesnownil, so theuntiltimestamp is computed from the same clock asRetryAfter.writeAgentGitHubBudget429already clampsst.RetryAfterto β₯1 at:194-196before calling the helper, so theRetry-Afterheader and the "(Retry-After Ns)" text in the body agree.src/pkg/review/unreadable.go:42βrateLimitCauseReincludesapi (?:hourly )?budget, so a reviewer quoting the new reserve text is still classified as rate-limited; the addedunreadable_test.gorow pins that.- The
capbranch returns the previous strings byte for byte, and the log line keyed by the fleet report is untouched.
One pre-existing thing, not introduced here: markNudged is once per agent per window regardless of reason, so an agent that got a reserve nudge and then hits its own cap in the same window will not get the cap nudge. Fine for this PR; noting it only so nobody reads the "exactly as before" claim as covering that sequence.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Looks correct to me. Read the refusal path in src/crux/proxy/agent_github_budget.go on v6 and the review-side matcher.
Verified:
githubBudgetRefusal(agent_github_budget.go:236-247) builds the reserve status withCount: remaining, Cap: floor, RetryAfter: retryAfterSeconds(now, reset), so the new wording "N left, reserve floor F" and theuntiltimestamp (now + RetryAfter) describe exactly what those fields hold. The cap branch (:231) is untouched andagentGitHubBudgetMessagesreturns the previous strings byte-for-byte forReason != "reserve", whichTestAgentGitHubBudgetCapRefusalWordingUnchangedpins.agentGitHubBudgetNow()reads the same injected clockgithubBudgetRefusaluses, so the reset time in the message and theRetry-Afterheader come from onenow.- The new sentence added to
pkg/review/unreadable_test.gois matched by the existingrateLimitCauseRe(pkg/review/unreadable.go:42, alternativeapi (?:hourly )?budgethits "GitHub API budget is low"), so a reviewer that quotes the new 429 body is still classified as rate-limited rather than parked as a real review failure.
Info, not a defect: the proxy's own log line at agent_github_budget.go:286 still reads "agent GitHub API hourly cap reached" for both reasons β the same message the PR body quotes from knuckle as the misleading one. It carries reason=reserve, so it is distinguishable, and keeping the message stable for log greps is reasonable; just flagging that an operator reading the log still sees "cap reached" on a reserve refusal.
Changelog fragment and runtime-and-quota.md updated alongside. CI still running at time of review.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. Evidence bundle `#173785ba3b7d` sha256:127a4109108d3cc86f8dc36275b2d2f5757775970e048857395f4fcaacb312d2 β download from the dashboard or `hivectl review evidence #17378`.Review findings from Read Verified
Looks correct to me. Fork PR, so a maintainer needs to take it from here. |
Summary
When the hive's shared GitHub budget runs low, the proxy refuses agents' GitHub reads. Until now that refusal used the wording meant for an agent's own hourly cap: "hourly cap reached", "stop all GitHub reads for this session". On knuckle that made sec-check give up its whole audit. The reserve-floor refusal now says what happened: the hive's shared budget is low, this is not the agent's cap, reads come back at a given time. It tells the agent to pause until then and keep doing local work. The agent's own-cap refusal reads exactly as before.
What went wrong
agent GitHub API hourly cap reached agent=sec-check count=379 cap=400 retry_after=1260 reason=reserve. That is thegithub.agent_reserve_floorgate (default 400) on the App installation's shared core bucket. It is notagents.github_api_hourly_cap.writeAgentGitHubBudget429sent the same pane nudge and the same 429 body for both refusals. The nudge said "stop all GitHub reads for this session". The body said "agent GitHub API hourly cap reached (379/400)". The lane policies (scanner-full.md,ci-maintainer*.md,quality-full.md) also say to stop for the session on a 429 "hourly cap reached". So an agent refused for a reason that clears in about 20 minutes ended the task instead.What changes
agentGitHubBudgetMessages, picks the wording. Forreason=capit returns the old strings, byte for byte.reason=reserve, the 429 body and the nudge now say:Retry-After), with the wait in minutes in the nudge;github.comwithout inspecting it, so the floor never sees git. WhenHIVE_PROXY_INJECT_GH_AUTH=trueor a lane is underwrite_surface.enforce,github.comis intercepted.agentGitHubRequestIsReadthen countsinfo/refsandgit-upload-packas reads, and the floor refuses them as well. knuckle hasHIVE_PROXY_INJECT_GH_AUTHset (the value is hidden), so promising that git works would have been wrong there.agent GitHub API hourly cap reached, withreason) is unchanged, because the fleet-report class keys on it.Interaction with #17376
Refs #17376 (also ours, open). It records refusal times in the same file. This change stays out of its hunks: the helper sits below
writeAgentGitHubBudget429, and the new tests go beforeTestAgentGitHubBudgetCapWarnOncePerWindow, not at the end of the file.git merge-treeof the two heads is clean. #17376's review tests do not depend on the proxy's wording, because it uses the proxy's refusal record. The older wording match,UnreadableReviewReason, still recognises a reviewer quoting the new text: its pattern matches "API budget". A test row pins that.Files
src/crux/proxy/agent_github_budget.go: the message helper, and the 429 writer now uses it.src/crux/proxy/agent_github_budget_test.go: two tests.src/pkg/review/unreadable_test.go: one row added to the recognised-summaries list.src/docs/operator-reference/runtime-and-quota.md: documents the reserve body and nudge, and when git is affected.changelog.d/fixed-reserve-floor-refusal-wording.mdTests
TestAgentGitHubBudgetReserveRefusalNamesSharedBudgetAndResetreplays the knuckle refusal (379/400, Retry-After 1260 at 11:35:22Z). It checks that the body and the nudge name the shared budget, the reset time2026-11-08T11:56:22Z, the git caveat and local work. It also checks that neither says "hourly cap reached", "for this session" or "Stop polling". On v6 tip it fails, because both strings are still the cap wording.TestAgentGitHubBudgetCapRefusalWordingUnchangedpins the cap nudge and body exactly.UnreadableReviewReasonrow quotes the new reserve text. It guards against regressions and passes on the tip as well.CI decides whether these pass. Nothing was run locally (AGENTS.md).
π€ Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1