Skip to content

pickup.sh reports a worktree's uncommitted paths as "dirty in the primary checkout", the one line the never-work-there rule depends on #1012

Description

@lex00

What

Run from inside a worktree, scripts/pickup.sh printed:

dirty 30 uncommitted path(s) in the primary checkout

and then listed paths belonging to the worktree it was run from, not to the primary checkout. Verified directly at the time: the primary checkout had zero modified tracked files, and its only untracked entries were .terraform/ plugin directories dated Aug 16.

Found by the board re-measure worker (PR #1011) while running from /Users/alex/Documents/checkouts/intentius/wt/board-remeasure-release.

Why it is worth fixing rather than living with

That line is load-bearing. HANDOFF.md's "Pick up here" table makes dirty paths in the primary checkout a disposition an agent must act on before anything else, and CLAUDE.md opens with "Never work in the primary checkout", recording five agents who got it wrong on 2026-08-29 and the silent not_run with exit 0 that followed. A false positive on exactly that line trains a reader to skim past it, which is the failure mode the rule exists to prevent.

Do

Find where pickup.sh computes the dirty set and make it ask the primary checkout specifically, rather than inheriting the caller's repository context: git -C "$PRIMARY" status --porcelain with $PRIMARY resolved from the known path or from git rev-parse --git-common-dir, not a bare git status that resolves to whichever worktree invoked the script.

Prove it both ways, since a check that cannot fail is not a check: with the primary genuinely dirty it must still report, and run from a dirty worktree with a clean primary it must report nothing. The second is the case that is broken today.

While there, check whether any other section of pickup.sh has the same context leak, since several of them shell out to git.

Refs #1011.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions