From 0e3eaab1371d0cb42e22a2a024debd9552b22c1b Mon Sep 17 00:00:00 2001 From: Mathews-Tom Date: Thu, 16 Jul 2026 02:08:42 +0530 Subject: [PATCH] fix(advisor): preserve history tool arguments --- packages/coding-agent/src/advisor/runtime.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/coding-agent/src/advisor/runtime.ts b/packages/coding-agent/src/advisor/runtime.ts index 19cf81061..9c52d9bda 100644 --- a/packages/coding-agent/src/advisor/runtime.ts +++ b/packages/coding-agent/src/advisor/runtime.ts @@ -2,7 +2,6 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import { estimateTokens } from "@oh-my-pi/pi-agent-core/compaction"; import type { AssistantMessage, ImageContent, TextContent } from "@oh-my-pi/pi-ai"; import { logger } from "@oh-my-pi/pi-utils"; -import { INTENT_FIELD } from "@oh-my-pi/pi-wire"; import { obfuscateToolArguments, type SecretObfuscator } from "../secrets/obfuscator"; import { formatExecutionSourcePreview, @@ -729,12 +728,8 @@ function obfuscateAssistantMessage( return { ...block, thinking, thinkingSignature: undefined }; } if (block.type === "toolCall") { - const primaryArg = formatToolCallPrimaryArg(block.name, block.arguments); - const intent = formatToolCallIntentPreview(block.arguments); - const args = { - path: obfuscator.obfuscate(primaryArg, sharedRegexSecretValues), - ...(intent ? { [INTENT_FIELD]: obfuscator.obfuscate(intent, sharedRegexSecretValues) } : {}), - }; + const args = obfuscateToolArguments(obfuscator, block.arguments, sharedRegexSecretValues); + if (args === block.arguments) return block; changed = true; return { ...block, arguments: args }; }