Skip to content

fix(prompt_agent): a user sim turn that fails keeps the agent's own error - #888

Merged
kaihackney-scale merged 1 commit into
mainfrom
kai/user-sim-failed-task-error
Nov 23, 2026
Merged

kaihackney-scale merged 1 commit into
mainfrom
kai/user-sim-failed-task-error

Conversation

@kaihackney-scale

@kaihackney-scale kaihackney-scale commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

When a user sim's A2A task ended failed, the run recorded only state failed. The error type, code and message the
agent 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 failed in user_sim_reads and
in the run's error_message.

ended_turn_error (in sandbox_utils) now writes such a turn as
state failed: error_type=…, error_code=…, exception=…: <the agent's own message>, the message read through
agent_error_text as 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, and rate_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.
  • New: test_a_turn_that_ended_without_completing_keeps_the_agents_own_error (full error, text only, nothing).
  • The built-in-sim and satisfaction tests that asserted the bare state failed now fail the sim the way an agent
    reports it (an error data part) and assert the error is kept.
  • End to end: a local agent-env run of a multiturn task whose built-in user sim runs on a model the gateway
    refuses for the Claude Code harness. Before, user_sim_reads[talk][0].user_sim_error was state failed. With this
    change 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's error_message carries the same.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence 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.

  • Failed user-sim turns keep the agent’s error details in their records.

Reviews (1) · Last reviewed commit: "fix(prompt_agent): a user sim turn that ..." · Reviewed by Greptile

…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>
@kaihackney-scale
kaihackney-scale requested a review from a team as a code owner November 23, 2026 16:51
@kaihackney-scale
kaihackney-scale merged commit 1906586 into main Nov 23, 2026
35 checks passed
@kaihackney-scale
kaihackney-scale deleted the kai/user-sim-failed-task-error branch November 23, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants