fix(go/windows): root the default clone workspace under an absolute base#110
Merged
Conversation
…#107) A build given only repo_url derived its clone target under a hardcoded "/workspaces" base. On the Windows Go node that is a drive-relative path (no drive letter), which the node's spawn context resolves unpredictably: MkdirAll appears to succeed but `git clone` then fails with "destination path ... already exists and is not an empty directory". Add internal/workspace.Root(): SWE_WORKSPACE_ROOT override on every platform, else %LOCALAPPDATA%\agentfield\workspaces on Windows (temp-dir fallback when LOCALAPPDATA is empty), else exactly "/workspaces" for Docker parity. Wire it into the three default-derivation sites (orch build single/multi-repo, orch resolve, fast build) via filepath.Join so the name/suffix patterns stay byte-identical. Ref: #107 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
git clone refuses a destination it did not create with "already exists and is not an empty directory" when it cannot re-open a node-created leaf dir from the Windows spawn context. Pre-creating the clone target's leaf therefore reintroduces the very failure issue #107 is about. In the orch build and resolve clone paths (including the reset-failed re-clone), create only filepath.Dir(repoPath) and let git clone create the leaf. The fresh-init default case and the fast node keep creating the leaf — they git-init in place rather than cloning. Ref: #107 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Python node runs on Windows too and derived the same drive-relative "/workspaces/..." defaults. Add _workspace_root() in execution/schemas.py (SWE_WORKSPACE_ROOT override; else %LOCALAPPDATA%\agentfield\workspaces on nt with a temp-dir fallback; else "/workspaces") and use it at every default-derivation site: build single/multi-repo, resolve, and fast build. Also stop pre-creating the clone destination leaf before git clone in the single-repo, re-clone, resolve, and multi-repo clone_repos paths — create only the parent so git clone owns the leaf, matching the Go node. Update the build-isolation source assertions to the os.path.join form and add _workspace_root unit tests (override, nt LOCALAPPDATA/tempdir, posix). Ref: #107 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #107
Summary
On the Windows Go node, a
buildgiven onlyrepo_urlderivedrepo_path = /workspaces/<repo>-<buildID>— a drive-relative path with no drive letter. The node'sos.MkdirAlland the spawned git resolve it from different contexts, andgit clonefails in <60ms with "destination path … already exists and is not an empty directory" even though the freshly created directory is empty (git'sis_empty_dir()also reports "not empty" when it can't open the directory).Changes Made
Go node (primary fix):
go/internal/workspacepackage:Root()resolves the workspace base —SWE_WORKSPACE_ROOTenv override on every platform;%LOCALAPPDATA%\agentfield\workspaceson Windows (temp-dir fallback ifLOCALAPPDATAis unset); byte-identical/workspaceseverywhere else (Docker parity).orch/build.gosingle- and multi-repo,orch/resolve.go,fast/build.go), keeping the existing<repo>-<buildID>/<repo>-resolve-<buildID>name patterns.git clonecreates the leaf itself, so the "already exists / not empty" refusal can't be triggered by the node's own mkdir. Applied to the initial clone, the reset-failed re-clone, and the resolve clone. The fast node's mkdir is intentionally untouched (it git-inits in place and needs the leaf).Python node (same latent bug — it also runs on Windows):
_workspace_root()inswe_af/execution/schemas.pymirrors the exact resolution order (SWE_WORKSPACE_ROOT→%LOCALAPPDATA%\agentfield\workspacesonos.name == "nt"→/workspaces).app.pybuild/resolve,fast/app.py) and same parent-only mkdir hardening (single-repo clone, re-clone, resolve clone, multi-repo_clone_repos).Explicitly provided
repo_pathvalues are used verbatim on all platforms, unchanged.Testing
tests/test_build_isolation.pysource-scraping assertions updated to the new derivation form (still guarding the issue-Agents in parallel builds appear to be getting cross-contaminated #43 build-scoped isolation contract).gofmt/go build/go vet/go test -race -count=1 ./...clean withGOWORK=off. Python: full suite 1134 passed, 1 pre-existing skip;compileallclean.🤖 Generated with Claude Code