Skip to content

fix(simulation): send the simulated user's utterance, not its tagged transcript - #204

Merged
tmatup merged 2 commits into
mainfrom
fix/simulator-utterance-markup
Sep 28, 2026
Merged

tmatup merged 2 commits into
mainfrom
fix/simulator-utterance-markup

Conversation

@tmatup

@tmatup tmatup commented Sep 28, 2026

Copy link
Copy Markdown
Member

Summary

Short version: in dialog mode, the coding agent receives each simulated-user message twice, wrapped in harness tags. This PR sends the plain message.

What the agent actually got as turn 1 (from task.json iterations[0].user_input, adhoc-2026-09-28_16-14-30, skill-flow-customer-escalation-simulated):

[ASSISTANT] Hey! I need your help setting up something ... happy to answer!
[RESULT - SUCCESS] Hey! I need your help setting up something ... happy to answer!
  • Cause: the simulator is a ClaudeCodeAgent. Its agent_output is a tagged transcript (_format_messages), not the model's reply. UserSimulator.next_user_message sent it through unchanged.
  • Why nobody saw it: conversation.log collapses the transcript with _extract_utterance, so the log looked clean. The raw form only shows in task.json user_input.
  • Scope: every simulated task (14/14 in that run), in both arms, in every pulled run since at least 2026-08-26.

Change

  • _extract_utterance and its tag regex move to coder_eval/simulation/utterance.py as extract_utterance. The orchestrator imports it under the old name, so the log path is unchanged.
  • next_user_message sends the collapsed utterance. The stop token is still detected on the raw text, and SimulatorResult.raw_text still holds the transcript.

Test plan

  • Two new TestTaggedTranscriptOutput cases use the real tagged shape: an opener, and a stop turn. Both fail without the fix; the existing stubs return plain text, which hid the bug.
  • make verify: 6103 passed, 3 skipped.

Note for reviewers

This changes what agents see in every simulated task, so simulated scores may shift slightly. That is the intended fix, not a regression.

🤖 Generated with Claude Code

https://claude.ai/code/session_014Tw2Pqkugyik4uVJHo2Ref

…transcript

The user simulator is a ClaudeCodeAgent. Its `agent_output` is a tagged
transcript that repeats the reply under `[ASSISTANT]` and
`[RESULT - SUCCESS]`. `UserSimulator.next_user_message` sent that raw
string to the coding agent. So every simulated-user turn reached the agent
twice, wrapped in harness tags. conversation.log never showed it, because
the log path already collapses the transcript with `_extract_utterance`.
Every simulated task in adhoc-2026-09-28_16-14-30 (14/14) and every earlier
pulled run since 08-26 carries the markup in `iterations[].user_input`.

- Move `_extract_utterance` and its tag regex into
  `coder_eval.simulation.utterance`. The orchestrator imports it under its
  old name, so the log path is unchanged.
- `next_user_message` sends the collapsed utterance. It still detects the
  stop token on the raw text, and `raw_text` keeps the transcript.
- Two tests feed the real tagged shape. TextStubAgent returns plain text,
  which is why the existing tests never caught this.

🤖 Generated with Claude Code
Co-Authored-By: [Claude](mailto:noreply@anthropic.com)
Claude-Session: https://claude.ai/code/session_014Tw2Pqkugyik4uVJHo2Ref
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Claude finished @tmatup's task in 1m 25s —— View job


PR Review in Progress

I'll review this PR following the guidelines in .github/code_review.md.

Todo List:

  • Read .github/code_review.md for review standards
  • Read CLAUDE.md for project conventions
  • Review the full diff (git diff origin/main...HEAD)
  • Read each changed file in full for context
  • Analyze for correctness, test coverage, and project standards
  • Check cross-file consistency and design-level considerations
  • Post comprehensive review feedback

@bai-uipath bai-uipath left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, ty!

@tmatup
tmatup merged commit ffb9a81 into main Sep 28, 2026
17 checks passed
@tmatup
tmatup deleted the fix/simulator-utterance-markup branch September 28, 2026 23:29
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