From 2a95c91cab74873a2ac0f987e848fdaa56007732 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sun, 11 Jan 2026 12:22:59 +0900 Subject: [PATCH] fix(context-injector): inject only via messages.transform to preserve UI - Remove contextInjector call from chat.message hook chain - Context injection now only happens in messages.transform hook - This ensures UI displays original user message while model receives prepended context - Fixes bug where commit message promised clone behavior but implementation mutated directly --- src/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 48b2e688..b2ae0d19 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,7 +33,6 @@ import { } from "./hooks"; import { contextCollector, - createContextInjectorHook, createContextInjectorMessagesTransformHook, } from "./features/context-injector"; import { createGoogleAntigravityAuthPlugin } from "./auth/antigravity"; @@ -167,7 +166,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { const keywordDetector = isHookEnabled("keyword-detector") ? createKeywordDetectorHook(ctx, contextCollector) : null; - const contextInjector = createContextInjectorHook(contextCollector); const contextInjectorMessagesTransform = createContextInjectorMessagesTransformHook(contextCollector); const agentUsageReminder = isHookEnabled("agent-usage-reminder") @@ -314,7 +312,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { "chat.message": async (input, output) => { await keywordDetector?.["chat.message"]?.(input, output); - await contextInjector["chat.message"]?.(input, output); + // NOTE: context injection moved to messages.transform to avoid mutating UI await claudeCodeHooks["chat.message"]?.(input, output); await autoSlashCommand?.["chat.message"]?.(input, output); await startWork?.["chat.message"]?.(input, output);