Implement comprehensive watchdog timeout mechanism to prevent indefinite hangs when child process wedges. All four timeout types are now enforced: Timeout Types: - PTY first-output timeout (default 90s): Detects if child produces no PTY output - Stream-json first-output timeout (default 90s): Detects if child emits no stream-json events - Overall timeout (default 3600s): Maximum session duration - Stop hook timeout (default 120s): Detects if Stop hook doesn't fire after prompt injection Timeout Behavior: - Sends SIGTERM to child process - Signals event loop via self-pipe to wake up - Calls kill_child() which waits 2s then SIGKILL if needed - Writes clear diagnostic to stderr - Tears down temp resources via CleanupGuard - Exits with code 124 (GNU timeout convention) CLI Arguments: - --timeout <seconds>: Overall timeout - --first-output-timeout <seconds>: PTY first-output timeout - --stream-json-timeout <seconds>: Stream-json first-output timeout - --stop-hook-timeout <seconds>: Stop hook watchdog timeout Testing: - All 90 unit tests pass (6 watchdog-specific tests) - Integration tests verify end-to-end timeout behavior This ensures marathon loop/NEEDLE can retry cleanly instead of hanging indefinitely. |
||
|---|---|---|
| .. | ||
| fixtures | ||
| integration | ||
| cli.rs | ||
| emitter.rs | ||
| hooks.rs | ||
| integration.rs | ||
| pty_integration.rs | ||
| startup.rs | ||
| stop_poller.rs | ||
| terminal.rs | ||
| transcript.rs | ||
| version_compat.rs | ||
| watchdog.rs | ||