Five ways an agent can fake a green build
Agents rarely cheat on purpose, but under pressure to make tests pass they find shortcuts. Here is what to look for — and what PaneScale flags automatically.
Worktrees are the best way to isolate parallel agents. On Windows they come with a few traps — path length, dependencies and cleanup. Here is how to avoid them.
A Git worktree is a second working directory for the same repository, checked out on its own branch. For parallel agents it is ideal: each agent gets a real directory, a real branch and the full history, and none of them can overwrite the others.
On Windows, worktrees work well — once you know about a handful of traps. This article covers the commands you actually need, the three traps that cost the most time, a few smaller ones, and a routine that keeps a busy repository tidy.
If you have never used them, the whole feature is four commands. Run them from inside your repository:
# a new branch in a new folder, starting from main
git worktree add -b agent/fix-upload ../wt/fix-upload main
# everything that is checked out right now
git worktree list
# done with it: remove the folder and its bookkeeping
git worktree remove ../wt/fix-upload
# clean up entries whose folders were deleted by hand
git worktree pruneEverything in .git is shared: objects, branches, tags, remotes and the repository configuration. What is not shared is per-worktree state — HEAD, the index and a few special refs. That is exactly the split parallel agents need: one history, many desks.
Two rules follow from that design and explain most error messages:
main is checked out in your main folder, git worktree add ../x main refuses. Create a new branch with -b, or use --detach for a throwaway look.git worktree remove, or run git worktree prune afterwards.Windows still has a 260-character path limit for many programs unless long paths are enabled. A worktree in C:\Users\you\projects\my-app-worktrees\fix-the-flaky-upload-test\ plus a deep node_modules path can cross it quickly. The symptom is confusing: an install or a build fails with “file not found” for a file that clearly exists.
What helps:
LongPathsEnabled policy) and in Git (git config --global core.longpaths true). PaneScale’s autopilot preflight warns you when Windows long paths are off.Both settings matter. The Windows policy lets programs that opt in use longer paths; the Git setting makes Git for Windows itself use them when it checks files out. A tool that does neither — some older build tools and scripts — will still fail on a long path, which is the real reason short roots beat any setting.
A quick way to see how close you are: in PowerShell, (Get-ChildItem -Recurse -File | ForEach-Object FullName | Measure-Object -Property Length -Maximum).Maximum prints the longest path below the current folder. Anything above about 230 characters is a warning sign once a build adds its own output folders.
A new worktree has your source files and nothing else — no node_modules, no virtual environment, no build output. An agent that immediately runs the tests will spend minutes installing, or fail.
What helps:
If you install by hand, prefer the reproducible commands: npm ci installs exactly what the lock file says and refuses when package.json and the lock file disagree, which is what you want for an agent that should not drift. Package managers with a shared store, such as pnpm, make repeated installs across many worktrees much cheaper, because each worktree links to files that are stored once on disk.
Files that Git ignores are missing too — most often .env with local settings. Anthropic’s Claude Code documentation points out the same trap for its own worktree sessions: a fresh checkout has no ignored files and no installed dependencies. Copy small ignored files deliberately, or keep the settings an agent needs in a committed example file.
Python projects have the same problem with virtual environments. A virtual environment records absolute paths, so copying one into a worktree rarely works; creating a fresh one per worktree, or pointing the agent at the main one for read-only tasks, is more reliable.
Worktrees outlive the reason you created them. After a few weeks you have dozens, each with its own branch, and git branch becomes unreadable.
What helps:
panescale/grid/… and panescale/autopilot/…, so they are easy to tell apart from yours and easy to clean up in bulk.By hand, git branch --list "agent/*" shows every agent branch with one prefix, and git branch --merged main shows the ones whose work is already in main and can go.
Files in use. Windows does not let you delete a file another process has open. If git worktree remove stops with “Permission denied”, something still has a handle in that folder: an editor, a terminal whose current directory is inside it, a dev server, or a file watcher. Close it and try again. PaneScale ends a pane’s whole process tree when the pane closes, which is why removing a lane right after closing its pane normally just works.
Antivirus and indexing. Real-time scanning of thousands of freshly written files makes installs and checkouts in new worktrees slower than in your main folder. If installs in worktrees are much slower than usual, that is the first place to look — but change security settings only if you understand the trade-off.
Shared configuration. Every worktree reads the same repository configuration. A setting you change “for this experiment” — line endings, hooks, a credential helper — changes it for every worktree. If you really need per-worktree settings, Git has an extension for that (extensions.worktreeConfig), but most of the time the right answer is not to change shared settings from inside an agent’s worktree at all.
Line endings. Because configuration is shared, core.autocrlf is the same in every worktree, which is good. Problems appear when an agent’s tool writes files with different line endings than the rest of the repository; a .gitattributes file with explicit eol rules keeps diffs clean no matter who wrote the file.
Submodules. Git’s own documentation notes that worktrees containing submodules cannot be moved with git worktree move and need --force to remove. If your repository uses submodules, test the workflow once by hand before you hand it to agents.
A worktree starts from a commit. Work you haven’t committed stays in your main working copy and is invisible to the agent. Usually that is what you want — it keeps your in-progress work out of the agent’s way. When it isn’t, commit first, or use a feature that copies uncommitted work on purpose, like Point & Fix or the autopilot’s Include uncommitted changes option.
For a repository where several agents work every day, three habits are enough:
git worktree list, git worktree prune, and delete agent branches that are merged or abandoned.Once these traps are handled, worktrees disappear into the background. You open a pane, toggle Isolated worktree, and the agent has its own desk. More in Lanes & worktrees.
Agents rarely cheat on purpose, but under pressure to make tests pass they find shortcuts. Here is what to look for — and what PaneScale flags automatically.
The difference between a task that runs overnight and one that wanders is usually a single sentence — the finish line. A short template and examples.
Skipping an agent’s permission prompts saves hours — and occasionally costs a lot more. When it is reasonable, and what to put in place first.