fix: prevent false timeout failures and release 1.2.2
This commit is contained in:
1 parent
1dc2b0c686
commit
e1e26772d9
18 files changed
+189
-22
No files matched your search
@@ -14,6 +14,7 @@
|
||||
|
||||
"""Unit tests for VisualStepSummarizer and Context Compressor in Flash profile."""
|
||||
|
||||
import asyncio
|
||||
from unittest.mock import ANY, AsyncMock, Mock, call
|
||||
from uuid import uuid4
|
||||
import pytest
|
||||
@@ -106,6 +107,29 @@ async def test_summarizer_retries_independently(mock_context):
|
||||
assert attempt_count == 2
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_visual_summary_uses_its_own_configured_timeout(mock_context):
|
||||
summarizer = VisualStepSummarizer(mock_context, retry_limit=0, timeout_seconds=0.01)
|
||||
|
||||
async def slow_response(_messages):
|
||||
await asyncio.sleep(1)
|
||||
|
||||
summarizer._llm = Mock()
|
||||
summarizer._llm.ainvoke = AsyncMock(side_effect=slow_response)
|
||||
summarizer.dispatch(
|
||||
step_number=1,
|
||||
action_name="click",
|
||||
action_args={"target": [100, 100]},
|
||||
pre_img_bytes=b"pre",
|
||||
post_img_bytes=b"post",
|
||||
exec_outcome="Clicked",
|
||||
)
|
||||
|
||||
await summarizer.flush()
|
||||
assert summarizer.has_failed(1)
|
||||
assert summarizer._llm.ainvoke.await_count == 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_summarizer_bounded_retry_marks_failed(mock_context):
|
||||
"""Persistent failures exit after 1 + retry_limit attempts with an explicit failed state."""
|
||||
|
||||
Reference in new issue
Block a user