fix(ui): complete exact approval continuation

This commit is contained in:
RaresKeY
2026-08-15 05:51:54 +00:00
parent 1b09c568d8
commit fd50561af6
8 changed files with 59 additions and 23 deletions
+14 -4
View File
@@ -37,7 +37,7 @@ def _patch_common(monkeypatch):
monkeypatch.setattr(al, "estimate_tokens", lambda *a, **k: 10, raising=False)
async def _fake_exec(block, *a, **k):
return ("bash", {"output": "ok", "exit_code": 0})
return (block.tool_type, {"output": "ok", "exit_code": 0})
monkeypatch.setattr(al, "execute_tool_block", _fake_exec, raising=False)
@@ -58,8 +58,14 @@ def _run_loop(monkeypatch, round_text, max_rounds=2):
def test_emits_rounds_exhausted_when_cap_hit_mid_task(monkeypatch):
_patch_common(monkeypatch)
# Every round returns a tool block -> never "done" -> loop exhausts the cap.
events = _run_loop(monkeypatch, "```bash\necho hi\n```", max_rounds=2)
# Use a system-owned interaction result so this remains a loop-control test:
# Bash output is workspace-derived and now correctly pauses for exact user
# approval before a later Bash call.
events = _run_loop(
monkeypatch,
'```update_plan\n{"plan":"- [ ] keep going"}\n```',
max_rounds=2,
)
assert any(e.get("type") == "rounds_exhausted" for e in events), events
@@ -84,7 +90,11 @@ def test_emits_intent_nudge_exhausted_when_cap_is_exhausted(monkeypatch):
def test_emits_loop_breaker_triggered_when_loop_breaker_trips(monkeypatch):
_patch_common(monkeypatch)
events = _run_loop(monkeypatch, "```bash\necho hi\n```", max_rounds=6)
events = _run_loop(
monkeypatch,
'```update_plan\n{"plan":"- [ ] keep going"}\n```',
max_rounds=6,
)
guard = next((e for e in events if e.get("type") == "loop_breaker_triggered"), None)
assert guard is not None, events