Skip to content

fix: Restore local mirror warm-hit performance - #4171

Merged
pda merged 2 commits into
mainfrom
pda/remote-mirror-no-url-fast-path-c275
Aug 4, 2026
Merged

fix: Restore local mirror warm-hit performance#4171
pda merged 2 commits into
mainfrom
pda/remote-mirror-no-url-fast-path-c275

Conversation

@pda

@pda pda commented Aug 4, 2026

Copy link
Copy Markdown
Member

Description

Warm on-host Git mirrors regressed after remote-mirror safety checks added global ref-reachability scans to every cached commit lookup. On large mirrors those scans can delay checkout by several minutes even when no remote mirror URL is configured.

Restore the previous presence-only warm-hit path when remote mirroring is skipped specifically because no URL is configured. Remote-mirror-enabled behavior remains unchanged and can be optimized separately.

Context

Production build showing the checkout delay

Changes

  • Return the existing on-host mirror immediately for no-URL warm hits, before the global reachability scan.
  • Preserve unpinned-object checks for configured remote mirrors and their retries.
  • Add a deterministic regression test that asserts the no-URL path does not run for-each-ref.

Testing

  • Tests have run locally (with go test ./...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go tool gofumpt -extra -w .)

Focused mirror-update regressions pass with the race detector. The broad internal/job package run was intentionally stopped because this urgent hotfix is covered by the focused tests and that package routinely takes 6–7½ minutes locally.

Disclosures / Credits

Cursor Agent diagnosed the production regression, implemented the hotfix and regression coverage, and ran independent ship-risk, maintainability, and simplicity reviews.

Open in Web Open in Cursor 

cursoragent and others added 2 commits August 4, 2026 07:59
Co-authored-by: Paul Annesley <pda@users.noreply.github.com>
Co-authored-by: Paul Annesley <pda@users.noreply.github.com>
@pda
pda requested review from a team as code owners August 4, 2026 08:16
@pda pda added internal Non-user facing, internal change. performance labels Aug 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6670d4f6fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +278 to +281
hasGitCommit(ctx, e.shell, mirrorDir, e.Commit) {
// Avoid the global reachability scan when remote mirroring is not configured.
e.shell.Commentf("Commit %q exists in mirror", e.Commit)
return e.snapshotMirror(ctx, repository, mirrorDir)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Repair the canonical origin before the no-URL return

When a renamed repository or two canonical URLs normalize to the same dirForRepository path and the requested commit already exists in the shared mirror, this return runs before updateRemoteURL, leaving remote.origin.url pointed at the previous repository. This bypasses the collision repair immediately below and exposes a stale-origin mirror to subsequent warm hits and consumers of BUILDKITE_REPO_MIRROR; perform the inexpensive origin repair before taking this fast path.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is valid, but intentionally deferred for the emergency hotfix. The no-URL path restores the pre-remote-mirror warm-hit behavior so large mirrors avoid the multi-minute global reachability scans. The stale-origin case requires a repository rename or dirForRepository collision while the requested commit is already present; a later miss reconciles origin before fetching. We’ll follow up by moving the inexpensive origin reconciliation ahead of this return without restoring the reachability scan.

@pda
pda merged commit 7568349 into main Aug 4, 2026
6 of 7 checks passed
@pda
pda deleted the pda/remote-mirror-no-url-fast-path-c275 branch August 4, 2026 08:31
cursor Bot pushed a commit that referenced this pull request Aug 4, 2026
…url-fast-path-c275"

This reverts commit 7568349, reversing
changes made to 5286a2e.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Non-user facing, internal change. performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants