fix(review,investigate): kill agent process groups so Ctrl+C can't hang

main

Commit

dipree3mo ago

Agent CLIs (codex, claude, ...) spawn helper grandchildren (sandbox, MCP servers) that inherit the agent's stdout pipe. exec.CommandContext's default Cancel only SIGKILLs the agent itself, so on Ctrl+C / reviewer timeout the grandchildren stay alive holding the pipe open. The reviewer template drains Events() (the stdout pipe) to EOF before calling Wait, so the read blocks forever, the per-agent goroutine never finishes, the fan-in channel never closes, and RunMulti hangs — the dashboard sits on "cancelling" indefinitely. Investigate's cmd.Run has the same exposure.

Add procutil.TerminateOnCancel (process-group SIGKILL on cancel + a WaitDelay backstop) and apply it on the agent spawn path in both the review template and the investigate loop. Mirrors the existing checkpoint/remote git-transport fix.

Entire-Checkpoint: 15b7eec39aa5

Checkpoints

Fix Multi-Agent Run Hanging and Finalization Issues

PiOpus 4.8
View session
Checkpoint 1