Repository navigation
chore(git): ignore .worktrees/ so a session worktree cannot dirty the tree - #1200
Conversation
… tree Two sanctioned placements exist for a session worktree: the subrepo's own .worktrees/ (charly's rulebook) and the umbrella's .worktrees/<slug>/<repo>/ (Part II #2). Both leave an untracked .worktrees/ inside charly when the first is used, and charly task verify then fails with 'charly: dirty working tree' -- measured 2026-11-18, with the tree clean by every other measure. One line. Neither placement is wrong; the tree just has to be blind to both. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (documentation reviewed)
Review — BLOCKHead SHA: Change class: config — one functional Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…d on a live system Two BLOCKs. A3 -- documentation reviewed is forbidden: .gitignore is a config file and the diff adds a functional rule line, not a comment. Re-tiered to analysed on a live system, backed by the demonstration below. R7 -- the pasted 'git status --short | wc -l -> 0' was taken AFTER the stale worktrees were removed, so it returned 0 with or without the rule. It never exercised .worktrees/ and could not fail. The plant now discriminates, with the rule REMOVED and a file inside the directory: $ git status --short ?? .worktrees/ $ git check-ignore -q .worktrees/x/f; echo $? 1 and with the rule in place: $ git status --short | grep -c worktrees 0 $ git check-ignore -v .worktrees/x/f .gitignore:169:.worktrees/ .worktrees/x/f An EMPTY directory is invisible to git whether or not the rule exists -- that is why the first evidence was vacuous. A file inside it is what makes the directory visible, and that is what the stale session worktrees held. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
Review — PASSHead SHA: Change class: config — one functional Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
charly task verifyfails today, and the cause is an untracked directory that neither placement rule forbids.Measured:
And the working tree:
.worktrees/is not a change. It is where a session worktree lives — and two sanctioned placements exist: the subrepo's own.worktrees/(charly's rulebook) and the umbrella's.worktrees/<slug>/<repo>/(the umbrella's Part II #2). Neither is wrong; the tree just has to be blind to both.The change
One line in
.gitignore:Head
How tested
The same directory, with the rule in place:
check-ignorenames the exact line that matches, and its exit code flips from 1 to 0.A count taken after the directory was already gone would have proven nothing: an EMPTY directory is
invisible to git whether or not the rule exists, so the first version of this evidence could not fail.
A file inside it is what makes the directory visible, and that is what the stale session worktrees held.
Change-class gate: none exists for a
.gitignorerule.charly task verifyis the gate that was FAILINGbefore this change on exactly this directory, and it is re-run on the final tree.
Rulebook compliance
/charly-internals:git-workflow(a git-hygiene change) loaded.task verify's "dirty working tree" over a treegit statuscalls clean apart from one untracked directory. Root cause: neither placement rule's directory is gitignored. The missed control:task verifytreats ANY untracked path as dirt, which is correct for a build artifact and wrong for a sanctioned worktree location.task verifyis not told to skip./tmp/goal/charly-wt, outside both sanctioned locations, so it cannot itself dirty the tree it is editing.git statusstated first; no force-push..gitignorerule..gitignorechange. The gate that owns it ischarly task verify, RED before this change on exactly this directory.Change classification
Kind: one
.gitignorerule.Breaking change + rollback: none — and here is why it breaks nothing. No file becomes untracked by this rule; it only stops
git statusreporting a directory that holds worktrees. Reverting restores the failure.Filed issues
None — this is the fix for the failure it names.
Files changed
.gitignore.worktrees/Agent: lead
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)