Repository navigation
fix(prompt_agent): a user sim turn that fails keeps the agent's own error - #888
Merged
Merged
Conversation
…rror A user sim whose task ended failed was recorded as `state failed` alone: the error type and message the agent reported in its status message were dropped, so the cause was gone with the sandbox. prompt_agent's built-in user sim, always_on's and rate_user_satisfaction's now record `state failed: error_type=...: <the agent's message>`, read as the solver's failure already is (agent_error_text). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sarah-chitty-1
approved these changes
Nov 23, 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.
What and why
When a user sim's A2A task ended
failed, the run recorded onlystate failed. The error type, code and message theagent put in its status message were dropped, so once the sandbox was gone the cause was too. A sim on a model the
model gateway refused for the agent's harness, for example, left nothing but
state failedinuser_sim_readsandin the run's
error_message.ended_turn_error(insandbox_utils) now writes such a turn asstate failed: error_type=…, error_code=…, exception=…: <the agent's own message>, the message read throughagent_error_textas a failed solver turn already is. It is used at the three places that had the bare text:prompt_agent's built-in user sim,always_on's user sim, andrate_user_satisfaction.How it was tested
pytest tst/unit/task_step: 4226 passed. The 6 failures (computer_exec_test.py×4,test_mcp_cli_builder.py×2) fail the same way on main.test_a_turn_that_ended_without_completing_keeps_the_agents_own_error(full error, text only, nothing).state failednow fail the sim the way an agentreports it (an error data part) and assert the error is kept.
agent-env runof a multiturn task whose built-in user sim runs on a model the gatewayrefuses for the Claude Code harness. Before,
user_sim_reads[talk][0].user_sim_errorwasstate failed. With thischange it is
state failed: error_type=agent_error, error_code=cli_error: claude CLI exited with code 1: API Error: 400 … /v1/messages is not supported for …, and the prompt response'serror_messagecarries the same.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge.Summary
Failed user simulator turns now keep the agent's error details instead of recording only the task state.
Reviews (1) · Last reviewed commit: "fix(prompt_agent): a user sim turn that ..." · Reviewed by Greptile