From 458341d79f1a89e88f610c2d777950b5ae64fff5 Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Sun, 25 Jan 2026 19:24:55 -0800 Subject: [PATCH] AIX debugger: don't auto-advance frame for support operations --- .../debugger/memstore-aix-client-debugger.ts | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/modules/aix/client/debugger/memstore-aix-client-debugger.ts b/src/modules/aix/client/debugger/memstore-aix-client-debugger.ts index bbd2c5e19..82b2e9bd9 100644 --- a/src/modules/aix/client/debugger/memstore-aix-client-debugger.ts +++ b/src/modules/aix/client/debugger/memstore-aix-client-debugger.ts @@ -1,5 +1,7 @@ import { create } from 'zustand'; +import type { AixAPI_Context_ChatGenerate } from '../../server/api/aix.wiretypes'; + // // NOTE: this file is supposed to be lightweight and to be kept in memory. Particles are used by reference and // not cloned or modified. Visualization is a Reactive stringification of the referred objects pretty much. @@ -7,6 +9,19 @@ import { create } from 'zustand'; const DEFAULT_FRAMES_COUNT = 10; +// Context names that should NOT auto-select when created (background operations) +const BACKGROUND_CONTEXT_NAMES = [ + 'chat-ai-summarize', + 'chat-ai-summary', + 'chat-ai-title', + 'chat-attachment-prompts', + 'chat-followup-chartjs', + 'chat-followup-diagram', + 'chat-followup-htmlui', + 'fixup-code', + 'aifn-image-caption', +] as const satisfies (AixAPI_Context_ChatGenerate['name'] | string)[]; + /// Types /// @@ -110,9 +125,14 @@ export const useAixClientDebuggerStore = create((_set) = createFrame: (transport, initialContext) => { const newFrame = _createAixClientDebuggerFrame(transport, initialContext); + // Don't auto-select background operations (e.g., title generation) to avoid + // stealing focus from the main conversation request + const isBackgroundOperation = (BACKGROUND_CONTEXT_NAMES as readonly string[]).includes(initialContext.contextName); + _set((state) => ({ frames: [newFrame, ...state.frames].slice(0, state.maxFrames), - activeFrameId: newFrame.id, + // Auto-select if: no active frame yet, OR this is not a background operation + activeFrameId: (!state.activeFrameId || !isBackgroundOperation) ? newFrame.id : state.activeFrameId, })); return newFrame.id;