ConnectionError retry exhaustion silently swallowed, producing empty response instead of propagating ExecutionError #71
Labels
No labels
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Depends on
#77 Epic: LLM Agent Runtime Stabilization — reliability, resource enforcement & correctness hardening
cleveragents/cleveractors-core
#72 fix(nodes): propagate ExecutionError from retry mechanism instead of swallowing it
cleveragents/cleveractors-core
Reference
cleveragents/cleveractors-core#71
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
When all LLM communication retries are exhausted (e.g. a server is unreachable and
httpx.ConnectErrorfires on every attempt), theExecutionError(kind="timeout")raised bycall_with_retry()is systematically swallowed instead of propagating to the caller. The graph continues executing subsequent nodes with an error string as message content, and eventually returns either an error string or — in the streaming path — an empty response.Proposed Branch
fix/nodes-executionerror-propagationProposed Commit Title
Root Cause
The retry mechanism in
call_with_retry()(ADR-2032,src/cleveractors/agents/retry.py) works correctly: it detectshttpx.ConnectError, performs exponential backoff (up to 7 retries, 60s max), and raisesExecutionError(kind="timeout")with a detailed error message including provider URL, graph name, and retry count.However, three layers of overly-broad exception handling systematically catch and neutralize this exception:
Layer 1:
Node._execute_agent()—src/cleveractors/langgraph/nodes.py:409-414Catches ALL exceptions including
ExecutionError(kind="timeout"). Converts the error to a string that is injected into graph state as if it were a valid agent response. The retry mechanism's entire work (backoff, budget tracking, error reporting) is wasted.Layer 2:
Node.execute()—src/cleveractors/langgraph/nodes.py:231-257Secondary catch-all for non-AGENT node types. For TOOL/FUNCTION nodes, returns an error dict that
_execute_from_node()silently processes by falling back to the original input message — making the error invisible.Layer 3:
PureLangGraph._execute_from_node()—src/cleveractors/langgraph/pure_graph.py:983-990The
ExecutionErrorre-raise at line 983-987 is never reached because Layers 1 and 2 catch all exceptions first.How the "jump to next node" happens
When
_execute_from_node()receives the error dict{"error": ..., "failed_node": ...}from a TOOL/FUNCTION node, at line 814 it checks for the"messages"key (not found) and falls to line 823:No
"content"or"output"keys in the error dict → falls back to the originalmessage. The graph continues execution with the original input as if nothing happened.How the "empty response" happens
In the streaming path (
_stream_agentatnodes.py:597-610), exceptions ARE properly re-raised, soExecutionErrorpropagates to_execute_graph_stream()(runtime_dispatch.py:1288-1333):When the ConnectionError occurs before any tokens are yielded,
response_partsis[]→response="".Fix Required
A minimal two-change fix:
Change 1:
src/cleveractors/langgraph/nodes.py—_execute_agent()(line 409)Replace the broad
except Exceptionwith a handler that propagatesExecutionErrorand only catches non-fatal exceptions:Change 2:
src/cleveractors/langgraph/nodes.py—execute()(line 231)Same pattern — let
ExecutionErrorpropagate to_execute_from_node()'s existing handler atpure_graph.py:983-987:Why this is sufficient
ExecutionErrorpropagation handler at_execute_from_node()line 983-987 already exists and correctly re-raises._execute_graph()atruntime_dispatch.py:403-404already catchesExecutionErrorand re-raises after billing state capture._execute_graph_stream()atruntime_dispatch.py:1288already handlesExecutionErrorproperly.Affected Files
src/cleveractors/langgraph/nodes.py_execute_agent()— primary swallow pointsrc/cleveractors/langgraph/nodes.pyexecute()— secondary swallow pointsrc/cleveractors/langgraph/pure_graph.py_execute_from_node()— existing (unreachable)ExecutionErrorpropagatorsrc/cleveractors/agents/retry.pycall_with_retry()— correctly raisesExecutionErrorafter exhausting retriesRelated ADRs
ExecutionErrorwithkind="timeout"Update: APIConnectionError not handled by retry mechanism
The initial fix for this issue addressed
ExecutionError(kind="timeout")propagation (from httpx retry exhaustion). However, provider SDK connection errors (e.g.openai.APIConnectionError,anthropic.APIConnectionError) are NOT caught by_is_http_comms_error()because they inherit fromException, nothttpx.HTTPError. This means they are never retried — they propagate directly toprocess_message()which wraps them asExecutionError(kind=""), and the node layer silently swallows them.Root cause
_is_http_comms_error()inretry.pyonly checksisinstance(e, httpx.xxx)— provider SDKs wrap the underlying httpx transport error into their own exception classes (openai.APIConnectionError,anthropic.APIConnectionError) which are not in the httpx hierarchy.Fix applied
retry.py:_is_http_comms_error()now checks the exception class name forAPIConnectionErrorandAPITimeoutError— these are provider-agnostic names used by all major SDKs (openai, anthropic). They are treated as transient connection failures and retried with exponential backoff. On exhaustion,ExecutionError(kind="timeout")is raised correctly.llm.py: Safety net inprocess_message()— if a provider connection error slips through without being retried (e.g. max_retries=0), it is wrapped asExecutionError(kind="timeout")instead ofkind="", ensuring propagation through the node layer.Files changed
src/cleveractors/agents/retry.py—_is_http_comms_error()extendedsrc/cleveractors/agents/llm.py— safety net inprocess_message()src/cleveractors/langgraph/nodes.py— guard changed frome.kind == "timeout"toif e.kind(per non-blocking review suggestion)features/nodes_coverage_gaps.feature— 3 new scenariosfeatures/steps/nodes_coverage_gaps_steps.py— step definitions for new scenariosCHANGELOG.md— entry updated