Skip to content

git-branch: clone from GitHub when the repo is not in the local cache - #1583

Open
ivpusic wants to merge 1 commit into
paradigmxyz:mainfrom
ivpusic:git-branch-clone-fallback
Open

git-branch: clone from GitHub when the repo is not in the local cache#1583
ivpusic wants to merge 1 commit into
paradigmxyz:mainfrom
ivpusic:git-branch-clone-fallback

Conversation

@ivpusic

@ivpusic ivpusic commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

git-branch only knew how to make a shared clone from the read-only repo-cache mount at ~/github, so for any repo outside a deployment's cached set it failed with "is not a valid git repository". Agents routinely misread that as an infrastructure limitation — telling users an admin must mount the repo, or trying to clone into the read-only mount — when an authenticated clone into ~/branches works fine. We hit exactly this in our deployment: one session refused a PR request over this error while a same-model session recovered with a manual gh repo clone and shipped its PR.

Changes:

  • fall back to cloning https://github.com/<org>/<repo> (sandbox git credentials apply) into ~/branches/<org>/<repo> when the repo is not in the local cache
  • reuse an existing ~/branches working copy before checking the cache, so reuse also works for uncached repos
  • on remote clone failure, say what to check (repo name, credential read access) instead of a bare git error
  • add a system-prompt line stating a repo missing from ~/github is not a blocker and needs no admin action

Tested all three paths locally (cached shared clone, GitHub fallback, nonexistent repo → clean error, exit 1).

git-branch only knew how to make a shared clone from the read-only
repo-cache mount at ~/github. For any repo outside the deployment's
cached set it failed with 'is not a valid git repository', which agents
routinely misread as an infrastructure limitation - reporting to users
that an admin must mount the repo, or attempting to clone into the
read-only mount - when a plain authenticated clone into ~/branches
works fine.

Fall back to cloning https://github.com/<org>/<repo> into the writable
branches dir when the repo is not cached, reuse an existing working
copy before checking the cache, and say in the error message what to
check when the remote clone fails. Also note in the system prompt that
a repo missing from ~/github needs no admin action.
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