Attribute by agent-busy windows: busy subagents, full snapshots

main

Commit

Soph2d ago

Attribution drew its human/agent boundary at every prompt and snapshotted only the files a transcript named. Background subagents broke both: their completion writes no snapshot, Claude Code's task notification starts a turn the instant they stop, and shell writes are named by no transcript, so their lines were credited to the user.

The boundary is now a busy worktree. A prompt records a user diff only when no session in the worktree is mid-turn and no background subagent of any session is alive; a subagent whose session owner process is gone pauses (owner is re-recorded at every session start, for Codex's restarted daemon). Every shadow snapshot captures the whole dirty worktree via git status, resets files reverted since the previous one, and reports what changed; a snapshot is also taken when a background subagent stops and when a turn's change detection found nothing. Snapshot changes join FilesTouched except those the window's user diff counted, and not for a window whose user diff is unknown.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Entire-Checkpoint: 01M43DTCPVE25J3K1RP9EKAQY8

Checkpoints

Fix Claude Code Subagent Attribution Issues

Claude CodeOpus 5.5
View session
Checkpoint 1