Skip to content

ExtractSpawnedAgentIDs misses subagents spawned before startLine offset #329

@khaong

Description

@khaong

Problem

ExtractAllModifiedFiles and CalculateTotalTokenUsage both extract spawned agent IDs from the transcript slice starting at startLine. When startLine > 0 (i.e., after a checkpoint), subagents spawned in earlier turns are not discovered.

If those earlier-spawned subagents continue writing to their transcript files in later turns, their file modifications will be missed.

Impact

After a checkpoint is saved (advancing CheckpointTranscriptStart), modifications by previously-spawned subagents become invisible to both file extraction and token usage calculation.

Suggested Fix

Extract agent IDs from the full transcript (startLine=0) while still limiting main-agent modified file extraction to startLine. This ensures all subagent transcripts are scanned regardless of when the agent was spawned.

Context

Identified during review of #323 (ENT-297 fix). This is a pre-existing limitation shared by CalculateTotalTokenUsage.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions