@@ -196,9 +196,11 @@ def test_multiline_regex_timeout_preserves_partial_evidence(
196196 monkeypatch : pytest .MonkeyPatch ,
197197) -> None :
198198 timeouts = []
199+ clock = iter ((0.0 , 0.02 ))
200+ monkeypatch .setattr (artifact_integrity .time , "thread_time" , lambda : next (clock ))
199201
200202 class ExpiredPattern :
201- def finditer (self , _text , * , timeout , concurrent ):
203+ def finditer (self , _text , * , pos , timeout , concurrent ):
202204 timeouts .append (timeout )
203205 raise TimeoutError ("regex timed out" )
204206
@@ -230,10 +232,6 @@ async def test_real_multiline_regex_timeout_rejects_installation(
230232 # A deliberately tiny operation budget makes backend timeout enforcement
231233 # deterministic without a fragile wall-clock performance assertion.
232234 monkeypatch .setattr (artifact_integrity , "_MULTILINE_PROMPT_PATTERN_SECONDS" , 0.000001 )
233- monkeypatch .setattr (
234- artifact_integrity , "_multiline_prompt_injection_line" ,
235- lambda * _args : pytest .fail ("ordinary projection reached the multiline fallback" ),
236- )
237235 content = (_letter_lines ("without telling user" ) + " " ) * 2400
238236 _write_bundle (tmp_path , {"SKILL.md" : content })
239237
@@ -383,7 +381,9 @@ def compete_for_gil() -> None:
383381 class ContendedPattern :
384382 def finditer (self , text , ** kwargs ):
385383 matches = original .finditer (text , ** kwargs )
386- first = next (matches )
384+ first = next (matches , None )
385+ if first is None :
386+ return
387387 start_work .set ()
388388 yield first
389389 yield from matches
0 commit comments