feat(delegate): diagnostic dump when a subagent times out with 0 API calls#15105
Merged
Conversation
…calls
When a subagent in delegate_task times out before making its first LLM
request, write a structured diagnostic file under
~/.hermes/logs/subagent-timeout-<sid>-<ts>.log capturing enough state
for the user (and us) to debug the hang. The old error message —
'Subagent timed out after Ns with no response. The child may be stuck
on a slow API call or unresponsive network request.' — gave no
observability for the 0-API-call case, which is the hardest to reason
about remotely.
The diagnostic captures:
- timeout config vs actual duration
- goal (truncated to 1000 chars)
- child config: model, provider, api_mode, base_url, max_iterations,
quiet_mode, platform, _delegate_role, _delegate_depth
- enabled_toolsets + loaded tool names
- system prompt byte/char count (catches oversized prompts that
providers silently choke on)
- tool schema count + byte size
- child's get_activity_summary() snapshot
- Python stack of the worker thread at the moment of timeout
(reveals whether the hang is in credential resolution, transport,
prompt construction, etc.)
Wiring:
- _run_single_child captures the worker thread via a small wrapper
around child.run_conversation so we can look up its stack at
timeout.
- After a FuturesTimeoutError, we pull child.get_activity_summary()
to read api_call_count. If 0 AND it was a timeout (not a raise),
_dump_subagent_timeout_diagnostic() is invoked.
- The returned path is surfaced in the error string so the parent
agent (and therefore the user / gateway) sees exactly where to look.
- api_calls > 0 timeouts keep the old 'stuck on slow API call'
phrasing since that's the correct diagnosis for those.
This does NOT change any behavior for successful subagent runs,
non-timeout errors, or subagents that made at least one API call
before hanging.
Tests: 7 cases (tests/tools/test_delegate_subagent_timeout_diagnostic.py)
- output format + required sections + field values
- long-goal truncation with [truncated] marker
- missing / already-exited worker thread branches
- unwritable HERMES_HOME/logs/ returns None without raising
- _run_single_child wiring: 0 API calls → dump + diagnostic_path in error
- _run_single_child wiring: N>0 API calls → no dump, old message
Refs: #14726
nekorytaylor666
pushed a commit
to nekorytaylor666/hermes-agent
that referenced
this pull request
Apr 24, 2026
…calls (NousResearch#15105) When a subagent in delegate_task times out before making its first LLM request, write a structured diagnostic file under ~/.hermes/logs/subagent-timeout-<sid>-<ts>.log capturing enough state for the user (and us) to debug the hang. The old error message — 'Subagent timed out after Ns with no response. The child may be stuck on a slow API call or unresponsive network request.' — gave no observability for the 0-API-call case, which is the hardest to reason about remotely. The diagnostic captures: - timeout config vs actual duration - goal (truncated to 1000 chars) - child config: model, provider, api_mode, base_url, max_iterations, quiet_mode, platform, _delegate_role, _delegate_depth - enabled_toolsets + loaded tool names - system prompt byte/char count (catches oversized prompts that providers silently choke on) - tool schema count + byte size - child's get_activity_summary() snapshot - Python stack of the worker thread at the moment of timeout (reveals whether the hang is in credential resolution, transport, prompt construction, etc.) Wiring: - _run_single_child captures the worker thread via a small wrapper around child.run_conversation so we can look up its stack at timeout. - After a FuturesTimeoutError, we pull child.get_activity_summary() to read api_call_count. If 0 AND it was a timeout (not a raise), _dump_subagent_timeout_diagnostic() is invoked. - The returned path is surfaced in the error string so the parent agent (and therefore the user / gateway) sees exactly where to look. - api_calls > 0 timeouts keep the old 'stuck on slow API call' phrasing since that's the correct diagnosis for those. This does NOT change any behavior for successful subagent runs, non-timeout errors, or subagents that made at least one API call before hanging. Tests: 7 cases (tests/tools/test_delegate_subagent_timeout_diagnostic.py) - output format + required sections + field values - long-goal truncation with [truncated] marker - missing / already-exited worker thread branches - unwritable HERMES_HOME/logs/ returns None without raising - _run_single_child wiring: 0 API calls → dump + diagnostic_path in error - _run_single_child wiring: N>0 API calls → no dump, old message Refs: NousResearch#14726
justrhoto
pushed a commit
to justrhoto/hermes-agent
that referenced
this pull request
Apr 24, 2026
…calls (NousResearch#15105) When a subagent in delegate_task times out before making its first LLM request, write a structured diagnostic file under ~/.hermes/logs/subagent-timeout-<sid>-<ts>.log capturing enough state for the user (and us) to debug the hang. The old error message — 'Subagent timed out after Ns with no response. The child may be stuck on a slow API call or unresponsive network request.' — gave no observability for the 0-API-call case, which is the hardest to reason about remotely. The diagnostic captures: - timeout config vs actual duration - goal (truncated to 1000 chars) - child config: model, provider, api_mode, base_url, max_iterations, quiet_mode, platform, _delegate_role, _delegate_depth - enabled_toolsets + loaded tool names - system prompt byte/char count (catches oversized prompts that providers silently choke on) - tool schema count + byte size - child's get_activity_summary() snapshot - Python stack of the worker thread at the moment of timeout (reveals whether the hang is in credential resolution, transport, prompt construction, etc.) Wiring: - _run_single_child captures the worker thread via a small wrapper around child.run_conversation so we can look up its stack at timeout. - After a FuturesTimeoutError, we pull child.get_activity_summary() to read api_call_count. If 0 AND it was a timeout (not a raise), _dump_subagent_timeout_diagnostic() is invoked. - The returned path is surfaced in the error string so the parent agent (and therefore the user / gateway) sees exactly where to look. - api_calls > 0 timeouts keep the old 'stuck on slow API call' phrasing since that's the correct diagnosis for those. This does NOT change any behavior for successful subagent runs, non-timeout errors, or subagents that made at least one API call before hanging. Tests: 7 cases (tests/tools/test_delegate_subagent_timeout_diagnostic.py) - output format + required sections + field values - long-goal truncation with [truncated] marker - missing / already-exited worker thread branches - unwritable HERMES_HOME/logs/ returns None without raising - _run_single_child wiring: 0 API calls → dump + diagnostic_path in error - _run_single_child wiring: N>0 API calls → no dump, old message Refs: NousResearch#14726
YeahloYip
pushed a commit
to YeahloYip/hermes-agent
that referenced
this pull request
Apr 29, 2026
When a subagent times out after making N>0 API calls, the lead agent previously received no visibility into what tool was last running or whether its result was partial. This made it impossible to distinguish "tool ran to completion, next LLM request stalled" from "tool itself is hanging". Two prior commits addressed adjacent cases: - NousResearch#1175 (commit 7997569): tool_trace + tokens added to normal-completion results - NousResearch#15105 (commit 7634c13): diagnostic_path log written for 0-API-call timeouts This patch fills the gap for N-API-call timeouts by: 1. Building tool_trace from result["messages"] in the timeout path (mirrors the logic already present in the normal-completion path at ~line 1556). Returns tool_trace, last_tool, and last_tool_status in the timeout result dict so the lead can inspect the final tool outcome without a second round-trip. 2. Enriching the error message for api_calls>0 timeouts to include the value of current_tool from get_activity_summary(), replacing the generic "stuck on a slow API call" message with e.g.: "Subagent timed out after 300s with 3 API call(s) completed — last tool was 'web_fetch' (likely slow response). The tool may have completed; check tool_trace for result_bytes." 3. Adding a SKILL.md that documents the full diagnosis procedure for lead agents: diagnosis matrix (api_calls × last_tool × last_tool_status), step-by-step workflow, common pitfalls, and verification checklist. Also adds: skill/skills/software-development/subagent-timeout-diagnostics/
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
…calls (NousResearch#15105) When a subagent in delegate_task times out before making its first LLM request, write a structured diagnostic file under ~/.hermes/logs/subagent-timeout-<sid>-<ts>.log capturing enough state for the user (and us) to debug the hang. The old error message — 'Subagent timed out after Ns with no response. The child may be stuck on a slow API call or unresponsive network request.' — gave no observability for the 0-API-call case, which is the hardest to reason about remotely. The diagnostic captures: - timeout config vs actual duration - goal (truncated to 1000 chars) - child config: model, provider, api_mode, base_url, max_iterations, quiet_mode, platform, _delegate_role, _delegate_depth - enabled_toolsets + loaded tool names - system prompt byte/char count (catches oversized prompts that providers silently choke on) - tool schema count + byte size - child's get_activity_summary() snapshot - Python stack of the worker thread at the moment of timeout (reveals whether the hang is in credential resolution, transport, prompt construction, etc.) Wiring: - _run_single_child captures the worker thread via a small wrapper around child.run_conversation so we can look up its stack at timeout. - After a FuturesTimeoutError, we pull child.get_activity_summary() to read api_call_count. If 0 AND it was a timeout (not a raise), _dump_subagent_timeout_diagnostic() is invoked. - The returned path is surfaced in the error string so the parent agent (and therefore the user / gateway) sees exactly where to look. - api_calls > 0 timeouts keep the old 'stuck on slow API call' phrasing since that's the correct diagnosis for those. This does NOT change any behavior for successful subagent runs, non-timeout errors, or subagents that made at least one API call before hanging. Tests: 7 cases (tests/tools/test_delegate_subagent_timeout_diagnostic.py) - output format + required sections + field values - long-goal truncation with [truncated] marker - missing / already-exited worker thread branches - unwritable HERMES_HOME/logs/ returns None without raising - _run_single_child wiring: 0 API calls → dump + diagnostic_path in error - _run_single_child wiring: N>0 API calls → no dump, old message Refs: NousResearch#14726
aj-nt
pushed a commit
to aj-nt/hermes-agent
that referenced
this pull request
May 1, 2026
…calls (NousResearch#15105) When a subagent in delegate_task times out before making its first LLM request, write a structured diagnostic file under ~/.hermes/logs/subagent-timeout-<sid>-<ts>.log capturing enough state for the user (and us) to debug the hang. The old error message — 'Subagent timed out after Ns with no response. The child may be stuck on a slow API call or unresponsive network request.' — gave no observability for the 0-API-call case, which is the hardest to reason about remotely. The diagnostic captures: - timeout config vs actual duration - goal (truncated to 1000 chars) - child config: model, provider, api_mode, base_url, max_iterations, quiet_mode, platform, _delegate_role, _delegate_depth - enabled_toolsets + loaded tool names - system prompt byte/char count (catches oversized prompts that providers silently choke on) - tool schema count + byte size - child's get_activity_summary() snapshot - Python stack of the worker thread at the moment of timeout (reveals whether the hang is in credential resolution, transport, prompt construction, etc.) Wiring: - _run_single_child captures the worker thread via a small wrapper around child.run_conversation so we can look up its stack at timeout. - After a FuturesTimeoutError, we pull child.get_activity_summary() to read api_call_count. If 0 AND it was a timeout (not a raise), _dump_subagent_timeout_diagnostic() is invoked. - The returned path is surfaced in the error string so the parent agent (and therefore the user / gateway) sees exactly where to look. - api_calls > 0 timeouts keep the old 'stuck on slow API call' phrasing since that's the correct diagnosis for those. This does NOT change any behavior for successful subagent runs, non-timeout errors, or subagents that made at least one API call before hanging. Tests: 7 cases (tests/tools/test_delegate_subagent_timeout_diagnostic.py) - output format + required sections + field values - long-goal truncation with [truncated] marker - missing / already-exited worker thread branches - unwritable HERMES_HOME/logs/ returns None without raising - _run_single_child wiring: 0 API calls → dump + diagnostic_path in error - _run_single_child wiring: N>0 API calls → no dump, old message Refs: NousResearch#14726
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…calls (NousResearch#15105) When a subagent in delegate_task times out before making its first LLM request, write a structured diagnostic file under ~/.hermes/logs/subagent-timeout-<sid>-<ts>.log capturing enough state for the user (and us) to debug the hang. The old error message — 'Subagent timed out after Ns with no response. The child may be stuck on a slow API call or unresponsive network request.' — gave no observability for the 0-API-call case, which is the hardest to reason about remotely. The diagnostic captures: - timeout config vs actual duration - goal (truncated to 1000 chars) - child config: model, provider, api_mode, base_url, max_iterations, quiet_mode, platform, _delegate_role, _delegate_depth - enabled_toolsets + loaded tool names - system prompt byte/char count (catches oversized prompts that providers silently choke on) - tool schema count + byte size - child's get_activity_summary() snapshot - Python stack of the worker thread at the moment of timeout (reveals whether the hang is in credential resolution, transport, prompt construction, etc.) Wiring: - _run_single_child captures the worker thread via a small wrapper around child.run_conversation so we can look up its stack at timeout. - After a FuturesTimeoutError, we pull child.get_activity_summary() to read api_call_count. If 0 AND it was a timeout (not a raise), _dump_subagent_timeout_diagnostic() is invoked. - The returned path is surfaced in the error string so the parent agent (and therefore the user / gateway) sees exactly where to look. - api_calls > 0 timeouts keep the old 'stuck on slow API call' phrasing since that's the correct diagnosis for those. This does NOT change any behavior for successful subagent runs, non-timeout errors, or subagents that made at least one API call before hanging. Tests: 7 cases (tests/tools/test_delegate_subagent_timeout_diagnostic.py) - output format + required sections + field values - long-goal truncation with [truncated] marker - missing / already-exited worker thread branches - unwritable HERMES_HOME/logs/ returns None without raising - _run_single_child wiring: 0 API calls → dump + diagnostic_path in error - _run_single_child wiring: N>0 API calls → no dump, old message Refs: NousResearch#14726
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…calls (NousResearch#15105) When a subagent in delegate_task times out before making its first LLM request, write a structured diagnostic file under ~/.hermes/logs/subagent-timeout-<sid>-<ts>.log capturing enough state for the user (and us) to debug the hang. The old error message — 'Subagent timed out after Ns with no response. The child may be stuck on a slow API call or unresponsive network request.' — gave no observability for the 0-API-call case, which is the hardest to reason about remotely. The diagnostic captures: - timeout config vs actual duration - goal (truncated to 1000 chars) - child config: model, provider, api_mode, base_url, max_iterations, quiet_mode, platform, _delegate_role, _delegate_depth - enabled_toolsets + loaded tool names - system prompt byte/char count (catches oversized prompts that providers silently choke on) - tool schema count + byte size - child's get_activity_summary() snapshot - Python stack of the worker thread at the moment of timeout (reveals whether the hang is in credential resolution, transport, prompt construction, etc.) Wiring: - _run_single_child captures the worker thread via a small wrapper around child.run_conversation so we can look up its stack at timeout. - After a FuturesTimeoutError, we pull child.get_activity_summary() to read api_call_count. If 0 AND it was a timeout (not a raise), _dump_subagent_timeout_diagnostic() is invoked. - The returned path is surfaced in the error string so the parent agent (and therefore the user / gateway) sees exactly where to look. - api_calls > 0 timeouts keep the old 'stuck on slow API call' phrasing since that's the correct diagnosis for those. This does NOT change any behavior for successful subagent runs, non-timeout errors, or subagents that made at least one API call before hanging. Tests: 7 cases (tests/tools/test_delegate_subagent_timeout_diagnostic.py) - output format + required sections + field values - long-goal truncation with [truncated] marker - missing / already-exited worker thread branches - unwritable HERMES_HOME/logs/ returns None without raising - _run_single_child wiring: 0 API calls → dump + diagnostic_path in error - _run_single_child wiring: N>0 API calls → no dump, old message Refs: NousResearch#14726
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…calls (NousResearch#15105) When a subagent in delegate_task times out before making its first LLM request, write a structured diagnostic file under ~/.hermes/logs/subagent-timeout-<sid>-<ts>.log capturing enough state for the user (and us) to debug the hang. The old error message — 'Subagent timed out after Ns with no response. The child may be stuck on a slow API call or unresponsive network request.' — gave no observability for the 0-API-call case, which is the hardest to reason about remotely. The diagnostic captures: - timeout config vs actual duration - goal (truncated to 1000 chars) - child config: model, provider, api_mode, base_url, max_iterations, quiet_mode, platform, _delegate_role, _delegate_depth - enabled_toolsets + loaded tool names - system prompt byte/char count (catches oversized prompts that providers silently choke on) - tool schema count + byte size - child's get_activity_summary() snapshot - Python stack of the worker thread at the moment of timeout (reveals whether the hang is in credential resolution, transport, prompt construction, etc.) Wiring: - _run_single_child captures the worker thread via a small wrapper around child.run_conversation so we can look up its stack at timeout. - After a FuturesTimeoutError, we pull child.get_activity_summary() to read api_call_count. If 0 AND it was a timeout (not a raise), _dump_subagent_timeout_diagnostic() is invoked. - The returned path is surfaced in the error string so the parent agent (and therefore the user / gateway) sees exactly where to look. - api_calls > 0 timeouts keep the old 'stuck on slow API call' phrasing since that's the correct diagnosis for those. This does NOT change any behavior for successful subagent runs, non-timeout errors, or subagents that made at least one API call before hanging. Tests: 7 cases (tests/tools/test_delegate_subagent_timeout_diagnostic.py) - output format + required sections + field values - long-goal truncation with [truncated] marker - missing / already-exited worker thread branches - unwritable HERMES_HOME/logs/ returns None without raising - _run_single_child wiring: 0 API calls → dump + diagnostic_path in error - _run_single_child wiring: N>0 API calls → no dump, old message Refs: NousResearch#14726
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a subagent in
delegate_tasktimes out without having made any API call,delegate_tasknow writes a structured diagnostic to~/.hermes/logs/subagent-timeout-<sid>-<ts>.logand surfaces the path in the error message.Why
Issue #14726 reports a specific hang pattern: with
toolsets=["web", <secondary>]+ long context +max_iterations >= ~20, the subagent times out at the configured limit (300s by default for some users) with zero API calls and no way to see what the child was doing. The old error string gave users nothing actionable.Root-causing "why 0 API calls happened for this specific user against their specific provider" requires data we don't have. But we can give users (and ourselves) the data they need to self-diagnose — and surface it automatically only when the shape of the failure is opaque (no API call was ever made).
What the diagnostic captures
get_activity_summary()snapshotScope
is_timeoutis true andchild_api_calls == 0.Validation
tests/tools/test_delegate_subagent_timeout_diagnostic.py— 7 new casestests/tools/full delegate suite: 124/124 pass (117 existing + 7 new)threading.Event.wait; diagnostic correctly dumps the parked stack trace all the way down towaiter.acquire.Example output
Refs #14726. Does not attempt to root-cause the underlying hang — just makes it debuggable.