The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(hooks): fold the interrupt-path comments into one WHY line
teknium1761fa5d49708
diff --git a/agent/shell_hooks.py b/agent/shell_hooks.pyindex 486efa9343a..2bc8abc7a6c 100644--- a/agent/shell_hooks.py+++ b/agent/shell_hooks.py@@ -318,12 +318,11 @@ def _spawn(spec: ShellHookSpec, stdin_json: str) -> Dict[str, Any]:try:stdout, stderr = proc.communicate(input=stdin_json, timeout=spec.timeout)except BaseException as exc:- # BaseException, not Exception: Ctrl+C raises KeyboardInterrupt here, and the hook leads its own- # process group (above), so the terminal's SIGINT never reaches it — it would keep running.+ # BaseException: the hook leads its own process group, so Ctrl+C's SIGINT never reaches it — only we can.kill_process_tree(proc) # the whole tree — forked helpers holding the pipes would stall the drainwith suppress(Exception):proc.communicate(timeout=1)- if not isinstance(exc, Exception): # KeyboardInterrupt / SystemExit: reap the hook, then propagate+ if not isinstance(exc, Exception):raiseif not isinstance(exc, subprocess.TimeoutExpired): # pragma: no cover — defensivereturn failed(str(exc))