From f72bb3fe8feceb0e16e1b36a81cc65954ae66184 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 18 May 2026 12:33:32 +0900 Subject: [PATCH] refactor(hooks): replace direct output.args mutation with replaceToolArgs (claude-code-hooks) Replace output.args.todos = parsed and Object.assign(output.args, result.modifiedInput) with replaceToolArgs() calls that create a shallow clone instead of mutating the potentially-frozen args object. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- .../handlers/tool-execute-before-handler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hooks/claude-code-hooks/handlers/tool-execute-before-handler.ts b/src/hooks/claude-code-hooks/handlers/tool-execute-before-handler.ts index 412cc2c23..612a63696 100644 --- a/src/hooks/claude-code-hooks/handlers/tool-execute-before-handler.ts +++ b/src/hooks/claude-code-hooks/handlers/tool-execute-before-handler.ts @@ -8,7 +8,7 @@ import { import { appendTranscriptEntry } from "../transcript" import { cacheToolInput } from "../tool-input-cache" import type { PluginConfig } from "../types" -import { isHookDisabled, log } from "../../../shared" +import { isHookDisabled, log, replaceToolArgs } from "../../../shared" export function createToolExecuteBeforeHandler(ctx: PluginInput, config: PluginConfig) { return async ( @@ -39,7 +39,7 @@ export function createToolExecuteBeforeHandler(ctx: PluginInput, config: PluginC ) } - output.args.todos = parsed + replaceToolArgs(output, { todos: parsed }) log("todowrite: parsed todos string to array", { sessionID: input.sessionID }) } @@ -87,7 +87,7 @@ export function createToolExecuteBeforeHandler(ctx: PluginInput, config: PluginC } if (result.modifiedInput) { - Object.assign(output.args, result.modifiedInput) + replaceToolArgs(output, result.modifiedInput as Record) } } }