Skip to content

fix(sessions): classify nested subagent children by layout - #77

Merged
dreadster3 merged 2 commits into
mainfrom
pi-subagents/worker-Fix-pi-web-subagent-classification-regression-in-home-dreadster-Documents-projec-ab741de4-6cf7c19-40ab-s0-t0
Oct 11, 2026
Merged

dreadster3 merged 2 commits into
mainfrom
pi-subagents/worker-Fix-pi-web-subagent-classification-regression-in-home-dreadster-Documents-projec-ab741de4-6cf7c19-40ab-s0-t0

Conversation

@dreadster3

@dreadster3 dreadster3 commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Why:

  • pi-subagents 0.77.0 writes a parentSession header into nested child session files (changelog #2763).
  • mapScannedSession (lib/session-reader.ts) tested that header before the pi-subagents layout heuristic, so nested children classified as relation.kind: "fork": top-level Sessions rows, empty family.subagents, and the Agents tab hidden by hasSubagentSessions.

What:

  • The nested layout (piSubagentChildLayout / derivePiSubagentRelation) now outranks the generic parentSession fork branch. Legacy readSubagentRun metadata still resolves first.
  • One new case in lib/pi-subagents-relations.test.mjs: a nested child whose header carries parentSession yields relation.kind === "subagent" and appears in listSessionFamilies(...).subagents — for both the run-<N> and the detached async-<runId> layouts.
  • Note on the precedence added to docs/agents/sessions.md and docs/agents/subagents.md.

Evidence — on-disk child header sample (~/.pi/agent/sessions/<enc>/<parentBase>/<childUuid>/run-0/session.jsonl):

{"type":"session","version":3,"id":"<childUuid>","cwd":"/path","timestamp":"...","parentSession":"/home/u/.pi/agent/sessions/<enc>/<parentBase>.jsonl"}

Gates: npx tsc --noEmit clean; eslint clean on changed files; npm test adds 1 passing test with no new failures (base main fails 101 tests identically: MCP/config/trust environment cases and the lib/skill-lock XDG case).

pi-subagents 0.77.0 writes a parentSession header into nested child session
files (#2763), so the generic fork branch shadowed the pi-subagents layout
heuristic: children landed in the Sessions list with an empty family and
the Agents tab disappeared. Check the nested layout first; legacy
readSubagentRun metadata still resolves first.
@dreadster3
dreadster3 merged commit c21ec05 into main Oct 11, 2026
2 checks passed
@dreadster3
dreadster3 deleted the pi-subagents/worker-Fix-pi-web-subagent-classification-regression-in-home-dreadster-Documents-projec-ab741de4-6cf7c19-40ab-s0-t0 branch October 11, 2026 19:44
This was referenced Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant