pub struct LoopGuard { /* private fields */ }Implementations§
Source§impl LoopGuard
impl LoopGuard
pub fn record_attempt(&mut self, tool: &str, args: &Value) -> AttemptDecision
pub fn record_outcome(&mut self, tool: &str, ok: bool) -> OutcomeDecision
Sourcepub fn reset_failures(&mut self)
pub fn reset_failures(&mut self)
Clear consecutive-failure counters so a granted continuation (e.g. a
long-horizon “change approach” nudge issued after a OutcomeDecision::Halt)
doesn’t immediately re-halt on the same tool. Identical-call counts are
left intact, so blindly repeating the exact same call is still blocked.
Sourcepub fn note_state_changed(&mut self)
pub fn note_state_changed(&mut self)
Clear identical-call counts after the workspace changed (a state-mutating
tool succeeded). Re-running the exact same verify/read call after an
intervening edit is legitimate work — not a redundant loop — so it must
not stay blocked. Without this, an iterative edit → re-run same test
loop trips the 3× block and the model is forced into meaningless
arg-reordering to dodge the guard (defeating its purpose). Hammering the
same call with no intervening change still blocks, because nothing
calls this between those identical attempts.
Sourcepub fn is_state_mutating_tool(tool: &str) -> bool
pub fn is_state_mutating_tool(tool: &str) -> bool
Whether a tool’s success means the workspace materially changed, so the
identical-call counter should be cleared (see Self::note_state_changed).