Skip to content

fix: correct interleaved tool input deltas and recover command actions from tool results#73

Merged
wangtsiao merged 6 commits into
mainfrom
dev/0519
May 25, 2026
Merged

fix: correct interleaved tool input deltas and recover command actions from tool results#73
wangtsiao merged 6 commits into
mainfrom
dev/0519

Conversation

@wangtsiao
Copy link
Copy Markdown
Contributor

Fixes two related bugs in how tool inputs and display actions are handled.

  1. Interleaved Tool Input Deltas (crates/core/src/query.rs)
    When an LLM emits interleaved tool calls (ToolCallStart for tool-1, then tool-2, then deltas for both), the delta matching code incorrectly matched deltas to the last started tool instead of using the index field. When tool-1's delta arrived after tool-2's start, the delta was written into tool-2's accumulated input, producing wrong tool inputs.
    Fix: Use the index field to match deltas to the correct tool call. Also capture final tool inputs from the MessageDone response body instead of re-parsing accumulated delta JSON, since the final response is authoritative and the accumulated deltas can be inconsistent.
  2. Command Actions from Tool Results (crates/server/src/, crates/tui/src/worker.rs)
    read and glob tool calls sometimes start without enough information to build command display actions (e.g. read called without a filePath, or glob before the pattern/path are known). Previously, these would render with empty titles in the TUI and never get corrected.
    Fix:
  • Extract read file paths from the tool result summary string as a fallback
  • Extract glob pattern+path from input parameters for proper display ("**/Cargo.toml in crates")
  • Server now emits command actions at both tool call start (from input) and completion (from result summary)
  • TUI worker processes item/completed ToolCall events and emits ToolCallUpdated events with the recovered action info, so the display updates when the result arrives

@wangtsiao wangtsiao merged commit d025a0e into main May 25, 2026
4 checks passed
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.

1 participant