@@ -62,66 +62,6 @@ def tearDown(self):
6262 def doCreateRepo (self ):
6363 pass
6464
65- def test_restore_pending_confirmations_and_autorun_queue (self ):
66- """Restores pending tool confirmations + READ_ONLY auto queue from history."""
67- # One READ_ONLY tool (auto-run) + one WRITE tool (needs confirmation)
68- messages = [
69- {"role" : "user" , "content" : "hi" },
70- {
71- "role" : "assistant" ,
72- "content" : "" ,
73- "tool_calls" : [
74- {
75- "id" : "call_auto" ,
76- "type" : "function" ,
77- "function" : {"name" : "git_status" , "arguments" : "{}" },
78- },
79- {
80- "id" : "call_confirm" ,
81- "type" : "function" ,
82- "function" : {"name" : "git_checkout" , "arguments" : '{"branch":"main"}' },
83- },
84- ],
85- },
86- ]
87-
88- # Spy on confirmation insertion.
89- self .chatWidget .messages .insertToolConfirmation = MagicMock ()
90-
91- self .chatWidget ._loadMessagesFromHistory (messages , addToChatBot = True )
92-
93- # Pending tool_call_ids are tracked.
94- self .assertIn ("call_auto" , self .chatWidget ._awaitingToolResults )
95- self .assertIn ("call_confirm" , self .chatWidget ._awaitingToolResults )
96-
97- # READ_ONLY tool should be queued for auto-run.
98- self .assertTrue (self .chatWidget ._autoToolQueue )
99- queued = self .chatWidget ._autoToolQueue [0 ]
100- self .assertEqual ("git_status" , queued [0 ])
101- self .assertEqual ("call_auto" , queued [3 ])
102-
103- # Metadata is restored for both ids.
104- self .assertEqual (
105- ToolType .READ_ONLY ,
106- self .chatWidget ._toolCallMeta ["call_auto" ]["tool_type" ],
107- )
108- self .assertEqual (
109- "git_checkout" ,
110- self .chatWidget ._toolCallMeta ["call_confirm" ]["tool_name" ],
111- )
112-
113- # Confirmation UI should be restored for the WRITE tool.
114- self .chatWidget .messages .insertToolConfirmation .assert_called ()
115- called_ids = [
116- kwargs .get ("toolCallId" )
117- for _ , kwargs in self .chatWidget .messages .insertToolConfirmation .call_args_list
118- ]
119- self .assertIn ("call_confirm" , called_ids )
120-
121- # Auto-run resume is scheduled (we patched the method, so it should be callable).
122- self .wait (50 )
123- self .assertTrue (self .chatWidget ._startNextAutoToolIfIdle .called )
124-
12565 def test_restore_does_not_mark_pending_when_results_exist (self ):
12666 """If tool results exist immediately after tool_calls, nothing is pending."""
12767 messages = [
0 commit comments