fix(runner): handle model-object tool calls in verbose logging#55
fix(runner): handle model-object tool calls in verbose logging#55Sai Asish Y (SAY-5) wants to merge 1 commit into
Conversation
PR SummaryLow Risk Overview Adds a small Reviewed by Cursor Bugbot for commit 69c4276. Bugbot is set up for automated code reviews on this repo. Configure here. |
90f77be to
69c4276
Compare
|
Good catch. Updated the two remaining verbose sites (the extracted-calls list and the end-of-stream summary) to go through |
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 69c4276. Configure here.
| return (fn.get("name", "?") if isinstance(fn, dict) else getattr(fn, "name", "?")) or "?" | ||
| return getattr(getattr(tc, "function", None), "name", "?") or "?" | ||
| except Exception: | ||
| return "?" |
There was a problem hiding this comment.
Inline tool-call name logic not refactored to use helper
Low Severity
The new _tool_call_name helper consolidates tool-call name extraction and is used at seven verbose-logging sites, but the equivalent inline implementation in _execute_turns_async (around line 592–601) still duplicates this logic with its own isinstance/getattr branching. This creates an inconsistency where future changes to name-extraction logic would need updating in two places. Additionally, at line 615, the isinstance(tc, dict) / else getattr(tc, "id", "?") branch for tc_id is unreachable because _extract_tool_calls always returns dicts—this adds unnecessary complexity suggesting model objects can appear where they cannot.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 69c4276. Configure here.


Fixes #54.
DedalusRunner(..., verbose=True).run(..., tools=[...])crashes withAttributeErroron the first response containing tool calls. The verbose print paths call.get("function", {})on tool-call entries, which works for theToolCallTypedDicts produced by_extract_tool_callsbut not for the SDK model objects read straight off API responses (e.g. in_execute_turns_syncat theTool calls in responselog line, and the message-history dumps).This adds a small
_tool_call_name(tc)helper that accepts either dicts or attribute-style model objects, and uses it in the affected verbose print paths. Non-verbose behavior is unchanged.Test plan
tests/test_runner_verbose.py: unit-tests_tool_call_namefor dicts/model objects, and a regression test runningrunner.run(verbose=True, tools=[add])against a mocked client returning model-style tool calls (fails onmain, passes here).pytest tests/test_local_scheduler.py tests/test_runner_verbose.pygreen.ruff check/ruff format --checkclean on changed files.