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..e4ce7af15 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,12 @@ async def run_claude_agent_activity( await handler.cleanup() results = handler.get_results() + if not results.get("messages"): + raise RuntimeError( + f"[run_claude_agent_activity] Claude returned 0 messages — " + 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 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")