perf(agent): a job fetches only the commits its clone doesn't have yet #42

Merged
HumanBean merged 1 commit from HumanBean/Beanstalk:perf/fetch-only-missing into main 2026-11-16 02:40:01 +00:00
Owner

Why

Less load on the forge. The agent already keeps its clone of Longshot between jobs: it's made once and never evicted. But every job still fetched main and the PR's head from the forge, even when the clone already had the exact commits the ticket names. That happens on a retry, the same commit's other target, a re-run, or a second PR on the same main.

What changed

JobPipeline: main is fetched only when the ticket's base commit isn't in the clone yet, and the PR only when its head isn't. A commit the clone has, by its id, is that commit, so this is as safe as before: the ticket's signed sha and base_sha are still checked against the clone (HasCommitAsync) right after. agent/README.md says the clone is kept and fetched into only for missing commits.

For scale: Longshot's repository is 117 MB packed on the server. A new tester downloads it once. A fetch that is needed moves only the new commits.

Testing

  • Agent checks: 1685 passed.
  • Not tested: a real job on the new nightly. The job's log will show "Fetching the pull request" with no git fetch when both commits are already there.
## Why Less load on the forge. The agent already keeps its clone of Longshot between jobs: it's made once and never evicted. But every job still fetched `main` and the PR's head from the forge, even when the clone already had the exact commits the ticket names. That happens on a retry, the same commit's other target, a re-run, or a second PR on the same `main`. ## What changed `JobPipeline`: main is fetched only when the ticket's base commit isn't in the clone yet, and the PR only when its head isn't. A commit the clone has, by its id, is that commit, so this is as safe as before: the ticket's signed `sha` and `base_sha` are still checked against the clone (`HasCommitAsync`) right after. `agent/README.md` says the clone is kept and fetched into only for missing commits. For scale: Longshot's repository is 117 MB packed on the server. A new tester downloads it once. A fetch that is needed moves only the new commits. ## Testing - Agent checks: 1685 passed. - **Not tested:** a real job on the new nightly. The job's log will show "Fetching the pull request" with no git fetch when both commits are already there.
perf(agent): a job fetches only the commits its clone doesn't have yet
Some checks failed
CI / Conventional Commit title (pull_request) Successful in 4s
CI / Workflow lint (actionlint) (pull_request) Successful in 4s
CI / Coordinator tests (pull_request) Has been cancelled
CI / Agent build and checks (pull_request) Has been cancelled
CI / Coordinator image (pull_request) Has been cancelled
c3cf37b222
The agent keeps its clone of Longshot between jobs, but every job still
fetched main and the PR's head from the forge. A commit the clone already
has, by its id (the ticket's signed sha and base sha), is that commit, so a
job now fetches main only when the base commit is missing and the PR only
when its head is: a retry, another target or a run again of the same
commit asks nothing of the forge.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Beanstalk!42
No description provided.