fix: normalize tool call ids before persisting events - #4610
Open
Gai-shi wants to merge 3 commits into
Open
Conversation
Collaborator
|
🚦 CI is currently failing on this PR's latest commit. Please fix the failing checks before OpenHands reviews it - this is re-checked automatically once you push a new commit. (A maintainer can also request This is an automated check - no AI was used to generate this comment. |
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.
HUMAN:
I verified this bugfix locally and it matches the issue reproduction scope.
AGENT:
Why
Parallel MCP tool calls can produce tool call IDs containing characters such as
:.Those IDs are persisted into conversation events and later used to link agent
actions with tool observations. If invalid IDs enter persisted history, replaying
the conversation through the OpenAI Responses API can fail because Responses only
accepts letters, numbers, underscores, and dashes in function call IDs.
This PR normalizes tool call IDs when SDK
MessageToolCallobjects are createdfrom LLM tool-call outputs, before those IDs are persisted into conversation events.
Summary
MessageToolCallobjects.call_idvalues when parsing Responses output.conversation.run()intoActionEventandObservationEvent.Issue Number
fixes #4578
How to Test
Ran:
Results:
Video/Screenshots
N/A. This is an SDK event serialization bugfix covered by automated tests.
Design Doc
N/A. Small scoped bugfix.
Type
Notes
This prevents newly generated colon-delimited tool call IDs from being persisted.
It does not migrate or repair already persisted historical conversations that contain
invalid tool call IDs.