fix(tui): count loop guard blocks as failures (#1658)

This commit is contained in:
Hunter Bown
2026-05-15 17:43:07 -05:00
committed by GitHub
parent b834548897
commit b080891efa
3 changed files with 37 additions and 6 deletions
+7 -1
View File
@@ -47,6 +47,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
legacy Windows console hosts now automatically enable low-motion rendering,
disable fancy animations, and resolve `synchronized_output = "auto"` to off
so streaming redraws do not overlap or visibly flicker (#1590).
- **LoopGuard blocks now count as failed tool calls.** Identical tool-call
blocks now return a failed tool result instead of a success, so repeated
blocked checklist/tool retries can trip the existing failure warning and halt
path instead of spinning indefinitely (#1574).
### Thanks
@@ -59,7 +63,9 @@ picker catalog work harvested from #1201. Thanks to
**[@kunpeng-ai-lab](https://github.com/kunpeng-ai-lab)** for the Windows
composer scroll fix harvested from #1578, and **WuMing
([@asdfg314284230](https://github.com/asdfg314284230))** for the Windows
PowerShell flicker fix harvested from #1591.
PowerShell flicker fix harvested from #1591. Thanks to
**[@maker316](https://github.com/maker316)** for the LoopGuard/checklist loop
report in #1574.
## [0.8.37] - 2026-05-14
+7 -1
View File
@@ -47,6 +47,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
legacy Windows console hosts now automatically enable low-motion rendering,
disable fancy animations, and resolve `synchronized_output = "auto"` to off
so streaming redraws do not overlap or visibly flicker (#1590).
- **LoopGuard blocks now count as failed tool calls.** Identical tool-call
blocks now return a failed tool result instead of a success, so repeated
blocked checklist/tool retries can trip the existing failure warning and halt
path instead of spinning indefinitely (#1574).
### Thanks
@@ -59,7 +63,9 @@ picker catalog work harvested from #1201. Thanks to
**[@kunpeng-ai-lab](https://github.com/kunpeng-ai-lab)** for the Windows
composer scroll fix harvested from #1578, and **WuMing
([@asdfg314284230](https://github.com/asdfg314284230))** for the Windows
PowerShell flicker fix harvested from #1591.
PowerShell flicker fix harvested from #1591. Thanks to
**[@maker316](https://github.com/maker316)** for the LoopGuard/checklist loop
report in #1574.
## [0.8.37] - 2026-05-14
+23 -4
View File
@@ -7,6 +7,10 @@
use super::*;
fn loop_guard_block_tool_result(message: String) -> ToolResult {
ToolResult::error(message).with_metadata(json!({"loop_guard": "identical_tool_call"}))
}
impl Engine {
pub(super) async fn handle_deepseek_turn(
&mut self,
@@ -1214,10 +1218,7 @@ impl Engine {
loop_guard.record_attempt(&tool_name, &tool_input)
{
crate::logging::warn(message.clone());
guard_result = Some(
ToolResult::success(message)
.with_metadata(json!({"loop_guard": "identical_tool_call"})),
);
guard_result = Some(loop_guard_block_tool_result(message));
}
plans.push(ToolExecutionPlan {
@@ -2023,6 +2024,24 @@ mod tests {
assert!(!should_hold_turn_for_subagents(0, 0));
}
#[test]
fn loop_guard_block_tool_result_counts_as_failure() {
let result = loop_guard_block_tool_result("Blocked: repeated call".to_string());
assert!(
!result.success,
"LoopGuard blocks must count as tool failures so repeated blocked calls can trip halt handling"
);
assert_eq!(
result
.metadata
.as_ref()
.and_then(|m| m.get("loop_guard"))
.and_then(|v| v.as_str()),
Some("identical_tool_call")
);
}
#[test]
fn resolve_auto_effort_ignores_stored_turn_metadata() {
let messages = vec![Message {