Skip to content

A-1624: Wait for automatic mirror maintenance - #4146

Draft
jamiemonserrate wants to merge 1 commit into
mainfrom
codex/a-1624-foreground-git-maintenance
Draft

A-1624: Wait for automatic mirror maintenance#4146
jamiemonserrate wants to merge 1 commit into
mainfrom
codex/a-1624-foreground-git-maintenance

Conversation

@jamiemonserrate

Copy link
Copy Markdown
Contributor

Description

Git can start automatic maintenance from git fetch in a detached process. The agent would then release its mirror update lock and return while repacking was still in progress, allowing Hosted Agent cache generations to capture both the old and new packfiles and inflate rapidly.

This keeps automatic maintenance enabled, but makes it synchronous for agent-owned mirror fetches. Both maintenance.autoDetach=false and the older gc.autoDetach=false fallback are scoped to the individual Git command, so maintenance completes under the existing update lock before the agent snapshots or returns the mirror.

We deliberately do not disable automatic maintenance: the prior mirror-cache design work concluded that doing so would let long-lived mirrors grow without bound.

Context

Changes

  • Add shared foreground-maintenance Git flags for mirror fetches.
  • Apply them to both main-repository and submodule mirror updates.
  • Pass global Git flags as an argument slice, preserving mirror paths containing spaces.
  • Assert the exact foreground-maintenance command in the Git fetch regression test.

Testing

  • Tests have run locally with go test ./... (with local tag.gpgSign disabled only for the test process).
  • Code is formatted with go tool gofumpt -extra -w ..
  • Pinned golangci-lint 2.9.0 reports 0 issues.

Deployment

No configuration or migration is required. This takes effect when an agent release containing the change reaches Hosted Agents. We should watch git.mirror.fetch duration, git.mirror.lock_wait.update timeouts, and mirror generation sizes because repack time will now be attributed to the fetch that triggered it.

Rollback

Revert this PR to restore detached automatic maintenance. The change does not alter mirror data formats or persist configuration.

Affiliation (optional, external contributors)

Buildkite.

Disclosures / Credits

OpenAI Codex researched the code history and internal Linear, Slack, and Notion context; implemented the change and regression coverage; ran validation; and drafted this PR under Jamie's direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant