Repository navigation
feat(prompt_agent): resume a cut-short user-sim turn as the user - #637
Open
kaihackney-scale wants to merge 1 commit into
Open
kaihackney-scale wants to merge 1 commit into
kaihackney-scale wants to merge 1 commit into
Conversation
When a transient API error cuts a Claude Code turn short, the bridge resumes the session with a prompt that asks the model to finish the request it was given. A user-sim's request is the agent's reply, so a resumed user-sim carried on as the agent. The Claude Code agent now takes a resume_prompt, and prompt_agent sends a user-sim one that keeps it the user, negotiated against the agent's card like model and output_format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
prompt_agent: resume a cut-short user-sim turn as the user, not as the agent
What
resume_prompt(ClaudeCodeConfig). When a transient API error cuts a turn short,run_clauderesumes the session with it, in place of the default_RESUME_PROMPT.prompt_agentsends a user-simUSER_SIM_RESUME_PROMPT. It's negotiated against the agent's card likemodelandoutput_format, so an agent that doesn't take it is never sent it, and nothing changes for it.Why
The default resume prompt asks the model to "continue the original request… and finish it." That's right for an agent doing a task. A user-sim's request is the agent's reply, though, so a resumed user-sim carries on as the agent. It reports work as done, says it lacks the tools to do the task, or answers the question it just asked. From then on, the conversation no longer tests the agent.
How it was tested
resume_promptreplaces the default one on the resume;resume_prompt;claudeCLI and each task's own system prompt, the default reply schema, tools and files. Each turn was cut at its first step and resumed, and a separate grader labeled each reply:run_claude: the real CLI, with the first attempt cut and reported as a timed-out API call, so the bridge's own retry logic decides to resume and does. Every run resumed with the prompt it was given. With the default prompt, nearly all resumed turns went out of role; with the user-sim prompt, none did.ruff checkand the plugin-API check pass. Thetst/unit/task_stepandtst/unit/agentssuites pass, except twotest_mcp_cli_buildertests that fail locally because the generated script's interpreter has noclick, which is unrelated to this change.Rollout
An agent picks this up only once its image is built from a release with this change. Until then its card doesn't list
resume_prompt, so it isn't sent.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Adds a configurable prompt for retrying interrupted Claude Code turns.
prompt_agentsends a user-specific prompt only to user simulators whose cards accept it.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[prompt_agent configures user simulator] --> B{Card accepts resume_prompt?} B -->|Yes| C[Send user-specific resume prompt] B -->|No| D[Keep existing config behavior] C --> E[Run user-sim turn] E --> F{Retryable API failure?} F -->|Yes| G[Resume session with user-specific prompt] F -->|No| H[Return result]Reviews (1) · Last reviewed commit: "feat(prompt_agent): resume a cut-short u..." · Reviewed by Greptile