Skip to content

feat(git): serve CI fetches from the mirror with client fallback - #51

Open
christianayscue-pplx wants to merge 3 commits into
pplx/mainfrom
cayscue/ci-git-client-fallback
Open

christianayscue-pplx wants to merge 3 commits into
pplx/mainfrom
cayscue/ci-git-client-fallback

Conversation

@christianayscue-pplx

Copy link
Copy Markdown

Adds per-repository client-fallback mode to the git strategy (RFC 019), moving the patch previously carried in ppl-ai/agi#302423 into the perplexityai/cachew fork.

What changed

  • client-fallback = true serves read-only smart-HTTP (info/refs, git-upload-pack) from the local mirror instead of proxying to GitHub.
  • fresh-refs (e.g., refs/heads/main, refs/heads/trunk-merge/) are compared with upstream via a scoped ls-remote every ref-check-interval (default 10s), with a background job keeping the mirror within that interval. Unlisted branches never mark the mirror stale.
  • max-staleness (default 5m): serves from the mirror while its last successful sync is younger than this; once exceeded, returns 503 so the client falls back to GitHub.
  • missing-commit-timeout (default 20s): a want for a commit missing from the mirror triggers one coalesced upstream fetch per commit; if it does not arrive in time, returns 503 instead of hanging.
  • Writes (git-receive-pack) to a client-fallback repository return 403 rather than proxying upstream.
  • Metrics cachew.git.client_fallback_requests_total (by outcome) and cachew.git.mirror_staleness_seconds.

Deploy impact

None until a repository enables client-fallback = true in Cachew configuration. Once this merges, ppl-ai/agi#302423 can bump the github.com/block/cachew pin and drop tools/third_party/go/patches/cachew-ci-client-fallback.patch.

Testing

  • Unit tests covering staleness, missing-commit fallback, fetch coalescing, write denial, and ensure-refs are included in internal/strategy/git/info_refs_test.go; full just fmt, just lint, and just test run in GitHub Actions CI on this PR.

Created with Perplexity

christianayscue-pplx and others added 3 commits November 30, 2026 00:57
Add per-repository client-fallback mode to the git strategy (RFC 019) so
CI fetches can be served directly from Cachew's local git mirror instead
of proxying to GitHub, failing fast when the mirror is stale or missing
a commit so the client can fall back to origin.

Co-authored-by: Perplexity <noreply@perplexity.ai>
Co-authored-by: Perplexity <noreply@perplexity.ai>
…guard

Co-authored-by: Perplexity <noreply@perplexity.ai>
@christianayscue-pplx
christianayscue-pplx marked this pull request as ready for review November 30, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant