# a review subagent detached HEAD in the main session's worktree. 3 commits never reached the PR, and every push looked fine — retained record

> Retained reddit record from reddit:ClaudeCode.

Canonical: https://highsignal.app/data/records/2c5d96de32b49928

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:ClaudeCode)  published 2026-11-17 14:20 ingested 2026-11-18 02:42

[original source ↗](https://www.reddit.com/r/ClaudeCode/comments/1xylnge/a_review_subagent_detached_head_in_the_main/)

## retained text



```
short version, from a day of letting claude code carry a PR on its own: two things went wrong and neither showed an error.

the main session pointed a reviewer subagent at a commit, and the subagent checked that commit out in the same worktree the main session was working in. that detached HEAD. the main session didn't notice and made 3 more commits, all on the detached HEAD, none on the branch.

each \`git push -q origin <branch>\` printed only the pre-push hook's output and returned normally, because the branch hadn't moved, so there was nothing to push. \`-q\` hid the "Everything up-to-date" line. the PR stayed on the old commit, and github later marked it conflicting.

the second one, same day: \`tail gate.log && git commit ... && gh pr create\`. the checks had failed, but \`tail\` succeeded, so the commit and the PR went through anyway, and the session wrote "all passed" in the PR. it had to go back and correct that.

what the sessions do now (it's in their memory notes):- \`git branch --show-current\` before committing in a worktree- after a push, compare \`git rev-parse origin/<branch>\` with HEAD- no \`-q\` on push- a reviewer gets the diff command or its own checkout, never the main session's worktree

has a subagent ever changed state in a checkout you only meant it to read?
```



document fetched 2026-11-18 00:44 · canonical https://reddit.com/r/ClaudeCode/comments/1xylnge/a_review_subagent_detached_head_in_the_main
