Skip to content

dispatch prompt: EnterWorktree-first isolation; manual git worktree add stalls Claude bg agents on approval - #107

Merged
MJohnson459 merged 1 commit into
mainfrom
task-320-enterworktree-dispatch
Aug 1, 2026
Merged

dispatch prompt: EnterWorktree-first isolation; manual git worktree add stalls Claude bg agents on approval#107
MJohnson459 merged 1 commit into
mainfrom
task-320-enterworktree-dispatch

Conversation

@MJohnson459

Copy link
Copy Markdown
Contributor

Rewrites the dispatch preamble's two branch blocks so the agent isolates with
its harness's own worktree mechanism first, and adds a repo-level permission
allow so a Claude dispatch cannot stall on the approval prompt either way.

Why

The blocks told every agent to isolate with git worktree add <path> -b <branch>. For a Claude Code background agent that is a trap: the harness
rejects file edits until its own EnterWorktree tool has run, and pointing
that tool at a pre-made worktree raises an interactive approval prompt a
headless session can never answer. On 2026-07-31 three of four dispatches
(#312, #313, #294) followed the instruction literally and froze about two
minutes in, sitting running for eleven hours on dead sessions; the one agent
that used name-based EnterWorktree instead (#314) finished.

What changed

  • crates/voro/src/dispatch.rs: new BRANCH_ISOLATE_SENTENCE, shared by
    ASSIGNED_BRANCH_TEMPLATE and UNASSIGNED_BRANCH_TEMPLATE beside the
    existing register and rebase sentences so the three cannot drift. It names
    the harness mechanism first (EnterWorktree, "creates and enters a worktree
    under .claude/worktrees/ unprompted"), demotes git worktree add <path> -b <name> to the fallback for agents without one, and — since such a tool names
    the branch itself — spells out the git switch -c <name> that puts the work
    on the branch Voro tracks. The unassigned template now uses <name>
    throughout instead of mixing <name> and <branch>.
  • Invariants held: never modify the primary checkout, never push, early
    registration via voro set --branch, and the stale-base rebase sentence are
    all unchanged and still shared.
  • .claude/settings.json (new): allows EnterWorktree, so even a path-entry
    call cannot hang a headless job in this checkout.
  • docs/DESIGN.md §11 worktree lifecycle: records that how the agent makes its
    worktree is its own business, why the harness mechanism is preferred, and
    that a nested worktree is immaterial downstream because open and cleanup
    both find it through git worktree list.

Verification

cargo test --workspace (542 tests) and cargo clippy --workspace --all-targets -- -D warnings both clean. New test
preamble_puts_the_harness_worktree_tool_ahead_of_git_worktree_add asserts,
for both the assigned and unassigned cases, that the prompt names
EnterWorktree, carries git switch -c <branch>, and mentions the harness
mechanism before the manual fallback. Both rendered preambles were printed in
full and read end to end. This task itself was done through the new flow —
EnterWorktree, then git switch -c task-320-enterworktree-dispatch — with no
approval prompt.

Branch task-320-enterworktree-dispatch is committed locally and not pushed.
Follow-up filed as #324 (nested worktrees show untracked in projects that do
not ignore .claude/worktrees/).

The branch blocks told every dispatched agent to isolate with `git worktree
add <path> -b <branch>`. For a Claude Code background agent that is a trap:
the harness rejects file edits until its own EnterWorktree tool has run, and
pointing that tool at a pre-made worktree raises an approval prompt a headless
session can never answer. Three of four dispatches on 2026-07-31 followed the
instruction literally and froze two minutes in, sitting `running` for eleven
hours on dead sessions; the one agent that used name-based EnterWorktree
instead finished.

Both templates now name the harness mechanism first and keep `git worktree
add` as the fallback for agents without one. Because such a tool names the
branch itself, the block also spells out the `git switch -c <branch>` that
puts the work on the branch Voro tracks. The isolation wording moves into a
shared const beside the register and rebase sentences so the two templates
cannot drift.

The repo's `.claude/settings.json` allows EnterWorktree outright, so even a
path-entry call cannot hang a headless job here.

Verified with `cargo test --workspace` and `cargo clippy --all-targets -D
warnings`; both rendered preambles were printed and read end to end.
@MJohnson459
MJohnson459 merged commit bb3919f into main Aug 1, 2026
6 checks passed
@MJohnson459
MJohnson459 deleted the task-320-enterworktree-dispatch branch August 1, 2026 17:58
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