From f5260d0ac312c93f28ab7deab9231e33d23036db Mon Sep 17 00:00:00 2001 From: siddseethepalli Date: Mon, 13 Apr 2026 02:30:10 +0000 Subject: [PATCH] fix(macos): drop O(n) hashValue from tool-output cache key --- .../Features/Chat/AssistantProgressView.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/clients/macos/vellum-assistant/Features/Chat/AssistantProgressView.swift b/clients/macos/vellum-assistant/Features/Chat/AssistantProgressView.swift index 7da39f63e81..a9019642d71 100644 --- a/clients/macos/vellum-assistant/Features/Chat/AssistantProgressView.swift +++ b/clients/macos/vellum-assistant/Features/Chat/AssistantProgressView.swift @@ -956,15 +956,14 @@ private struct StepDetailRow: View { result: String, isError: Bool ) -> NSString { - // Cheap content fingerprint: length + prefix + suffix + per-process hash. - // Ensures the key changes when `result` is overwritten in place with - // different text of the same byte count (replay / correction / rehydration - // paths all mutate toolCalls[...].result). + // O(1) content fingerprint: length + boundary samples. Catches in-place + // mutations (replay / correction / rehydration paths all overwrite + // toolCalls[...].result) without hashing the full string on every + // SwiftUI re-render. let count = result.utf8.count let prefix = result.prefix(16) let suffix = result.suffix(16) - let hash = result.hashValue - return "\(toolCallID)|\(count)|\(isError ? "err" : "ok")|\(prefix)|\(suffix)|\(hash)" as NSString + return "\(toolCallID)|\(count)|\(isError ? "err" : "ok")|\(prefix)|\(suffix)" as NSString } private func coloredOutput(_ result: String, isError: Bool) -> AttributedString {