From 321ca0614cd67133c540ab7caa6494d2ed5059d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriele=20Cin=C3=A0?= Date: Tue, 3 Mar 2026 21:07:07 +0000 Subject: [PATCH 1/2] fix(claude-agent): warn on empty result, debug-log hook skips - activities.py: log WARNING when Claude returns 0 messages (catches silent failures from model connectivity issues e.g. VPN/proxy down) - hooks.py: log DEBUG when pre/post_tool_use hooks bail early due to missing task_id, making it visible why tool call logs aren't appearing Co-Authored-By: Claude Sonnet 4.6 --- .../lib/core/temporal/plugins/claude_agents/activities.py | 5 +++++ .../lib/core/temporal/plugins/claude_agents/hooks/hooks.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/agentex/lib/core/temporal/plugins/claude_agents/activities.py b/src/agentex/lib/core/temporal/plugins/claude_agents/activities.py index ccd6a9f94..4801da6ff 100644 --- a/src/agentex/lib/core/temporal/plugins/claude_agents/activities.py +++ b/src/agentex/lib/core/temporal/plugins/claude_agents/activities.py @@ -145,6 +145,11 @@ async def run_claude_agent_activity( await handler.cleanup() results = handler.get_results() + if not results.get("messages"): + logger.warning( + f"[run_claude_agent_activity] Claude returned 0 messages — " + f"possible model connectivity issue (task_id={task_id}, workspace={workspace_path})" + ) logger.debug(f"Returning results with keys: {results.keys()}") return results diff --git a/src/agentex/lib/core/temporal/plugins/claude_agents/hooks/hooks.py b/src/agentex/lib/core/temporal/plugins/claude_agents/hooks/hooks.py index 5f629fc17..2ffb02f2b 100644 --- a/src/agentex/lib/core/temporal/plugins/claude_agents/hooks/hooks.py +++ b/src/agentex/lib/core/temporal/plugins/claude_agents/hooks/hooks.py @@ -66,6 +66,7 @@ async def pre_tool_use( Empty dict (allow execution to proceed) """ if not self.task_id or not tool_use_id: + logger.debug(f"Hooks skipping pre_tool_use — task_id={self.task_id}, tool_use_id={tool_use_id}") return {} tool_name = input_data.get("tool_name", "unknown") @@ -133,6 +134,7 @@ async def post_tool_use( Empty dict """ if not self.task_id or not tool_use_id: + logger.debug(f"Hooks skipping post_tool_use — task_id={self.task_id}, tool_use_id={tool_use_id}") return {} tool_name = input_data.get("tool_name", "unknown") From bbe691e83fd0b5f291e3f06335639b022320a2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriele=20Cin=C3=A0?= Date: Tue, 3 Mar 2026 21:09:45 +0000 Subject: [PATCH 2/2] fix(claude-agent): raise error instead of silently returning empty messages Returning 0 messages means the model was unreachable (VPN down, proxy error, etc). Logging a warning and succeeding caused Temporal to mark the activity as completed, the workflow to continue pointlessly, and the root cause to be invisible. Raising RuntimeError lets Temporal retry the activity or surface the failure clearly in the workflow timeline. --- .../lib/core/temporal/plugins/claude_agents/activities.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/agentex/lib/core/temporal/plugins/claude_agents/activities.py b/src/agentex/lib/core/temporal/plugins/claude_agents/activities.py index 4801da6ff..e4ce7af15 100644 --- a/src/agentex/lib/core/temporal/plugins/claude_agents/activities.py +++ b/src/agentex/lib/core/temporal/plugins/claude_agents/activities.py @@ -146,9 +146,10 @@ async def run_claude_agent_activity( results = handler.get_results() if not results.get("messages"): - logger.warning( + raise RuntimeError( f"[run_claude_agent_activity] Claude returned 0 messages — " - f"possible model connectivity issue (task_id={task_id}, workspace={workspace_path})" + f"possible model connectivity issue (task_id={task_id}, workspace={workspace_path}). " + f"Check that the model API is reachable." ) logger.debug(f"Returning results with keys: {results.keys()}") return results