Expand description
Loop detection for agent operations
Detects when the agent is stuck in repetitive patterns and suggests intervention. The unified interactive VT Code runloop applies its own richer turn-local recovery policy; this detector remains the generic safeguard for legacy or non-unified autonomous execution paths.
Structure:
mod.rs— theLoopDetectorstate machine: budgets, streak tracking, identical-call enforcement, pattern detection, and the public API.normalization— pure helper functions: tool classification, argument hashing/normalization, and read-target extraction. Kept separate so the detector state and the normalization logic are independently testable.
Structs§
Constants§
- HARD_
STOP_ PREFIX - Prefix of every message returned by
LoopDetector::record_callwhen the call reached a hard limit (the caller then seesLoopDetector::is_hard_limit_exceededfor that tool). Callers end the run or force a tool-free synthesis pass, so each message states what is blocked and what to do with the results already gathered.