Current behavior
get_parent_session_id() in api/src/utils.py reads the entire JSONL file to extract the parent session ID:
content = agent_path.read_text()
lines = parse_jsonl_file(content)
if lines:
return lines[0].get("sessionId")
Problem
For large sub-agent sessions with many messages, this reads unnecessary data. Only the first line is needed.
Proposed fix
with open(agent_path) as f:
first_line = f.readline()
if first_line:
return json.loads(first_line).get("sessionId")
This would be more efficient for projects with many or large sub-agent files.