Files
ai-artifacts/projects/dotfiles/047-pi-subagents-lifecycle-controls-task.md
2026-08-01 14:05:09 -04:00

1.2 KiB

status, parent, blocked-by, tags
status parent blocked-by tags
open 027-pi-subagents-implementation-spec-task
046-pi-subagents-minimal-tracer-bullet-task
ticket/task/afk

Add cancellation, timeout, and shutdown lifecycle controls

Question

Extend the supervisor so cancellation, timeouts, process failures, and parent shutdown cleanup use the same tracked lifecycle path without leaking child processes.

What to build

Make child lifecycle robust after the minimal spawn path exists. The supervisor should own cancellation, startup and runtime timeout behavior, process failure handling, and shutdown cleanup. Cancellation must be idempotent and should cooperate with Pi RPC before escalating to process-tree termination.

Acceptance criteria

  • Cancelling a running subagent is idempotent and reaches cancelled.
  • Startup and runtime timeout paths reach timed_out.
  • Child process exit before semantic settlement reaches a failure state with diagnostics.
  • Parent session shutdown cancels supervised children.
  • Lifecycle tests cover abort, process close, timeout, and repeated cancel calls.

Implementation Notes

Use agent_settled as semantic completion. Use process close for resource cleanup after settlement.