+
Skip to content

Error handling improvements for remaining tool callback locations #100

@tunahorse

Description

@tunahorse

Summary

  • Add try/except protection to remaining tool callback calls in json_tool_parser.py
  • Add try/except protection to remaining tool callback calls in utils.py
  • Ensure consistent error logging pattern across all tool callback locations
  • Test error handling paths in these additional locations

Context

We recently implemented error handling for streaming loops and tool callbacks in other parts of the codebase. However, there are additional tool callback calls in json_tool_parser.py and utils.py that need similar protection to ensure comprehensive error handling coverage.

Files to update

  • src/tunacode/core/agents/agent_components/json_tool_parser.py - Lines 72, 262, 309
  • src/tunacode/core/agents/utils.py - Lines 187, 262, 309

Current Analysis

The following locations need error handling improvements:

json_tool_parser.py

  • Line 72: await tool_callback(mock_call, mock_node) in parse_json_tool_calls
  • Line 262: await tool_callback(mock_call, mock_node) in parse_json_tool_calls (utils.py version)
  • Line 309: await tool_callback(mock_call, mock_node) in code block parsing

utils.py

  • Line 187: await execute_tools_parallel(buffered_tasks, original_callback) in buffering_callback
  • Line 262: await tool_callback(mock_call, mock_node) in parse_json_tool_calls
  • Line 309: await tool_callback(mock_call, mock_node) in code block parsing

Test plan

  • Verify error handling works in json_tool_parser.py tool callbacks
  • Verify error handling works in utils.py tool callbacks
  • Ensure consistent logging patterns across all locations
  • Test that errors don't crash the agent run but are properly logged

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载