Implement a complete watchdog timeout system that ensures hung child processes are terminated cleanly with proper diagnostics and cleanup. Features: - PTY first-output timeout (default 90s): detects if child produces no PTY output - Stream-json first-output timeout (default 90s): detects if child produces no stream-json events - Overall session timeout (default 3600s): prevents indefinite hangs - Stop hook watchdog timeout (default 120s): detects if Stop hook doesn't fire after prompt injection Timeout handling: - Sends SIGTERM to child process when timeout fires - kill_child() ensures SIGTERM → SIGKILL sequence (2s grace period) - Writes clear diagnostic to stderr indicating timeout type - Emits stream-json error event for downstream consumers - CleanupGuard ensures temp dir/FIFO cleanup on all exit paths - Returns Error::Timeout and exits non-zero (code 3) for retry loop Fixes: - Pass temp_dir_path to Watchdog so stream-json monitoring works correctly - Remove unused constants (duplicates of watchdog module defaults) - Improve mock-claude binary path resolution for workspace builds This prevents the indefinite hang that occurs when Claude Code wedges during session initialization or tool use, ensuring marathon loops and NEEDLE can retry cleanly instead of blocking forever. Bead-Id: bf-2f5 |
||
|---|---|---|
| .. | ||
| 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 | ||