Coerce ToolCallItem/ToolCallOutputItem call_id to str | None consistently#3541
Open
jluocsa wants to merge 1 commit into
Open
Coerce ToolCallItem/ToolCallOutputItem call_id to str | None consistently#3541jluocsa wants to merge 1 commit into
jluocsa wants to merge 1 commit into
Conversation
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.
Summary
ToolCallItem.call_idandToolCallOutputItem.call_idreturned the raw value untouched on the object branch, so a non-stringcall_id/id(e.g. anint) leaked through despite thestr | Nonereturn annotation. This makes both properties consistently coerce tostr | None, matching the canonical behavior ofextract_tool_call_idinrun_internal/tool_execution.py.Changes
ToolCallItem.call_idandToolCallOutputItem.call_idnow coerce the resolved value tostr(orNonewhen absent) on both the dict and object branches.Test plan
tests/test_items_helpers.py:call_idreturn the string unchanged.int)call_idis coerced to"123".call_idreturnsNone.make format,make lint,make typecheck, and the fullmake testssuite pass (4615 passed, 11 skipped).