--- status: resolved parent: "[[094-pi-subagent-result-delivery-spec-task|Pi subagent result delivery specification]]" claimed-by: 019fc04b-8b68-74cc-835c-da630d49fb38 claimed-at: 2026-08-01T22:26:56-04:00 resolved-at: 2026-08-01T22:33:51-04:00 blocked-by: - "[[096-pi-subagent-labeled-work-items-implementation|Pi subagent labeled work items]]" tags: - ticket/implementation --- # Pi subagent clearable terminal work ## Question Implement current-session terminal subagent visibility so completed, failed, cancelled, and timed-out children stay visible and retrievable until explicitly cleared. ## What to build Terminal children should remain visible in the current-session subagent work set until the parent or human explicitly clears them. Terminal result retrieval should keep working until clear. Completion awareness should be non-blocking and should identify the child label and terminal outcome. Clearing should remove terminal children from the visible work set without implying workflow-specific reconciliation. ## Acceptance criteria - [x] Terminal children no longer disappear from the visible current-session list because of a TTL. - [x] A clear or dismiss command or tool removes terminal children from the visible work set. - [x] Terminal results remain retrievable until cleared. - [x] Completion notices include the child label and terminal state. - [x] Multiple terminal transitions can be noticed without requiring `subagent_wait`. - [x] Tests cover terminal retention, result retrieval before clear, and removal after clear. ## Implementation Notes Current-session reliability is sufficient. Do not add cross-restart result persistence. Implemented on branch `subagent-labels` in commit `8c85c00 feat(pi): retain terminal subagent work`. Terminal records now stay in `subagent_list` and the widget until `subagent_clear`, `/subagent-clear`, or `Supervisor.clearTerminal()` removes terminal records. Result and status retrieval remain available until clear, after which cleared ids are unknown. 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/config.test.ts`. Review found no blocking findings after updating the current-extension inventory artifact. Accepted non-blocking evidence limitations: the clear tool and command are not covered by an extension-level fake Pi registration test, and multiple terminal notice wiring remains covered through supervisor milestone behavior plus notification formatting rather than a multi-child notification integration test.