Skip to content

The Watchdog

The Rust AI6 daemon monitors provider events, terminal output and accepted operator messages for each Agent Run. Provider events and terminal bytes count as activity; an accepted follow-up message resets both inactivity and repeated-output timing.

After ten quiet seconds at a recognized terminal prompt, AI6 moves the Mission to blocked so an operator can respond. If the Run then remains inactive for five minutes, AI6 marks it stalled, interrupts and closes the Run, and ends the active operation. New terminal output moves a blocked Mission back to working.

The Rust monitor also detects repeated terminal lines. It strips ANSI control sequences, treats carriage returns and line feeds as line boundaries, and tracks a bounded least- recently-used history of non-empty lines. Fifty repeated lines with no novel line for five minutes stalls the Mission and closes its operation. The monitor bounds partial lines to 4 KiB and retains at most 4,096 line digests.

Defaults

Limit Rust daemon default
Quiet period before stalled 300 s
Quiet period before blocked at a prompt 10 s
Repeated lines before loop tracking applies 50
Novel-output period before loop stalled 300 s
Maximum remembered line digests 4,096
Maximum Run runtime Disabled
Digit normalization for loop matching Disabled

WatchdogConfig exposes these settings to Rust callers, and ServeConfig::with_watchdog applies one configuration to Runs started by that daemon. ai6 serve exposes the same limits through --stall-timeout, --loop-timeout, --loop-min-lines, --blocked-after, --max-runtime, --history and --normalize-digits; timeout values accept fractional, non-negative seconds. Each Agent can override selected settings in its [agent.<id>.limits] table; values layer over daemon settings and merge through Agent inheritance.

Lifecycle

queued ─► working ⇄ blocked ─► done | failed | abandoned
             │         │
             └────┬────┘
                  ▼
               stalled

blocked is a recoverable prompt wait. stalled closes the active operation while keeping the Mission record and its safe house, touched or not, for a resume or retry; the safe house is finished when the Mission reaches a final state.

A Mission blocked with reason green-ink waits for a person to sign a step its Agent asked for (see Green ink). The watchdog is paused meanwhile: nothing stalls, loops or runs out its maximum runtime while it waits, and the time spent waiting does not count toward that runtime. The decision resumes it with fresh deadlines.

An Agent whose Runs keep stalling or looping is stopped across Missions: three stalls or loops within 24 hours quarantine it (the count, the window and the trigger are Operation settings). A Run stopped by a budget is blocked with reason budget, and a Mission whose Agent is quarantined is quarantined:

working | blocked | stalled | parked ─► quarantined ─► queued (next Agent) | abandoned

Run the watchdog

The Rust watchdog runs as part of the daemon:

cargo run -p ai6 --features cli -- serve --help

The watchdog runs inside ai6 serve; it is not a separate supervisor command.