Skip to main content

parent_transcript_for

Function parent_transcript_for 

Source
pub(super) fn parent_transcript_for(subagent_jsonl: &Path) -> Option<PathBuf>
Expand description

The parent session transcript for a subagent transcript.

Claude Code lays these out as …/<session-id>.jsonl alongside a …/<session-id>/subagents/ tree, but members are NOT all at the same depth inside it (scan_subagents_dir’s own doc comment):

<session-id>/subagents/agent-<id>.jsonl                      ← Task-tool (solo)
<session-id>/subagents/workflows/<run-id>/agent-<id>.jsonl   ← Workflow-tool member

So this walks up to the subagents directory rather than assuming it is the immediate parent. Checking only the immediate parent silently excluded every Workflow-tool member — they could never resolve a completion and stayed permanently “interrupted”, i.e. exactly the bug this module exists to fix, left unfixed for that dispatch kind (reagent P1 on #3007).

Returns None when there is no subagents ancestor at all, rather than guessing at a path and reading some unrelated file as a transcript.