Skip to content

Never run a worktree thread in the main checkout - #522

Merged
currentbits merged 1 commit into
mainfrom
coder/no-silent-worktree-fallback-511
Aug 18, 2026
Merged

currentbits merged 1 commit into
mainfrom
coder/no-silent-worktree-fallback-511

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Summary

Fixes #511. If a thread was asked to run in a worktree and git worktree add fails, the turn does not start. The agent never falls back to the project checkout.

Why

A failed worktree (disk full, locked index, branch collision, dirty submodule) used to drop isolation: the orchestrator kept going in the user's working branch. The UI could not tell. Every isolation guarantee Solenta advertises was void.

A missing worktree folder had the same hole: clearMissingWorktree cleared the pointer and startRun / workflows continued with thread.worktreePath || project.path, posting "running in the project folder instead."

What changed

  • setupWorktree surfaces verbatim git stderr, not the first line of Command failed: git worktree add ….
  • startRun / startWorkflowRun record the user prompt, that error as an event, status: failed, and lastError. The existing Retry-turn button attaches. Zero agent processes spawn. pendingWorktree stays set so retry rematerializes.
  • A vanished worktree re-arms pendingWorktree and rematerializes. No checkout fallback. Workflows throw rather than use project.path.

There is no "run in main anyway" default. Isolation is fail-closed.

Tests

node --test --test-timeout=60000 \
  electron/test/worktree-setup-fail.test.js \
  electron/test/worktree-cleanup.test.js \
  electron/test/worktree-create.test.js \
  electron/test/runner.test.js \
  electron/test/orchestrator-threads.test.js \
  electron/test/workflow.test.js

84 pass. The new file puts a fake git on PATH that fails only worktree add and asserts the runner records the setup error with no Claude spawn.

  • PR created by the Grok agent

If git worktree add fails, record the verbatim stderr on the thread
and refuse to start the turn. A missing worktree rematerializes
instead of silently falling back to the project folder.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit 5e31f92 into main Aug 18, 2026
2 of 6 checks passed
@currentbits
currentbits deleted the coder/no-silent-worktree-fallback-511 branch October 3, 2026 16:07
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.

Worktree creation failure must never silently run the agent in the main checkout

1 participant