feat: add agentic video analysis and clarify action results

Report device actions as dispatched and preserve full failure details. Route
Flash through McpActionExecutor and use ToolFailure across helper tools and
agent loops instead of inferring failure from response text.

Require model-provided descriptions for coordinate targets. Keep observed
element metadata separate from those descriptions in safety checks, visual
summaries, history, and frontend labels.

Add Gemini Interactions API video analysis with configurable processing mode,
chunk size, and timeouts. Centralize Google provider capabilities and token
usage normalization, and update google-genai to 2.22.0.

Preserve system instructions on follow-up interactions, replan pending chunks
when falling back to static processing, and reject unanswered native video
and audio segments instead of caching placeholder results. Keep helper-tool
failure status intact through history tools and committee calls.

Validation: 1,762 Python unit tests passed (3 skipped), 40 frontend formatter
tests passed, and the production UI build completed. Ruff lint, formatting,
the quality ratchet, and git diff checks passed.
This commit is contained in:
somew1nd committed 2026-09-08 17:05:54 -07:00
1 parent 611d1a0947
commit a45daf23f8
120 files changed
+6301 -1710

No files matched your search

+5 -4
View File
@@ -51,6 +51,7 @@ class SpawnLogReaderArgs(BaseModel):
from langgraph.prebuilt import InjectedState
from artemis.core.tool_failure import ToolFailure, is_tool_failure
from artemis.context import ArtemisContext
from artemis.data_engine.trace import (
CURRENT_TRACE_ID,
@@ -102,7 +103,7 @@ class LogAnalyzerNode:
return self._raw_log_cache[cache_key]
result = await original_coroutine(**kwargs)
if isinstance(result, str) and not result.startswith("Failed to read logs"):
if isinstance(result, str) and not is_tool_failure(result):
self._raw_log_cache[cache_key] = result
return result
@@ -130,7 +131,7 @@ class LogAnalyzerNode:
)
except Exception as e:
logger.error(f"Failed to search logs locally: {e}")
return f"Error searching logs: {e}"
return ToolFailure(f"Error searching logs: {e}")
# If not cached, fetch them once via read_logs (or the original tool, which will fetch them)
# Note: search_logs itself fetches and filters. We can let the original_coroutine run,
@@ -161,7 +162,7 @@ class LogAnalyzerNode:
)
except Exception as e:
logger.error(f"Failed to fetch and search logs: {e}")
return f"Error searching logs: {e}"
return ToolFailure(f"Error searching logs: {e}")
# Fallback to standard tool caching for other tools
serialized_args = json.dumps(kwargs, sort_keys=True)
@@ -276,7 +277,7 @@ class LogAnalyzerNode:
elif not isinstance(result, str):
result = str(result)
span.result = result
if result.startswith("Error"):
if is_tool_failure(result_obj):
status = "error"
span.status = "failed"
span.error = result
@@ -16,6 +16,7 @@ from pathlib import Path
from typing import Annotated
from langchain_core.messages import HumanMessage, SystemMessage, ToolMessage
from langchain_core.tools import tool
from artemis.core.tool_failure import ToolFailure, is_tool_failure
from artemis.context import ArtemisContext
from artemis.services.llm import get_llm, invoke_llm_with_timeout_message
from artemis.tools.mobile.search_logs import search_and_merge_logs
@@ -147,15 +148,15 @@ class TaskOutputAnalyzerNode:
try:
result = tool_to_run.invoke(args)
except Exception as e:
result = f"Failed to run tool {tool_name}: {e}"
result = ToolFailure(f"Failed to run tool {tool_name}: {e}")
else:
result = f"Error: Tool {tool_name} not found."
result = ToolFailure(f"Error: Tool {tool_name} not found.")
current_messages.append(
ToolMessage(
tool_call_id=tc["id"],
content=str(result),
status="success" if not str(result).startswith("Error") else "error",
status="error" if is_tool_failure(result) else "success",
)
)