@@ -883,9 +883,7 @@ def test_randomized_salvage_always_yields_valid_prefix(self):
883883 assert_conversation_valid (self , salvaged )
884884 # fully-closed conversations pass through untouched
885885 if not dangling :
886- self .assertEqual (
887- [m .to_api () for m in salvaged ], [m .to_api () for m in msgs ]
888- )
886+ self .assertEqual ([m .to_api () for m in salvaged ], [m .to_api () for m in msgs ])
889887
890888 def test_randomized_runs_mirror_exact_salvage_to_shared_history (self ):
891889 """End to end: whatever happened during the run (clean finish,
@@ -1041,7 +1039,16 @@ def test_randomized_faulty_tools_never_escape_or_orphan(self):
10411039 session .client .script = [("" , calls ), f"done-{ seed } " ]
10421040 orig = RecordingSession .execute_tool
10431041
1044- def hostile (name , args , call_id = None ):
1042+ def hostile (
1043+ name ,
1044+ args ,
1045+ call_id = None ,
1046+ * ,
1047+ crashers = crashers ,
1048+ nil = nil ,
1049+ orig = orig ,
1050+ session = session ,
1051+ ):
10451052 if name in crashers :
10461053 raise RuntimeError (f"hostile { name } " )
10471054 if name in nil :
@@ -1094,17 +1101,11 @@ def test_randomized_injection_never_splits_tool_rounds(self):
10941101 assert_conversation_valid (self , loop .messages )
10951102 # the injected prompts arrived, in order, as user messages
10961103 injected_pos = [i for i , m in enumerate (loop .messages ) if m .injected ]
1097- self .assertEqual (
1098- [loop .messages [i ].text () for i in injected_pos ], prompts
1099- )
1100- self .assertTrue (
1101- all (loop .messages [i ].role == "user" for i in injected_pos )
1102- )
1104+ self .assertEqual ([loop .messages [i ].text () for i in injected_pos ], prompts )
1105+ self .assertTrue (all (loop .messages [i ].role == "user" for i in injected_pos ))
11031106 # contiguous, and placed before the trailing user message
11041107 # when there is one, otherwise at the tail
1105- self .assertEqual (
1106- injected_pos , list (range (injected_pos [0 ], injected_pos [- 1 ] + 1 ))
1107- )
1108+ self .assertEqual (injected_pos , list (range (injected_pos [0 ], injected_pos [- 1 ] + 1 )))
11081109 if msgs [- 1 ].role == "user" :
11091110 self .assertEqual (injected_pos [- 1 ] + 1 , len (loop .messages ) - 1 )
11101111 self .assertEqual (loop .messages [- 1 ].text (), msgs [- 1 ].text ())
0 commit comments