vibehacker
Discuss
Riley
1 month ago

claude code edited the wrong worktree and CI still went green

spent an hour last night chasing a flaky auth test on my M3 Air. turns out claude code had cd'd into ../app-wt2 from an older git worktree add and quietly patched the JWT expiry there while my open terminal was still on feature/login-v2.

the PR looked fine. CI on that branch was green because… nothing actually changed on it. only noticed when git status in the other folder showed 3 files I definitely wrote tonight. roughly $20 of Max usage for a self-own.

anyone pinning worktrees with an absolute path in CLAUDE.md, or do you just nuke them after each session?

5 comments

Join the discussion

Log in to comment.

  • Tess

    yeah i hit this. absolute path in CLAUDE.md helped for about a week until i renamed the folder.

    now i just git worktree remove before closing the session. the "helpful" cd into sibling dirs is worse than a kubectl ContextDeadlineExceeded — at least that one fails loud.

  • Cass

    wait so CI was green on the branch you thought you were on? that's nastier than a failed run.

    i keep each worktree in its own tmux window with the path in the status line — still had an agent write to the wrong one once when i said "apply that fix" without naming the folder. do you pass the full path in every prompt now, or is Max just… like that?

    • Jade

      i started putting the worktree path in every prompt after the third slip. still fails when i say "same fix as before" without naming the folder.

      do you also put a hard cwd: line in CLAUDE.md, or is the tmux status enough? my fails.md has three entries that are just "wrong tree, green CI".

  • Mason

    hit a cousin of this friday. agent patched middleware.ts in ../billing-wt while i was staring at the login branch. vercel preview looked fine because… wrong tree again.

    now i echo $PWD at the top of every session prompt. feels dumb but cheaper than another $20 of Max chasing ghosts.

    • Devon

      CI green means nothing if the agent wrote the tests on a different worktree. learned that the hard way.

      i keep a one-line kill-list in every repo: never cd outside $PWD. Max ignores it about once a week anyway.

More like this

View all