The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(code): New keeps the Ask or Bypass the user picked last
purplea0d4bc5dfe33
diff --git a/src/components/chat/CodexModeDropdown.tsx b/src/components/chat/CodexModeDropdown.tsxindex 660a85dc..c5e58a16 100644--- a/src/components/chat/CodexModeDropdown.tsx+++ b/src/components/chat/CodexModeDropdown.tsx@@ -16,9 +16,10 @@ import {** Lives in the CODE composer only, hooked in through ChatInput's* `composerActions` so ChatInput itself stays surface-neutral and the Chat tab- * inherits nothing. The mode is remembered per conversation, with- * settings.codexDefaultMode as the fallback; picking one here NEVER writes the- * global settings, so another conversation and the Agent surface are untouched.+ * inherits nothing. The mode is remembered per conversation; a new one is+ * created in the last Ask/Bypass picked here (codexStore.startConversationMode),+ * otherwise settings.codexDefaultMode applies. Picking one here NEVER writes the global settings,+ * so a running conversation and the Agent surface are untouched.** A switch takes effect from the NEXT send. While a run is in flight the* trigger says so and the pick is parked, because the running turn resolved itsdiff --git a/src/components/chat/CodexView.tsx b/src/components/chat/CodexView.tsxindex 828018da..26220f09 100644--- a/src/components/chat/CodexView.tsx+++ b/src/components/chat/CodexView.tsx@@ -196,7 +196,10 @@ export function CodexView() {// folder; a brand-new conversation means a brand-new thread on next send.const startNewSession = () => {stopCodex()- if (activeModel) createConversation(activeModel, '', 'codex')+ if (!activeModel) return+ const convId = createConversation(activeModel, '', 'codex')+ // "New" keeps the Ask/Bypass the user last picked (Gegenprobe 01.10.2026).+ useCodexStore.getState().startConversationMode(convId)}return (diff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.tsindex 5bbe367c..fc95345c 100644--- a/src/hooks/useCodex.ts+++ b/src/hooks/useCodex.ts@@ -394,6 +394,7 @@ export function useCodex() {let convId = store.activeConversationIdif (!convId) {convId = store.createConversation(activeModel, persona?.systemPrompt || '', 'codex')+ useCodexStore.getState().startConversationMode(convId)}// ── Re-entry guard (double-submit), PER CONVERSATION ─────────────────diff --git a/src/stores/__tests__/codexStore-mode.test.ts b/src/stores/__tests__/codexStore-mode.test.tsindex 3fc75acf..02c8e1a4 100644--- a/src/stores/__tests__/codexStore-mode.test.ts+++ b/src/stores/__tests__/codexStore-mode.test.ts@@ -34,6 +34,7 @@ beforeEach(() => {localStorage.clear()useCodexStore.setState({modeByConversation: {},+ lastPickedMode: null,parkedModeByConversation: {},prePlanModeByConversation: {},planApprovalByConversation: {},@@ -59,6 +60,37 @@ describe('resolution: the conversation first, then the global default', () => {})})+describe('a new conversation starts in the last Ask/Bypass pick (Gegenprobe 01.10.2026)', () => {+ it('"New" after picking Bypass starts in Bypass', () => {+ useCodexStore.getState().chooseCodexMode('old', 'bypass', false)+ useCodexStore.getState().startConversationMode('new')+ expect(useCodexStore.getState().codexModeFor('new', 'ask')).toBe('bypass')+ })++ it('Plan is never carried over: the new one starts in the Ask/Bypass from before', () => {+ useCodexStore.getState().chooseCodexMode('old', 'bypass', false)+ useCodexStore.getState().chooseCodexMode('old', 'plan', false)+ useCodexStore.getState().startConversationMode('new')+ expect(useCodexStore.getState().codexModeFor('new', 'ask')).toBe('bypass')+ })++ it('a pick parked during a run counts as the last pick too', () => {+ useCodexStore.getState().chooseCodexMode('old', 'bypass', true)+ useCodexStore.getState().startConversationMode('new')+ expect(useCodexStore.getState().codexModeFor('new', 'ask')).toBe('bypass')+ })++ it('nothing picked yet: the global default, and the stamp does not overwrite an own pick', () => {+ useCodexStore.getState().startConversationMode('new')+ expect(useCodexStore.getState().modeByConversation.new).toBeUndefined()+ expect(useCodexStore.getState().codexModeFor('new', 'ask')).toBe('ask')+ useCodexStore.getState().chooseCodexMode('own', 'ask', false)+ useCodexStore.getState().chooseCodexMode('other', 'bypass', false)+ useCodexStore.getState().startConversationMode('own')+ expect(useCodexStore.getState().codexModeFor('own', 'ask')).toBe('ask')+ })+})+describe('a switch during a run parks and applies at the next send', () => {it('does not touch the running turn', () => {useCodexStore.getState().chooseCodexMode('x', 'ask', false)@@ -127,7 +159,7 @@ describe('R1 DOWNGRADE-KONTRAKT: the persist shape stays additive at version 0',useCodexStore.getState().setWorkingDirectory('/repo')useCodexStore.getState().chooseCodexMode('x', 'plan', false)const raw = persisted()- expect(Object.keys(raw.state).sort()).toEqual(['modeByConversation', 'workingDirectory'])+ expect(Object.keys(raw.state).sort()).toEqual(['lastPickedMode', 'modeByConversation', 'workingDirectory'])expect(raw.state.modeByConversation).toEqual({ x: 'plan' })expect(raw.state.workingDirectory).toBe('/repo')})diff --git a/src/stores/__tests__/codexStore-working-directory.test.ts b/src/stores/__tests__/codexStore-working-directory.test.tsindex 7195de29..fd69272c 100644--- a/src/stores/__tests__/codexStore-working-directory.test.ts+++ b/src/stores/__tests__/codexStore-working-directory.test.ts@@ -235,7 +235,9 @@ describe('R1 DOWNGRADE-KONTRAKT still holds', () => {useCodexStore.getState().beginSend()const raw = persisted()- expect(Object.keys(raw.state).sort()).toEqual(['modeByConversation', 'workingDirectory'])+ // lastPickedMode joined additively on 01.10.2026 (a new conversation keeps+ // the last Ask/Bypass); removing the folder still adds nothing.+ expect(Object.keys(raw.state).sort()).toEqual(['lastPickedMode', 'modeByConversation', 'workingDirectory'])expect(raw.version ?? 0).toBe(0)// Negative control: the threads that were just unpinned stay off the disk.expect(raw.state.threads).toBeUndefined()diff --git a/src/stores/codexStore.ts b/src/stores/codexStore.tsindex 508809d0..ccfbe134 100644--- a/src/stores/codexStore.ts+++ b/src/stores/codexStore.ts@@ -54,6 +54,16 @@ interface CodexState {* modes and nothing else, and they fall back to settings.codexDefaultMode.*/modeByConversation: Record<string, CodexMode>+ /**+ * The last Ask or Bypass the user picked anywhere. A NEW conversation is+ * stamped with it when it is created (startConversationMode), instead of+ * falling back to Ask, which made every "New" undo the user's choice+ * (Gegenprobe 01.10.2026). Stamped, not used as a fallback: an older+ * conversation that never picked keeps running in what it always ran in.+ * Plan is per task and never carried over: a fresh conversation does not+ * start read-only. Persisted, additive, a downgrade only loses this key.+ */+ lastPickedMode: Exclude<CodexMode, 'plan'> | null/*** A mode picked while a run is in flight. It does NOT touch the running turn:* a switch takes effect from the next send, which is what the dropdown says.@@ -111,6 +121,8 @@ interface CodexState {* PARKED and applied by the next send; otherwise it lands immediately.*/chooseCodexMode: (conversationId: string, mode: CodexMode, runActive: boolean) => void+ /** A Code conversation was just created: it starts in the last Ask/Bypass pick. */+ startConversationMode: (conversationId: string) => void/** Apply a parked pick. Called once at the start of every send. */applyParkedMode: (conversationId: string) => void/** The conversation's mode, falling back to the global default. */@@ -147,6 +159,7 @@ export const useCodexStore = create<CodexState>()(workingDirectory: '',fileTreeVersion: 0,modeByConversation: {},+ lastPickedMode: null,parkedModeByConversation: {},prePlanModeByConversation: {},planApprovalByConversation: {},@@ -186,7 +199,8 @@ export const useCodexStore = create<CodexState>()(// what "Approve and run" reads to decide its target mode. While a run// is active that is all it is, the running turn keeps its own mode.const parked = { ...state.parkedModeByConversation, [conversationId]: mode }- if (runActive) return { parkedModeByConversation: parked }+ const lastPickedMode = mode === 'plan' ? state.lastPickedMode : mode+ if (runActive) return { parkedModeByConversation: parked, lastPickedMode }const current = state.modeByConversation[conversationId]const prePlan =mode === 'plan' && current !== 'plan' && current@@ -196,9 +210,16 @@ export const useCodexStore = create<CodexState>()(parkedModeByConversation: parked,prePlanModeByConversation: prePlan,modeByConversation: { ...state.modeByConversation, [conversationId]: mode },+ lastPickedMode,}}),+ startConversationMode: (conversationId) =>+ set((state) => {+ if (!state.lastPickedMode || state.modeByConversation[conversationId]) return state+ return { modeByConversation: { ...state.modeByConversation, [conversationId]: state.lastPickedMode } }+ }),+applyParkedMode: (conversationId) =>set((state) => {const parked = state.parkedModeByConversation[conversationId]@@ -339,6 +360,7 @@ export const useCodexStore = create<CodexState>()(partialize: (state) => ({workingDirectory: state.workingDirectory,modeByConversation: state.modeByConversation,+ lastPickedMode: state.lastPickedMode,}),// Existing installs have a persisted `chatMode: 'codex'` (or similar) in// localStorage from v2.3.8 and earlier. partialize only affects writes,