feat(#2109): harness-side idle watchdog to bail on anthropic api stall storms

This commit is contained in:
damocles 2026-07-07 17:17:45 +02:00 committed by mara
commit 5027068e31
7 changed files with 157 additions and 8 deletions

View file

@ -1,6 +1,7 @@
//! Invocation config: how to build one `claude --print` command line.
use std::path::PathBuf;
use std::time::Duration;
/// How a run attaches to a claude session — the low-level session flag. Kept
/// separate from [`Config`] so one config can drive resume + create +
@ -56,4 +57,11 @@ pub struct Config {
pub extra_args: Vec<String>,
/// Program to spawn. `None` defaults to `claude` (resolved on `PATH`).
pub program: Option<String>,
/// Idle watchdog: kill the child and return [`crate::Error::IdleTimeout`]
/// if no stdout line arrives for this long. The timer resets on every
/// stdout line, so a large/slow but still-streaming turn is never cut;
/// only complete output silence trips it. `None` waits indefinitely.
/// The driver stays policy-free — the caller decides the window (and
/// whether to read it from the environment).
pub idle_timeout: Option<Duration>,
}