Skip to content

fix(runner): handle model-object tool calls in verbose logging#55

Open
Sai Asish Y (SAY-5) wants to merge 2 commits into
dedalus-labs:mainfrom
SAY-5:fix/verbose-tool-call-attribute-error
Open

fix(runner): handle model-object tool calls in verbose logging#55
Sai Asish Y (SAY-5) wants to merge 2 commits into
dedalus-labs:mainfrom
SAY-5:fix/verbose-tool-call-attribute-error

Conversation

@SAY-5

Copy link
Copy Markdown

Fixes #54.

DedalusRunner(..., verbose=True).run(..., tools=[...]) crashes with AttributeError on the first response containing tool calls. The verbose print paths call .get("function", {}) on tool-call entries, which works for the ToolCall TypedDicts produced by _extract_tool_calls but not for the SDK model objects read straight off API responses (e.g. in _execute_turns_sync at the Tool calls in response log 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

  • New tests/test_runner_verbose.py: unit-tests _tool_call_name for dicts/model objects, and a regression test running runner.run(verbose=True, tools=[add]) against a mocked client returning model-style tool calls (fails on main, passes here).
  • pytest tests/test_local_scheduler.py tests/test_runner_verbose.py green.
  • ruff check/ruff format --check clean on changed files.

@cursor

cursor Bot commented May 12, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes are limited to verbose debug printing; tool execution and non-verbose paths are unchanged.

Overview
Fixes #54: DedalusRunner with verbose=True no longer crashes when the API returns tool calls as SDK model objects instead of dicts.

Adds _tool_call_name(tc) to resolve a tool’s function name from either dicts or attribute-style objects, and routes all verbose logging paths (sync/async turns, streaming summaries, message history dumps) through it instead of calling .get(...) on raw response tool calls.

Adds tests/test_runner_verbose.py with unit coverage for the helper and an end-to-end regression that runs verbose=True with mocked model-style tool calls.

Reviewed by Cursor Bugbot for commit 58cd1c9. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread src/dedalus_labs/lib/runner/core.py
@SAY-5 Sai Asish Y (SAY-5) force-pushed the fix/verbose-tool-call-attribute-error branch from 90f77be to 69c4276 Compare May 12, 2026 20:54
@SAY-5

Copy link
Copy Markdown
Author

Good catch. Updated the two remaining verbose sites (the extracted-calls list and the end-of-stream summary) to go through _tool_call_name so model-object tool calls no longer fall back to an inconsistent value.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

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.

Comment thread src/dedalus_labs/lib/runner/core.py
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@SAY-5

Copy link
Copy Markdown
Author

Good catch, the loop in _execute_turns_async was the last inline copy. Switched it to the helper and dropped the dead non-dict branch for tc_id in 58cd1c9.

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.

verbose=True crashes on any tool-calling response (AttributeError on ChatCompletionMessageToolCall)

1 participant