Skip to content

ci(circleci): clone the public repo over HTTPS so main jobs stop failing at checkout - #49394

Merged
mateo-berri merged 6 commits into
BerriAI:mainfrom
zoveki:litellm_circleci_https_checkout
Oct 31, 2026
Merged

mateo-berri merged 6 commits into
BerriAI:mainfrom
zoveki:litellm_circleci_https_checkout

Conversation

@zoveki

@zoveki zoveki commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Since Oct 27 every CircleCI job on main fails at Checkout code with Permission denied (publickey), because CircleCI lost its GitHub App access and falls back to a deploy key GitHub rejects. The repo is public, so this PR clones each job's commit anonymously over HTTPS instead. After merge I recreate the main integration schedule, deleted with the old pipeline definition

Original

TLDR

Problem this solves:

  • Every main CircleCI job dies at Checkout code since Oct 27, so no integration suite has run
  • CircleCI lost its GitHub App access and falls back to an SSH key GitHub rejects

How it solves it:

  • One checkout_over_https command clones the commit anonymously over HTTPS, with history but no file contents
  • It tries the fetch and the file download three times, 5 seconds apart
  • All 13 checkout steps, the migration checkout and the Windows wheel job (under bash.exe) use it
  • The routing parity job fetches its base with --no-filter
  • .circleci/AGENTS.md records the integration schedule's cron
  • Tests run the step under both job shells and the path filter after it
Decisions
  • A blobless full-history fetch over depth 1: it gives every job the history the built-in step gave, at about 13 seconds and 90 MB more per job than depth 1, where depth 1 plus an unshallow in the path filter cost about 4.5 minutes and 1.4 GB per filtered PR job
  • Three tries 5 seconds apart over one, since a single GitHub network blip would otherwise fail a job on main. Each try runs the fetch and the checkout, because the checkout downloads the file contents (.git grows from 89M to 154M) and can fail on its own, and the third failed try ends the step on that error
  • Detached HEAD with no branches, tags or remote refs over the built-in step's local main: every caller in .circleci, tests and litellm only runs git rev-parse HEAD
  • The repo URL stays hardcoded over CIRCLE_REPOSITORY_URL, which is the SSH form that fails. GitHub serves a fork's commits from that URL too, so a fork's own CircleCI still clones: the step checked out a fork commit 10 ahead of main with no PR, 7884a6b
  • A credential-free clone over a new deploy key or restoring the CircleCI GitHub App's access to the repo: GitHub rejects the project's key, either fix needs a GitHub org owner or repo admin, and a public repo needs no secret to clone
  • Anonymous over a token: the CircleCI project holds no GitHub token in its env vars and the config uses no context, a personal token expires and ties main's CI to one account, and the App's token is what broke
  • --no-filter on the routing parity base fetch: the fetch inherits the clone's blobless filter, so git checkout <base> -- <paths> downloaded each file on its own, 210 s for a main base and 896 s for a stable-line base on the machine image's git 2.34, where --no-filter takes 15 s and 10 s
  • The integration schedule goes back in the project settings over a triggers: block in config, since a workflow with triggers: runs only on its schedule and would drop out of the API pipelines that set run_migration_tests or routing_parity_base

User Flow

Before: a maintainer watching main's CircleCI sees every job fail before any test runs

  1. A scheduled pipeline starts on main at https://app.circleci.com/pipelines/github/BerriAI/litellm
  2. Each job's Checkout code step prints git@github.com: Permission denied (publickey) and exits 128
  3. The integration workflow shows all red with no test output

After: the same pipeline clones the commit and runs its tests

  1. A scheduled pipeline starts on main at https://app.circleci.com/pipelines/github/BerriAI/litellm
  2. Each job's "Check out the public repository over HTTPS" step fetches the pipeline's commit with no key
  3. The jobs reach their test steps, such as "Run owned integration contracts"

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Screenshots / Proof of Fix

Last updated: 582dc59. QA ran on 6306dea. Changes since QA: --no-filter on the parity base fetch, its test, and an AGENTS.md line. Proof remains valid because checkout_over_https is byte-identical. Verification: the parity case below and the 17 checkout tests

PR pipelines are off here, so each After case runs the step on a stand-in with no ~/.ssh or git credentials

Case Before After
Docker job clones publickey, exit 128 exit 0
Machine job clones publickey, exit 128 exit 0
Windows job clones publickey, exit 128 exit 0
Docs-only PR skips backend never reached halts
Unknown commit never reached fetch error, exit 1
File download drops once never reached retried, exit 0
Parity job checks out its base never reached one download, 15 s

Before (c7c895d)

c7c895db45's .circleci/ is byte-identical to this PR's merge base bad98c4b02

A machine job clones its commit

  1. Main pipeline 91606, the last one that ran the integration workflow, machine job integration-cost, step Checkout code:
Cloning into '.'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
error running git clone "git@github.com:BerriAI/litellm.git": exit status 128

The other cases

Steps and output
  1. The docker jobs and the path-filtered Windows job 2270026 fail at Checkout code the same way, so the path filter and every later step never run

After (6306dea)

A docker job clones its commit

  1. docker run --rm -e CIRCLE_SHA1=a392a39627f51bf0369944556c22268ee8cffe83 -e REQUESTED_REVISION= cimg/python:3.12-browsers@sha256:b432899a... /bin/bash -eo pipefail checkout_step.sh, the docker jobs' image, shell and user:
ls: cannot access '/home/circleci/.ssh': No such file or directory
Initialized empty Git repository in /tmp/job/.git/
From https://github.com/BerriAI/litellm
 * branch                  a392a39627f51bf0369944556c22268ee8cffe83 -> FETCH_HEAD
HEAD is now at a392a39627 fix(vertex_ai): bill Claude web search per request on deployments priced in model_info (#49160)
exit=0 in 28s
What the clone holds
  1. git log -1 --format=%H prints a392a39627f51bf0369944556c22268ee8cffe83, main's tip, git rev-parse --is-shallow-repository prints false with 55660 commits of history in a 154M .git, and .circleci/config.yml exists
  2. The plain cimg/python:3.12@sha256:9c796c23... image the other 9 docker jobs use prints the same lines, exit=0 in 27s, the same sha, 55660 commits and a 154M .git
  3. The same run with REQUESTED_REVISION=main (not a 40-character sha) prints exit=1 and leaves the directory empty

A machine job clones its commit

Steps and output
  1. ubuntu:22.04@sha256:076e7bf8..., the machine image's base, with its own git, as a non-root circleci user in ~/project:
git version 2.34.1
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
ls: cannot access '/home/circleci/.ssh': No such file or directory
Initialized empty Git repository in /home/circleci/project/.git/
From https://github.com/BerriAI/litellm
 * branch                  a392a39627f51bf0369944556c22268ee8cffe83 -> FETCH_HEAD
HEAD is now at a392a39627 fix(vertex_ai): bill Claude web search per request on deployments priced in model_info (#49160)
exit=0 in 40s
a392a39627f51bf0369944556c22268ee8cffe83
shallow=false commits=55660
  1. CircleCI already ran the older depth-1 form of this clone on a machine executor, and step "Select the requested migration test revision" passed in job 2270106 of pipeline 91618

The Windows wheel job clones its commit

Steps and output
  1. A windows-2022 GitHub Actions run writes the same step to a file and runs bash.exe <file> in an empty directory, like windows_release_wheel does on CircleCI's Windows Server 2022 executor:
bash.exe resolves to C:\Program Files\Git\bin\bash.exe
GNU bash, version 5.3.15(2)-release (x86_64-pc-cygwin)
git version 2.56.0.windows.3
== main tip
Initialized empty Git repository in D:/a/_temp/job-10176ace-8b48-4910-a8ab-9192038ff758/.git/
From https://github.com/BerriAI/litellm
 * branch                  a392a39627f51bf0369944556c22268ee8cffe83 -> FETCH_HEAD
HEAD is now at a392a39627 fix(vertex_ai): bill Claude web search per request on deployments priced in model_info (#49160)
exit=0 in 20s
a392a39627f51bf0369944556c22268ee8cffe83
shallow=false commits=55660
== REQUESTED_REVISION=main
exit=1 in 0s
no .git
== commit GitHub does not have
Initialized empty Git repository in D:/a/_temp/job-9fc5eda4-73ec-45d1-865d-115ade418324/.git/
fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000001
fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000001
fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000001
exit=1 in 12s

A docs-only PR skips backend jobs

Steps and output
  1. The docker image clones PR docs: fix broken contributing links in README files #48542's head 9f3df24 (two README files) with the step, then runs path_filter.sh backend, which this PR leaves as it is on main, with CIRCLE_PULL_REQUEST set:
checkout exit=0
path-filter[backend]: changed files vs aa33b052d2292c9fcdc3d34523a968f1b41d0bd4:
  litellm/proxy/client/README.md
  terraform/provider/README.md
path-filter[backend]: only unrelated changes detected; halting job as successful
circleci-agent step halt
filter exit=0 in 19s
  1. The same run after a depth-1 clone, the form this PR first had, prints path-filter[backend]: running job (could not resolve a merge base against main)

A commit GitHub does not have

Steps and output
  1. The docker image runs the step with CIRCLE_SHA1=0000000000000000000000000000000000000001. It tries the fetch three times and stops on the fetch's error, with no checkout after it:
Initialized empty Git repository in /tmp/job/.git/
fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000001
fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000001
fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000001
exit=1 in 12s

A file download that drops once

Steps and output
  1. The docker image runs the step behind a small HTTPS proxy that refuses the first connection git opens after the fetch finishes, which is the checkout's own download of file contents. The step as it stood at eb5ba48, with the checkout after the retry loop, fails:
proxy: passed a connection to github.com:443
proxy: refused the first connection to github.com:443 after the fetch finished
From https://github.com/BerriAI/litellm
 * branch                  a392a39627f51bf0369944556c22268ee8cffe83 -> FETCH_HEAD
fatal: unable to access 'https://github.com/BerriAI/litellm.git/': Received HTTP code 502 from proxy after CONNECT
fatal: could not fetch c439d0fe3520f772afdffa5efe704b02d5b44570 from promisor remote
exit=128 in 17s
  1. The step at 6306dea retries and checks out the commit:
proxy: passed a connection to github.com:443
proxy: refused the first connection to github.com:443 after the fetch finished
proxy: passed a connection to github.com:443
proxy: passed a connection to github.com:443
fatal: unable to access 'https://github.com/BerriAI/litellm.git/': Received HTTP code 502 from proxy after CONNECT
fatal: could not fetch c439d0fe3520f772afdffa5efe704b02d5b44570 from promisor remote
From https://github.com/BerriAI/litellm
 * branch                  a392a39627f51bf0369944556c22268ee8cffe83 -> FETCH_HEAD
HEAD is now at a392a39627 fix(vertex_ai): bill Claude web search per request on deployments priced in model_info (#49160)
exit=0 in 38s

The routing parity job checks out its base (582dc59)

Steps and output
  1. ubuntu:22.04@sha256:076e7bf8... with its own git clones main commit c4b01b2 with the step, then runs 582dc59's "Check out base product code" step without its built-library check, once for a main base and once for a stable-line base. A script then compares the three product directories with the base commit and runs the head step:
+ ROUTING_PARITY_BASE=bad98c4b02f09076cd11fcf788888f36dce23e73
git version 2.34.1
checkout exit=0
base step exit=0 in 15s, lazy fetches=0
litellm matches the base commit
enterprise matches the base commit
litellm-proxy-extras matches the base commit
head step exit=0 in 2s
tracked paths match CIRCLE_SHA1
+ ROUTING_PARITY_BASE=b6f084fc486707527d86458ec4ba07ced7942953
git version 2.34.1
checkout exit=0
base step exit=0 in 10s, lazy fetches=0
litellm matches the base commit
enterprise matches the base commit
litellm-proxy-extras matches the base commit
head step exit=0 in 2s
tracked paths match CIRCLE_SHA1
  1. The same step at 6306dea, without --no-filter, exits 0 in 210s for the main base and 896s for the stable-line base, because git downloads each missing file separately. On the cimg/python:3.12 image's git 2.53 it made 532 separate downloads in 311s for the main base

Type

🚄 Infrastructure
✅ Test

Caveats (if any)

High

  • The After ran on stand-ins, never on CircleCI itself
    • Ubuntu 22.04, two cimg/python:3.12 images and a windows-2022 runner stand in for the three executors, and the unit tests' Windows case runs Linux bash
    • Jobs 2270106 and 2269764 already ran HTTPS and blobless clones on CircleCI's machine and Windows images
    • I watch the first main pipeline's docker, machine and Windows jobs after merge

Medium

  • GitHub may require auth for anonymous HTTPS clones during heavy traffic, and three tries 5 seconds apart won't outlast it
    • The project has no GitHub token, and restoring CircleCI's GitHub App access needs an org owner
  • Merging alone doesn't bring the integration suite back, so I recreate its schedule right after merge with the cron .circleci/AGENTS.md records

Low

  • No test pins each migration job's revision: input, and CircleCI's compile API shows each one passing today
  • CircleCI still prefers the dead deploy key, which I remove once main runs green
  • The checkout tests run git and bash in tests/unit, like sibling script tests on main
  • Optional OSV Scan fails on pyasn1 and pypdf advisories main's uv.lock has too

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
Bugbot summary

[!NOTE]
Medium Risk
Changes how every CircleCI job obtains source code; wrong checkout logic would block all CI, though scope is limited to clone mechanics on a public repo.

Overview
Replaces CircleCI’s built-in SSH checkout (failing with Permission denied (publickey) after GitHub App access broke) with a shared checkout_over_https command that anonymously clones https://github.com/BerriAI/litellm.git at the pipeline commit (or an optional 40-char revision for migration jobs).

The new step uses a blobless full-history fetch (--filter=blob:none), validates the SHA, and retries fetch + detach checkout up to three times with 5s backoff. Every job that previously used checkout or checkout_migration_source now calls this command (including Windows jobs via bash.exe).

Routing parity’s “Check out base product code” step adds --no-filter on the base commit fetch so product trees are materialized in one download instead of hundreds of lazy blob fetches.

Adds .circleci/AGENTS.md documenting the main integration schedule cron and checkout conventions, plus tests/unit/test_circleci_checkout.py to assert no SSH checkout remains, HTTPS revision behavior, retries, path-filter compatibility, and single-fetch routing parity checkout.

Reviewed by Cursor Bugbot for commit 582dc59. Bugbot is set up for automated code reviews on this repo. Configure here.

…ing at checkout

The project's SSH checkout key stopped authenticating on Oct 27, so every job's built-in checkout step failed with Permission denied (publickey). The repo is public, so each job now fetches its pipeline's commit anonymously over HTTPS, the way the migration jobs already did
@zoveki
zoveki requested a review from a team October 31, 2026 04:23
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge, with no new blocking findings

Summary

This PR replaces CircleCI's SSH checkout with an HTTPS fetch of the requested commit. It keeps history and retries failed downloads. The latest change adds --no-filter when fetching the routing parity base, with tests for bases on main and another branch

No new actionable issues were found. The earlier behavior-test concern is addressed by tests that run the checkout command. After mateo-berri explained the existing shell-test practice, Greptile withdrew the request to move these tests out of tests/unit/

  • CircleCI jobs check out the pipeline commit over HTTPS.
  • Routing parity fetches its comparison files together.

Reviews (7) · Last reviewed commit: "fix(circleci): fetch the routing parity ..." · Reviewed by Greptile

Comment thread tests/unit/test_circleci_checkout.py Resolved
@greptile-apps

This comment has been minimized.

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

Comment thread tests/unit/test_circleci_checkout.py Resolved
Comment thread tests/unit/test_circleci_path_filter.py Resolved
…tch, and record the integration schedule

The depth-1 clone left the PR path filter without a merge base, and the unshallow that fixed it pulled about 1.4 GB per filtered job. A blobless fetch gives every job the history the built-in checkout step gave, so the path filter change goes back to main's version. The fetch now gets three tries, the tests run the step under the Windows job's bare bash too, and .circleci/AGENTS.md records the integration schedule's cron
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@codecov

codecov Bot commented Oct 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

…and name the GitHub App fallback as the cause
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

…ce a dropped download failed the job outside the retry
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

…since the blobless clone downloaded each file separately
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread .circleci/config.yml
for attempt in 1 2 3; do
git fetch --filter=blob:none origin "$revision" && git checkout --detach FETCH_HEAD && break
[[ $attempt -lt 3 ]] || exit 1
sleep 5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Retry checkout fails after partial write

Medium Severity

A failed git checkout can leave untracked files in the empty git init work tree. The next loop attempt runs git checkout --detach without --force, so git aborts rather than overwriting those files and the remaining retries die on the leftover tree instead of the original network error.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 582dc59. Configure here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Git fetches all missing files in one batch before writing any, so a failed download leaves no files. The file-drop proof shows the retry passing

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 582dc59. Configure here.

@mateo-berri mateo-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@mateo-berri
mateo-berri merged commit 281bf4e into BerriAI:main Oct 31, 2026
140 of 142 checks passed
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.

2 participants