Repository navigation
fix: Converge fetches per-leaf repoUrl and self-heals (#67) - #68
Merged
Merged
Conversation
buildConvergeScript bound /workspace/repo to the first repoUrl: it cloned once, then always ran `git fetch origin <ref>`, ignoring the per-leaf repoUrl on reuse. A pooled sandbox that first served repo X could never converge repo Y (fetch ran against X's origin -> exit 128 "couldn't find remote ref"), the initial clone raced under concurrency, and a partial /workspace/repo did not self-heal. Fetch by explicit URL (git init + git fetch <repoUrl> <ref>) with the whole init+fetch under the flock, and self-heal via rm -rf + git init when .git is absent or a fetch fails. One pooled sandbox now serves many repos from a shared object store, concurrent converges no longer race the clone, and a missing or corrupt /workspace/repo recovers automatically. Verified with the generated script against two local repos: X@work then Y@main on the same workspace both succeed with correct content, while the old script fails the second with exit 128; non-git and corrupt-.git repos self-heal. Closes #67. Also closes the non-self-healing wedge in #59. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
pdettori
force-pushed
the
fix/converge-multirepo-67
branch
from
July 5, 2026 20:05
7b4a27e to
4e4e977
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the two
convergeWorkspacedefects in #67 that stop a pooled sandbox from serving more than one repo and race the initial clone.buildConvergeScriptused togit cloneonce and then alwaysgit fetch origin <ref>.originwas pinned to the first repoUrl, so the per-leafrepoUrlwas ignored on reuse — a sandbox that first served repo X could never converge repo Y (fetch origin <ref>ran against X →exit 128 couldn't find remote ref). The clone also sat outside theflock, so concurrent leaves on a fresh workspace raced it, and a partial/workspace/reponever self-healed (#59).Change
harness/src/converge.ts—buildConvergeScriptnow:git init+git -C "$REPO" fetch <repoUrl> <ref>instead ofgit clone+fetch origin. One shared object store at/workspace/reponow serves many repos.rm -rf "$REPO"; git initwhen.gitis absent, and a retry (fetch || { reinit; fetch; }) when a fetch fails against a corrupt.git.flowchart TD A["converge(repoUrl, ref)"] --> B["( flock 9"] B --> C{".git present?"} C -->|no| D["rm -rf REPO; git init"] C -->|yes| E["git fetch repoUrl ref"] D --> E E -->|ok| G[") close lock"] E -->|fail| F["rm -rf REPO; git init; fetch"] F --> G G --> H["worktree add --detach LEAF FETCH_HEAD"]Worktree add,
printfoutput, and single-quote injection escaping are unchanged;buildConvergeScript's signature and all callers are unchanged.Testing
harness/test/converge.test.ts): updated thebuildConvergeScriptcontract — fetch targets the explicitrepoUrl+ref(neverorigin, nogit clone), init+fetch inside the flock, self-heal + fetch-retry, plus the existing worktree/printf/injection assertions. 9/9 green.X@workthenY@mainon the same workspace → both exit 0 with the correct repo's content → multi-repo works.exit 128 couldn't find remote ref main(the exact converge binds /workspace/repo to the first repoUrl (fetchesorigin) and races the initial clone — breaks multi-repo shared-pool use #67 symptom)./workspace/repoand a corrupt.gitboth self-heal.Closes #67. Also closes the non-self-healing wedge in #59.
Assisted-By: Claude Code