fix: correct task scheduling and simplify agent internals

Fix queue cancellation, concurrency limits and worker status updates.

Use direct Explorer imports, split the Diagnoser loop into helpers and remove unused tool registration and prompt-builder code.

Correct model caching, endpoint selection and retry handling.
This commit is contained in:
somew1nd committed 2026-09-02 22:58:00 -07:00
1 parent 67248c887e
commit 12d7902a82
92 files changed
+1085 -1763

No files matched your search

+12 -32
View File
@@ -373,9 +373,9 @@ async def test_analyze_task_output_tool(mock_get_llm, mock_ctx):
del _FINISHED_TASKS_LOGS[task_id]
def test_run_adb_command_tool_subclass_and_registry():
"""Verify RunAdbCommandTool is a subclass of ArtemisTool and properly registered."""
from artemis.tools.base import ArtemisTool, ToolRegistry
def test_run_adb_command_tool_subclass():
"""Verify RunAdbCommandTool is a subclass of ArtemisTool."""
from artemis.tools.base import ArtemisTool
from artemis.tools.command_tool import (
RunAdbCommand,
RunAdbCommandArgs,
@@ -392,11 +392,6 @@ def test_run_adb_command_tool_subclass_and_registry():
assert run_adb_command.category == "system"
assert run_adb_command.args_schema == RunAdbCommandArgs
# Registry lookup
reg_tool = ToolRegistry.get("run_adb_command")
assert reg_tool is not None
assert isinstance(reg_tool, RunAdbCommandTool)
# GenAI FunctionDeclaration export
declaration = run_adb_command.to_genai_declaration()
assert declaration.name == "run_adb_command"
@@ -421,9 +416,9 @@ async def test_run_adb_command_tool_mock_driver_execute():
assert "pm list packages" in driver.action_history[-1]["command"]
def test_manage_task_tool_subclass_and_registry():
"""Verify ManageTaskTool is a subclass of ArtemisTool and properly registered."""
from artemis.tools.base import ArtemisTool, ToolRegistry
def test_manage_task_tool_subclass():
"""Verify ManageTaskTool is a subclass of ArtemisTool."""
from artemis.tools.base import ArtemisTool
from artemis.tools.command_tool import (
ManageTask,
ManageTaskArgs,
@@ -440,11 +435,6 @@ def test_manage_task_tool_subclass_and_registry():
assert manage_task.category == "system"
assert manage_task.args_schema == ManageTaskArgs
# Registry lookup
reg_tool = ToolRegistry.get("manage_task")
assert reg_tool is not None
assert isinstance(reg_tool, ManageTaskTool)
# GenAI FunctionDeclaration export
declaration = manage_task.to_genai_declaration()
assert declaration.name == "manage_task"
@@ -488,9 +478,9 @@ async def test_manage_task_tool_direct_execute(mock_ctx):
registry.background.clear()
def test_analyze_task_output_tool_subclass_and_registry():
"""Verify AnalyzeTaskOutputTool is a subclass of ArtemisTool and properly registered."""
from artemis.tools.base import ArtemisTool, ToolRegistry
def test_analyze_task_output_tool_subclass():
"""Verify AnalyzeTaskOutputTool is a subclass of ArtemisTool."""
from artemis.tools.base import ArtemisTool
from artemis.tools.command_tool import (
AnalyzeTaskOutput,
AnalyzeTaskOutputArgs,
@@ -507,11 +497,6 @@ def test_analyze_task_output_tool_subclass_and_registry():
assert analyze_task_output.category == "system"
assert analyze_task_output.args_schema == AnalyzeTaskOutputArgs
# Registry lookup
reg_tool = ToolRegistry.get("analyze_task_output")
assert reg_tool is not None
assert isinstance(reg_tool, AnalyzeTaskOutputTool)
# GenAI FunctionDeclaration export
declaration = analyze_task_output.to_genai_declaration()
assert declaration.name == "analyze_task_output"
@@ -558,9 +543,9 @@ async def test_analyze_task_output_tool_direct_execute(mock_get_llm, mock_ctx):
del _FINISHED_TASKS_LOGS[task_id]
def test_run_short_adb_command_tool_subclass_and_registry():
"""Verify RunShortAdbCommandTool is a subclass of ArtemisTool and properly registered."""
from artemis.tools.base import ArtemisTool, ToolRegistry
def test_run_short_adb_command_tool_subclass():
"""Verify RunShortAdbCommandTool is a subclass of ArtemisTool."""
from artemis.tools.base import ArtemisTool
from artemis.tools.command_tool import (
RunShortAdbCommand,
RunShortAdbCommandArgs,
@@ -577,11 +562,6 @@ def test_run_short_adb_command_tool_subclass_and_registry():
assert run_short_adb_command.category == "system"
assert run_short_adb_command.args_schema == RunShortAdbCommandArgs
# Registry lookup
reg_tool = ToolRegistry.get("run_short_adb_command")
assert reg_tool is not None
assert isinstance(reg_tool, RunShortAdbCommandTool)
# GenAI FunctionDeclaration export
declaration = run_short_adb_command.to_genai_declaration()
assert declaration.name == "run_short_adb_command"