fix: treat a silent agent turn as silence, not a run_input error - #6779
Merged
Conversation
`SessionHost` turned a run that produced no chat items into `agent produced no response items`, which surfaces to the caller as a raised `RuntimeError` and fails the turn. An empty turn is a legitimate outcome. An LLM can return a completion with no text and no tool calls, and every item-add site in `agent_activity` is guarded on non-empty text, so nothing lands in the chat context or in `RunResult.events`. Agents that induce this on purpose hit it reliably: a close-the-call tool whose output tells the model it has already said goodbye and should now say nothing. Seen in text-mode simulations, where the caller keeps sending closing pleasantries after the goodbye. The job is reported as an agent error even though the transcript is complete and correct — agent-side traces show the turn returning a single output token, empty response text, no tool call, not interrupted. Report the empty item list instead and let the caller decide what the silence means. Simulation drivers already model a silent turn.
longcw
approved these changes
Aug 11, 2026
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.
Problem
SessionHostturns a run that produced no chat items into an error:The caller sees it as a raised
RuntimeError, so the turn — and, in simulations, the whole job — is scored as an agent failure.An empty turn is a legitimate outcome. An LLM can return a completion with no text and no tool calls, and every item-add site in
agent_activityis guarded on non-empty text (if forwarded_text:), so nothing lands in the chat context or inRunResult.events.Agents that induce this on purpose hit it reliably. A close-the-call tool whose output tells the model it has already said goodbye and should now say nothing gets exactly that:
Agent-side traces for that turn confirm the model, not the framework, produced the silence:
One output token, empty response text, no tool call, not interrupted — and the transcript up to that point is complete and correct.
Fix
Report the empty item list and let the caller decide what the silence means. Simulation drivers already model a silent turn explicitly, so they can end the call cleanly instead of failing it.
Test
test_run_silent_turn_is_not_an_errordrives a realAgentSessionwhose LLM returns an empty completion throughSessionHost→RemoteSession. Without the fix it fails with the exact production error: