feat: release 1.1.0 with responsive task control
This commit is contained in:
1 parent
057f0c3050
commit
bfcd828fa8
37 files changed
+1601
-151
No files matched your search
@@ -24,6 +24,8 @@ import pytest
|
||||
from artemis.agents.log_analyzer.log_analyzer import LogAnalyzerNode
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.core.tool_failure import ToolFailure
|
||||
from artemis.tools.mobile.read_logs import ReadLogsArgs
|
||||
from artemis.tools.mobile.search_logs import SearchLogsArgs
|
||||
|
||||
_STATUS_CASES = [
|
||||
pytest.param(ToolFailure("Error searching logs: device gone"), "error", id="tool_failure"),
|
||||
@@ -76,3 +78,43 @@ async def test_agent_loop_tool_message_status_is_structural(result, expected_sta
|
||||
assert tool_msgs[0].tool_call_id == "c1"
|
||||
assert tool_msgs[0].status == expected_status
|
||||
assert tool_msgs[0].content == str(result)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_log_cache_normalizes_numeric_tool_arguments_before_running_tools():
|
||||
node = LogAnalyzerNode(ctx=MagicMock(spec=ArtemisContext))
|
||||
read_calls = []
|
||||
|
||||
async def read_raw_logs(lines=200, **kwargs):
|
||||
read_calls.append(lines)
|
||||
return "before\nE/Settings: failed\nafter"
|
||||
|
||||
async def unused_search(**kwargs):
|
||||
pytest.fail("Cached raw logs should be searched locally")
|
||||
|
||||
read_tool = node._wrap_with_caching(
|
||||
StructuredTool.from_function(
|
||||
coroutine=read_raw_logs, name="read_logs", description="read", args_schema=ReadLogsArgs
|
||||
)
|
||||
)
|
||||
search_tool = node._wrap_with_caching(
|
||||
StructuredTool.from_function(
|
||||
coroutine=unused_search,
|
||||
name="search_logs",
|
||||
description="search",
|
||||
args_schema=SearchLogsArgs,
|
||||
)
|
||||
)
|
||||
|
||||
assert await read_tool.coroutine(lines="200") == "before\nE/Settings: failed\nafter"
|
||||
assert await read_tool.coroutine(lines=200) == "before\nE/Settings: failed\nafter"
|
||||
assert await read_tool.coroutine(lines=None) == "before\nE/Settings: failed\nafter"
|
||||
assert read_calls == [200]
|
||||
|
||||
result = await search_tool.coroutine(keyword="Settings", lines="200", context_lines="1")
|
||||
assert "before" in result and "after" in result
|
||||
assert "E/Settings: failed" in result
|
||||
assert "before" not in await search_tool.coroutine(
|
||||
keyword="Settings", lines="200", context_lines=None
|
||||
)
|
||||
assert isinstance(await search_tool.coroutine(keyword="Settings", lines="many"), ToolFailure)
|
||||
Reference in new issue
Block a user