Keep a running agent's session off commits it did not make
Commit

With no TTY (or commit_linking=always), prepare-commit-msg stamped the first ACTIVE session without checking the commit's content, and post-commit condensed ACTIVE and live-task sessions without an overlap check. A hookless agent, script, queue job or GUI client committing an unrelated file while another agent was mid-turn in the same worktree got that agent's trailer and its transcript.
A session is now foreign to a commit when its recorded owner is alive, absent from an ancestry walk that reached init, and not named by any agent's caller-session variable. A foreign session skips the fast path, links only on staged-file overlap, and condenses only on committed-file overlap. No owner, a dead or unverifiable owner, a truncated walk and Windows keep today's behaviour. The ancestry walk now goes up to 64 levels so a deep hook chain can still be judged.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Entire-Checkpoint: 01M47DQKPPVH5S7QE2Y6Z844F2