coily dispatch should not mutate .claude/* during startup - poisons its own reap #122

Closed
opened 2026-05-28 00:49:59 +00:00 by coilysiren · 1 comment
Owner

Problem

coily dispatch startup mutates .claude/lockdown-deny.sh and .claude/settings.json (and sometimes .claude/scheduled_tasks.lock) inside the dispatch worktree as part of the lockdown wrapper. coily dispatch reap refuses to clean worktrees with modified or untracked files. Net result: every dispatch session becomes permanently un-reapable after it exits, because the dispatch itself dirties the tree.

Evidence

Six stale dispatch worktrees observed 2026-05-27, all with identical 2-file dirty state, all on branches that have already been merged to origin/main:

  • .dispatch-worktrees/agent-guard/issue-32 (closed)
  • .dispatch-worktrees/backend/issue-91 (+ D .claude/scheduled_tasks.lock)
  • .dispatch-worktrees/coily/issue-258
  • .dispatch-worktrees/repo-recall/issue-254
  • .dispatch-worktrees/session-lattice/issue-37
  • .dispatch-worktrees/voice-flow-learning-loop/issue-20 (merged HEAD message: closes #20)

All six show only:

 M .claude/lockdown-deny.sh
 M .claude/settings.json

The work shipped. The dirt is bookkeeping the dispatch itself wrote.

Fix

coily dispatch should not mutate .claude/* inside the worktree during startup. Kai's call 2026-05-27.

Implementation options to evaluate, in rough preference order:

  1. Don't touch .claude/* at all in the dispatch worktree - read settings from the parent checkout, or generate per-session config under /tmp instead of the working tree.
  2. Reset the .claude/* paths back to HEAD as the dispatch tears down (atexit handler in the wrapper).
  3. As a last resort, teach reap to ignore mutations to a known-bookkeeping-paths allowlist - but that's papering over the root cause.

Out of scope

  • Cleanup of the existing seven stale worktrees. Once the systemic fix is in, git worktree remove --force (or a reap --force) clears them. The work in each is already merged to main; no salvage needed.
  • The orphaned .dispatch-worktrees/gauntlet/issue-39 directory, which is a different failure mode (worktree registration deleted, dir survived). Separate cleanup, rm -rf is safe.
  • The agentic-os/issue-149 worktree, which has a third dirty pattern (.claude/, agentic_os.egg-info/, uv.lock untracked). Likely a related but distinct gitignore-coverage issue.

Context

Discovered while trying to re-dispatch the seven stale worktrees per Kai's instinct, after noticing them in a coily dispatch interactive run for an unrelated issue (agentic-os-kai#364, the icon issue). Most issue refs no longer resolve on GitHub (issues disabled) or Forgejo (404), so re-dispatch was a dead end - which is what surfaced the cleanup question and the underlying bug.

**Problem** `coily dispatch` startup mutates `.claude/lockdown-deny.sh` and `.claude/settings.json` (and sometimes `.claude/scheduled_tasks.lock`) inside the dispatch worktree as part of the lockdown wrapper. `coily dispatch reap` refuses to clean worktrees with modified or untracked files. Net result: every dispatch session becomes permanently un-reapable after it exits, because the dispatch itself dirties the tree. **Evidence** Six stale dispatch worktrees observed 2026-05-27, all with identical 2-file dirty state, all on branches that have already been merged to `origin/main`: - `.dispatch-worktrees/agent-guard/issue-32` (closed) - `.dispatch-worktrees/backend/issue-91` (+ `D .claude/scheduled_tasks.lock`) - `.dispatch-worktrees/coily/issue-258` - `.dispatch-worktrees/repo-recall/issue-254` - `.dispatch-worktrees/session-lattice/issue-37` - `.dispatch-worktrees/voice-flow-learning-loop/issue-20` (merged HEAD message: `closes #20`) All six show only: ``` M .claude/lockdown-deny.sh M .claude/settings.json ``` The work shipped. The dirt is bookkeeping the dispatch itself wrote. **Fix** `coily dispatch` should not mutate `.claude/*` inside the worktree during startup. Kai's call 2026-05-27. Implementation options to evaluate, in rough preference order: 1. Don't touch `.claude/*` at all in the dispatch worktree - read settings from the parent checkout, or generate per-session config under `/tmp` instead of the working tree. 2. Reset the `.claude/*` paths back to HEAD as the dispatch tears down (atexit handler in the wrapper). 3. As a last resort, teach reap to ignore mutations to a known-bookkeeping-paths allowlist - but that's papering over the root cause. **Out of scope** - Cleanup of the existing seven stale worktrees. Once the systemic fix is in, `git worktree remove --force` (or a `reap --force`) clears them. The work in each is already merged to main; no salvage needed. - The orphaned `.dispatch-worktrees/gauntlet/issue-39` directory, which is a different failure mode (worktree registration deleted, dir survived). Separate cleanup, `rm -rf` is safe. - The `agentic-os/issue-149` worktree, which has a third dirty pattern (`.claude/`, `agentic_os.egg-info/`, `uv.lock` untracked). Likely a related but distinct gitignore-coverage issue. **Context** Discovered while trying to re-dispatch the seven stale worktrees per Kai's instinct, after noticing them in a `coily dispatch interactive` run for an unrelated issue (agentic-os-kai#364, the icon issue). Most issue refs no longer resolve on GitHub (issues disabled) or Forgejo (404), so re-dispatch was a dead end - which is what surfaced the cleanup question and the underlying bug.
Author
Owner

Merged into #12 in the 2026-05-29 backlog burn-down. Same dispatch .claude mutation poisons own reap Reopen if it should stand alone.

Merged into #12 in the 2026-05-29 backlog burn-down. Same dispatch .claude mutation poisons own reap Reopen if it should stand alone.
Sign in to join this conversation.
No labels
P0
P1
P2
P3
P4
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-bridge/coily#122
No description provided.