From 51a36f1fc1c33379be4bd1eb4d333f93effac3c9 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Mon, 27 Jul 2026 23:34:20 +0500 Subject: [PATCH] test: set _incremental_persistence_failed=False on MagicMock agent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #72425 added getattr(agent, '_incremental_persistence_failed', False) checks at the top of execute_tool_calls_{sequential,concurrent,segmented}. A bare MagicMock auto-creates a truthy value for any attribute access, so the interrupt-skip test's MagicMock agent short-circuited before appending cancelled-tool messages — assert len(messages)==3 got 0. Production is unaffected: run_conversation resets the flag to False explicitly at turn start (conversation_loop.py:~1028). --- tests/tools/test_interrupt.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/tools/test_interrupt.py b/tests/tools/test_interrupt.py index aca47df9e19bb..5552ea496b181 100644 --- a/tests/tools/test_interrupt.py +++ b/tests/tools/test_interrupt.py @@ -122,6 +122,11 @@ class TestPreToolCheck: agent._interrupt_requested = True agent.log_prefix = "" agent._persist_session = MagicMock() + # PR #72425: execute_tool_calls_* read _incremental_persistence_failed + # via getattr at loop top. A bare MagicMock auto-creates a truthy value + # for any attribute access, which would short-circuit the interrupt + # skip path before any cancelled-tool messages are appended. + agent._incremental_persistence_failed = False # Import and call the method import types