Skip to content

The agent that grows with you

fix(delegate): include explicit timeout metadata in subagent results

mahdiwafy8e163852d893
diff --git a/tools/delegate_tool.py b/tools/delegate_tool.py
index 67963b2cecc..50f58c1a0d2 100644
--- a/tools/delegate_tool.py
+++ b/tools/delegate_tool.py
@@ -2094,8 +2094,11 @@ def _run_single_child(
_err = (
f"Subagent timed out after {child_timeout}s with "
f"{child_api_calls} API call(s) completed — likely "
- f"stuck on a slow API call or unresponsive network request."
+ f"stuck on a slow API call, tool call, or unresponsive "
+ f"network request."
)
+ if diagnostic_path:
+ _err += f" Diagnostic: {diagnostic_path}"
else:
_err = str(_timeout_exc)
@@ -2107,6 +2110,13 @@ def _run_single_child(
"exit_reason": "timeout" if is_timeout else "error",
"api_calls": child_api_calls,
"duration_seconds": duration,
+ "timeout_seconds": child_timeout if is_timeout else None,
+ "timed_out_after_seconds": duration if is_timeout else None,
+ "timeout_phase": (
+ "before_first_llm_call" if is_timeout and child_api_calls == 0
+ else "after_llm_calls" if is_timeout
+ else None
+ ),
"_child_role": getattr(child, "_delegate_role", None),
"diagnostic_path": diagnostic_path,
}