fix(runner): tolerate Pydantic tool_call objects in verbose logging#56
Conversation
PR SummaryLow Risk Overview Adds a regression test ( Reviewed by Cursor Bugbot for commit 76bac15. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 0bb40be. Configure here.
0bb40be to
76bac15
Compare

What Changed
verbose=Truecrashed on any tool-calling response because seven verbose-print sites calledtc.get(...)onChatCompletionMessageToolCallPydantic objects, which have no.get().Two shape-tolerant helpers (
_tc_name,_tc_id) consolidate the dict-or-Pydantic access already present atcore.py:582andcore.py:1167and replace the buggy sites in_execute_turns_{async,sync}and_execute_streaming_{async,sync}. Regression test pins the original bug shape.No public-API change; no behaviour change with
verbose=False.Test Plan
Live reproducer (against
main, fails before this patch):Before:
AttributeError: 'ChatCompletionMessageToolCall' object has no attribute 'get'.After: prints
🔧 Tool calls in response: ['add']and returns"3 + 4 equals 7.".Automated:
uv run pytest tests/lib/test_runner_verbose.py— 4 tests (dict shape, Pydantic shape, defaults, pinned bug shape).uv run pytest tests/ --ignore=tests/api_resources— 519 passed, 3 skipped.Closes #54