Skip to content

fix: role reversal for tool messages in user simulator (Python)#224

Open
Aryansharma28 wants to merge 4 commits intomainfrom
feat/role-reversal-py
Open

fix: role reversal for tool messages in user simulator (Python)#224
Aryansharma28 wants to merge 4 commits intomainfrom
feat/role-reversal-py

Conversation

@Aryansharma28
Copy link
Contributor

Align Python reverse_roles() with JS messageRoleReversal(). Tool messages are now summarized as plain text instead of being kept as-is or dropped, preventing consecutive assistant roles and lost tool context in the user simulator's conversation history.

Align Python reverse_roles() with JS messageRoleReversal().
Tool messages are now summarized as plain text instead of being
kept as-is or dropped, preventing consecutive assistant roles
and lost tool context in the user simulator's conversation history.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Collaborator

@drewdrewthis drewdrewthis left a comment

Choose a reason for hiding this comment

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

Aryansharma28 and others added 3 commits February 17, 2026 17:12
Align Python reverse_roles() with JS messageRoleReversal().
Tool messages are now summarized as plain text instead of being
kept as-is or dropped, preventing consecutive assistant roles
and lost tool context in the user simulator's conversation history.

- Use isinstance() instead of type() == dict
- Add 30 unit tests covering all helper functions and edge cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Collaborator

@drewdrewthis drewdrewthis left a comment

Choose a reason for hiding this comment

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

The title of the PR doesn't not say that it is summarizing tool calls. this is actually a bit concerning and I think needs further justification?

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

Comments