fix(server): v2 background GitHub checks spend less quota - #13202
juliusmarminge wants to merge 640 commits into
Conversation
Accumulate owned step usage once and preserve partial or unavailable telemetry for failed, interrupted, or reconnected turns.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Mike Olson <mwolson@member.fsf.org> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…8464) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…12946) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Background-task notifications and delegated completions queued behind a held queue are hidden from the queue UI, so the Resume queue control never appeared, yet thread.settle counted them as active work. Settle now cancels those automatic runs in the same transaction; user-queued messages still block it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Branch PR lookups without an open PR now stay cached for 5 minutes instead of 1, so idle branches stop costing a GraphQL call on every sweep. In-app paths that can open a PR (turn end, push, create PR, user refresh) still bypass the cache. The v2 settlement sweep only re-checks a branch uncached when the linked PR is terminal and the group would actually settle. A group that only becomes eligible after that check waits for the next sweep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Concurrent summary reads on one host and credential now share aliased GraphQL requests of 25 through a RequestResolver, falling back to `gh pr view` for anything the batch could not answer. The sync sweep runs 25 groups at once so a sweep's reads land in the same batch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`gh pr list --head` filters on the head ref name alone, so `owner:branch` and `remote:branch` selectors always list nothing while spending a GraphQL call. Fork lookups on GitHub now query the bare branch and let matchesBranchHeadContext pick the right fork. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| limit: 1, | ||
| // A bare branch name also lists same-named branches on other forks, | ||
| // so leave room for the owner match below. | ||
| limit: OPEN_PR_PROBE_LIMIT, |
There was a problem hiding this comment.
🟠 High git/GitManager.ts:1633
findOpenPr can return null for an existing PR when more than 10 open PRs share the branch name across forks: limit: OPEN_PR_PROBE_LIMIT truncates the provider response before matchesBranchHeadContext filters it to the checkout's fork. runPrStep then creates a duplicate instead of returning opened_existing. Paginate the provider results or query with an owner-qualified selector before applying the local filter.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/server/src/git/GitManager.ts around line 1633:
`findOpenPr` can return `null` for an existing PR when more than 10 open PRs share the branch name across forks: `limit: OPEN_PR_PROBE_LIMIT` truncates the provider response before `matchesBranchHeadContext` filters it to the checkout's fork. `runPrStep` then creates a duplicate instead of returning `opened_existing`. Paginate the provider results or query with an owner-qualified selector before applying the local filter.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — The PR substantially changes production GitHub polling, caching, batching, and settlement behavior, including a five-minute default cache for terminal/no-PR results. It also adds a static-analysis suppression and leaves an unresolved high-severity risk where the ten-result probe limit can miss an existing PR and create a duplicate. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
060756d to
d6dcd10
Compare
Ports the GitHub quota stack (#13189, #13198, #13200) onto the v2 orchestrator branch.
Problem
v2 has the same background GitHub loops as main, so it drains the shared 5000/h GraphQL quota the same way:
gh pr viewat a time;owner:branchheads, whichgh pr listnever matches.Fix
wouldSettlegate. The uncached branch recheck runs only when the linked PR is terminal and the group would actually settle. A group that becomes eligible only after that check waits for the next sweep instead of settling on an unverified link. The zero-lookup test is ported too.gh pr viewfallback. PullRequestSyncReactor's sweep goes to concurrency 25. v2's ThreadPullRequestService reads through the samesummarypath at concurrency 8, so it batches as well. This cherry-picked cleanly.owner:/remote:selectors. This cherry-picked cleanly.Estimates are in the main PRs. The per-call savings are the same here.
Verification
vp test runover ThreadSettlementService, ThreadPullRequestService, GitManager, GitHubPullRequestCli, gitHubPullRequestJson and PullRequestSyncReactor: 362 passed.apps/servertypecheck is clean.Made by Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code