Fix: M3 lazy tool input review feedback#9245
Merged
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
Addressed in #9325 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses review feedback on #9229. Three fixes:
Cap inputRawDict at storage point — In
populateFromHistory, the raw tool input dictionary is now size-checked before storage. If the JSON-encoded size exceeds 10KB, the input is formatted eagerly (with the existing truncation logic informatAllToolInput) and stored ininputFullinstead of retaining the unbounded raw dictionary in memory.Cache resolvedInputFull with @State — Both
ToolCallChipandUsedToolsRownow cache the formatted input in a@Stateproperty that is populated once via.onAppearwhen the user first expands the tool call. This preventsformatAllToolInputfrom re-running on every SwiftUI render pass while expanded.Remove dead
ensureInputFullFormatted()— The mutating method onToolCallDatawas never called anywhere in the codebase. The@Statecaching approach is simpler for SwiftUI views, so this dead code was removed.Files Changed
clients/shared/Features/Chat/ChatViewModel.swift— Size-check raw dict before storingclients/shared/Features/Chat/ToolCallChip.swift— Add @State cache + .onAppearclients/macos/vellum-assistant/Features/Chat/UsedToolsList.swift— Add @State cache + .onAppearclients/shared/Features/Chat/ChatMessage.swift— Remove deadensureInputFullFormatted()🤖 Generated with Claude Code