Repository navigation
Description
Summary
Certain GAIA benchmark instances deterministically fail with Remote conversation got stuck across all retries, all SDK versions, and both Claude Sonnet 4.5 and Opus 4.6. The root cause is a conflict between the stuck detector's monologue threshold (3 consecutive agent MessageEvents) and extended thinking models that produce reasoning-only responses (no text, no tool calls) before their first action.
Affected instances
| Instance | Question | Sonnet (run 1) | Sonnet (run 2) | Sonnet (run 3) | Opus (run 4) | Opus (run 5) |
|---|---|---|---|---|---|---|
2d83110e |
Reversed text puzzle | STUCK | STUCK | STUCK | STUCK | STUCK |
2a649bb1 |
EC numbers for virus testing | PASS | STUCK | STUCK | STUCK | STUCK |
6359a0b1 |
Green polygon area | FAIL | FAIL | FAIL | STUCK | STUCK |
983bba7c |
Animals in alvei papers | PASS | PASS | FAIL | STUCK | PASS |
2d83110e fails in 100% of runs (5/5). 2a649bb1 fails in 4/5. The Opus runs are more affected (up to 4 stuck instances vs 1–2 for Sonnet).
Reproduction
Run the GAIA benchmark with Claude Sonnet 4.5 or Opus 4.6 with extended thinking enabled and OpenHands agent, Instance 2d83110e will fail every time.
Root cause
The code path (agent.py:298–382)
- The LLM returns a valid response (
chatcmpl-*ID) containing only thinking/reasoning blocks — no text content, no tool calls. agent.py:302–309detectshas_reasoningand/orhas_content:has_reasoning = ( message.responses_reasoning_item is not None or message.reasoning_content is not None or (message.thinking_blocks and len(message.thinking_blocks) > 0) ) has_content = any( isinstance(c, TextContent) and c.text.strip() for c in message.content )
- Since there are no tool calls, execution falls through to line 356. If neither reasoning nor content is found, a warning is logged. But in all cases, a
MessageEventis emitted unconditionally (lines 359–372):msg_event = MessageEvent(source="agent", llm_message=message, ...) on_event(msg_event) # Emitted even when empty
- Since
has_contentis False,execution_statusis not set to FINISHED (line 379–382), so the agent loop continues and calls the LLM again. - The LLM produces the same reasoning-only response. This repeats 3 times.
The stuck detection (stuck_detector.py:200–225)
_is_stuck_monologue()counts consecutiveMessageEvents withsource="agent":for event in reversed(events): if isinstance(event, MessageEvent): if event.source == "agent": agent_message_count += 1
- The monologue threshold is 3 (
types.py:40–41). After 3 emptyMessageEvents, the conversation is markedSTUCK.
The error propagation (remote_conversation.py:1035–1039)
- The remote client detects the STUCK status and raises
ConversationRunError("Remote conversation got stuck").
Why these specific instances
These questions cause the model to reason internally without producing a tool call:
2d83110e: Reversed text (.rewsna eht sa "tfel" drow eht fo etisoppo eht etirw). The model decodes it in thinking but doesn't know which tool to call for a pure-text answer — it just needs to callfinish, but extended thinking fills the response with reasoning instead.2a649bb1: Multi-step research question. The model plans which searches to run but doesn't commit to a tool call in the first 3 responses.
Evidence from conversation archives
Each retry shows the identical event sequence:
event-00000 SystemPromptEvent (agent)
event-00001 MessageEvent (user) — question delivered, content_len=1
event-00002 ConversationStateUpdateEvent — execution_status=running
event-00004 MessageEvent (agent) — content=[], thinking_blocks=[], resp_id=chatcmpl-... [+2.0s]
event-00005 MessageEvent (agent) — content=[], thinking_blocks=[], resp_id=chatcmpl-... [+1.6s]
event-00006 MessageEvent (agent) — content=[], thinking_blocks=[], resp_id=chatcmpl-... [+1.6s]
event-00007 ConversationStateUpdateEvent — execution_status=stuck
Each empty response has a unique chatcmpl-* ID (real LLM calls, not cached), arrives in ~1.5–2s (vs 4–94s for normal first responses), and the thinking_blocks field is [] in the archived events (likely stripped or encrypted).
Why retries don't help
The retry mechanism escalates resource_factor (1→2→4→8), which increases pod CPU/memory. But the failure is in the model's response pattern, not resource exhaustion. Each retry gets a fresh runtime, fresh session, fresh conversation — but the same system prompt + question always produces the same model behavior.
Proposed solutions
Option 1: Don't emit MessageEvent for empty responses (minimal change)
In agent.py, skip the on_event(msg_event) call when the response has no content and no reasoning. This prevents empty messages from counting toward the monologue threshold.
# Line 356-372: only emit if there's something to emit
if has_reasoning or has_content:
msg_event = MessageEvent(source="agent", llm_message=message, ...)
on_event(msg_event)Option 2: Inject a nudge after empty responses (more robust)
When the LLM returns an empty response, append a system/user message reminding it to use a tool:
if not has_reasoning and not has_content:
logger.warning("LLM produced empty response - nudging to use tools")
# Don't emit empty MessageEvent, instead continue loop
# The next LLM call will include context about available tools
continueOption 3: Exclude empty MessageEvents from monologue detection (targeted fix)
In stuck_detector.py:200–225, skip MessageEvents that have no content:
if isinstance(event, MessageEvent):
if event.source == "agent":
# Don't count empty messages toward monologue
if not event.llm_message or not event.llm_message.content:
continue
agent_message_count += 1Option 4: Increase monologue threshold for extended thinking (configuration)
A threshold of 3 is too aggressive for extended thinking models that may need several reasoning passes. Increasing it to 5–6 would give the model more room while still catching genuine monologue loops.
Recommendation
Option 1 is the safest minimal fix — an empty response with no content, no reasoning, and no tool calls provides no value as a MessageEvent and should not be emitted. Combined with Option 4 (raising the threshold to 5 for extended thinking configs), this would eliminate the false positives without masking real stuck scenarios.
Activity
enyst commentedon Mar 17, 2026
Re:
The empty
thinking_blockslooks a bit strange. It would be great if we can capture the LLM responses in these 3 cases as they were, and then maybe try to understand what happened here.Re: stuck on
MessageEventIf we need to, we could, I guess, make them 10 instead of 3, to see if it continues. I kinda doubt it helps though, if we saw nothing, it sounds like a bug on our side reading the LLM response...
Just to note, in my recollection we really wanted/needed to send
thinking_blocksback wherever possible. So IMHO it would be worth checking why apparently we don't.VascoSch92 commentedon Mar 17, 2026
Instance
2d83110e— Opus (conv04c99959, last retry)chatcmpl-24fdcbad-91a6-4ba2-8580-bdffa5bb99ec[][]chatcmpl-0df1ade7-165a-4a60-85f0-cdd34727b68c[][]chatcmpl-27db0dbc-f675-40e9-8adb-3e74d7876254[][]Instance
2d83110e— Sonnet (conve2c80e8b)chatcmpl-8386c68d-5444-463b-8ede-74ee878cd6a2chatcmpl-59f90522-c264-46e4-af0e-be3a265a0d1echatcmpl-a5eaede1-844a-4c02-b3cc-e5733950d863Instance
2a649bb1— Opus (conv5f112d0c)Same pattern: 3 empty
MessageEvents withcontent: [],thinking_blocks: [],reasoning_tokens: 0,completion_tokens: 2.All responses have unique
chatcmpl-*IDs (real LLM calls, not cached).Key Finding:
thinking_blocks: []Is AccurateThe
base_state.jsontoken usage confirms:reasoning_tokens: 0on every stuck response — the model produced no thinking blockscompletion_tokens: 1–2— just end-of-turn tokensThis contradicts the issue hypothesis that the model returns "reasoning-only responses." The model returns completely empty responses: no reasoning, no content, no tool calls.
Comparison With Working Responses
Instance
983bba7c— Opus (finished successfully)The 1st response is also near-empty (4 tokens, 0 reasoning, 2.37s), but subsequent responses are normal. The model intermittently returns empty responses;
2d83110etriggers it 3+ times in a row.Instance
6359a0b1— Sonnet (finished normally)LLM Config (both models)
enable_encrypted_reasoning: trueextended_thinking_budget: 200000reasoning_effort: "high"stream: falsenative_tool_calling: truelitellm_proxyatllm-proxy.eval.all-hands.devSince
reasoning_tokens: 0, encryption is irrelevant — there was nothing to encrypt.Revised Root Cause Hypothesis
The issue is not "extended thinking models producing reasoning-only responses." The LLM (via litellm proxy) returns completely empty responses (1–2 completion tokens, 0 reasoning tokens) in ~1–2s. For certain prompts (reversed text puzzle in
2d83110e), this happens deterministically, hitting the monologue threshold of 3.The
chatcmpl-*response ID prefix indicates litellm translates Anthropic responses to OpenAI format. The most likely cause is that litellm's translation layer drops thinking blocks and/or content, returning an effectively empty response. The ~2s latency supports this — a truly empty model response would be faster or error out.Reproducing the Bug
Hard to reproduce outside the eval infra because:
litellm_proxywith OpenAI-format translation (chatcmpl-*IDs)enable_encrypted_reasoning: trueis a server-side eval featurelitellm_proxy/anthropic/claude-opus-4-6) may differ from direct API callsTo isolate the layer:
enable_encrypted_reasoning+extended_thinking_budget— tests litellm's OpenAI format translationchatcmpl-*IDs — shows the raw Anthropic response before translation (fastest path to confirmation)Answers to @enyst's Questions
The token stats prove the model genuinely returned empty responses:
reasoning_tokens: 0,completion_tokens: 1–2. Thethinking_blocks: []is the accurate raw state, not a serialization artifact.The model never produced thinking blocks for these responses. The question should shift to: why does litellm return completely empty responses when extended thinking is enabled? The litellm proxy logs for those
chatcmpl-*IDs would show whether the Anthropic API response had content that was then dropped during format translation.juanmichelini commentedon Mar 17, 2026
@VascoSch92
I noticed this with the preflight hooks, nemotron-3-super was returning thinking blocks but empty messages. See #2420
The question was "1+1=" and nemotron answered 2 in the thinking block.
If that is the case,
Option 5
we could use the thinking block as a message block
juanmichelini commentedon Mar 17, 2026
@VascoSch92
[-][BUG] Remote conversation got stuck: monologue detector false positive on extended thinking models[/-][+][Bug] Remote conversation got stuck: monologue detector false positive on extended thinking models[/+]VascoSch92 commentedon Mar 18, 2026
@juanmichelini
I think there is a small issue coming from
LiteLLM. I opened an issue in their repo (ref).But this will take time. We want probably a solution from our side.
VascoSch92 commentedon Mar 18, 2026
Actually, I was evaluationg on a feature branch. I should rebase my branch and re-run the benchmark for the above instance to see if your fix is fixing that also.
VascoSch92 commentedon Mar 18, 2026
Let's summarize what we are doing in agent.py
LLM Response Pattern Matrix
Reference:
agent.pyL348-L433Definitions
message.tool_callsis non-emptyTextContentwith non-blank.textinmessage.contentmessage.thinking_blocks(Anthropic),message.reasoning_content(o1/DeepSeek R1/Claude), ormessage.responses_reasoning_item(OpenAI Responses API) is presentDecision matrix
thought, reasoning attached to 1st actionthoughtMessageEvent, set FINISHEDMessageEvent, set FINISHEDMessageEventwith empty content, agent loopsMessageEventwith empty content, agent loopsNotes
ActionEventonly.has_content=TruetriggersFINISHEDat L430-432. Conversation stops and awaits user input.MessageEventis emitted but execution doesn't finish. After 3 consecutive agentMessageEvents the stuck detector fires. This isthe pattern from issue [Bug] Remote conversation got stuck: monologue detector false positive on extended thinking models #2482 — litellm drops content but preserves thinking blocks, or the model answers only in the thinking block (nemotron "1+1=" case from PR fix: preflight check now validates reasoning_content for thinking models #2420).
2d83110e—completion_tokens=2, reasoning_tokens=0.This issue is in row 8 -> so i really need a fix in LiteLLM or I can augment the monologue.
Putting reasoning as content: I don't know if it is a good solution actually.
enyst commentedon Mar 19, 2026
We could make the monologue at 10, if it helps. They're effectively retries, really, if there was nothing new sent in the next prompt.
An alternative, I think maybe we could also implement this as actual retries of llm.py completion(), maybe make the next time the temperature higher if it's possible with extended thinking, though I seem to recall it's not possible with most reasoning model providers. (we had a weird hack like that for Gemini 2.5 at some point, ... actually we might still have it in the codebase, LLMEmptyResponse handling or so, when we nudged the LLM to hopefully vary its responses so it's not empty anymore)
Probably best, if possible, we could ask litellm to prioritize that bug.
fix: inject nudge for reasoning-only monologue instead of STUCK
VascoSch92 commentedon Mar 20, 2026
Closing this issue as for the first problem the fix was merged in litellm (BerriAI/litellm#24070) and for the second the solution of @juanmichelini was merged (see #2512)