Files
ai-artifacts/projects/dotfiles/099-pi-subagent-child-activity-capture-implementation.md

43 lines
2.5 KiB
Markdown

---
status: resolved
claimed-by: "019fc05b-7c70-7d68-af2b-89e9b6b17950"
claimed-at: "2026-08-01T22:44:20-04:00"
resolved-at: "2026-08-01T22:56:57-04:00"
parent: "[[094-pi-subagent-result-delivery-spec-task|Pi subagent result delivery specification]]"
blocked-by:
- "[[096-pi-subagent-labeled-work-items-implementation|Pi subagent labeled work items]]"
tags:
- ticket/implementation
---
# Pi subagent child activity capture
## Question
Capture structured child RPC or session activity in the subagent runner and supervisor so last-activity summaries and read-only inspection can be driven from current-session state.
## What to build
The child runner and supervisor should retain structured current-session activity events instead of only a coarse last event name.
The captured model should support concise last-activity summaries for status/list/widget output and preserve enough message and tool lifecycle information to render a basic Pi-like child transcript later.
Existing final-result collection through `get_last_assistant_text` should continue to work.
## Acceptance criteria
- [x] Child records retain structured activity events from RPC or session data.
- [x] Activity capture includes enough message and tool lifecycle data to reconstruct a basic Pi-like child transcript.
- [x] Status or list output can expose a concise current activity summary without dumping transcript bodies.
- [x] Final result completion through `get_last_assistant_text` still works.
- [x] Tests cover event capture, ordering where relevant, and state updates.
## Implementation Notes
Use the existing RPC event stream as the first feed.
Do not assume an embeddable promptless `InteractiveMode` exists.
Implemented on branch `subagent-labels` in commit `ede3c05 feat(pi): capture subagent activity events`.
The RPC runner now forwards structured event payloads, the supervisor retains full current-session activity events behind `Supervisor.activity`, and status/list/widget surfaces expose summary-only `currentActivity` and `activityHistory` data.
Verification passed with `nix shell nixpkgs#nodejs_24 nixpkgs#tsx -c tsx --test modules/agents/pi/extensions/subagents/supervisor.test.ts modules/agents/pi/extensions/subagents/runner.test.ts modules/agents/pi/extensions/subagents/ui.test.ts modules/agents/pi/extensions/subagents/config.test.ts` and `nix flake check`.
Review found no blocking findings.
A non-blocking risk note remains that full activity retention is unbounded in process memory for the current session.