Snapshot at subagent stop even before the session's first turn end

main

Commit

Soph2d ago

Issue #2653: a background child that finishes while its parent's turn is still running, followed by a commit in that turn, had its line credited to the user. The subagent-stop snapshot failed because the session metadata directory a turn end creates did not exist yet, so the mid-turn completion notification diffed against the base. snapshotAgentStop now creates the directory first.

Tests cover the issue's orderings: commit right after the child stops, and a mid-turn notification prompt before the commit (with and without a parent edit earlier in the turn). The subagent-stop baseline test now pins the invariants that hold under full snapshots: the snapshot holds the user's pre-existing work, and the first step that knows its transcript position sets the anchor.

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

Checkpoints

Fix Claude Code Subagent Attribution Issues

Claude CodeOpus 5.5
View session
Checkpoint 1