Skip to content

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.

fix(code): New on an untouched session adds no empty entry

purple1030e7818b3e
diff --git a/e2e/code-conversation-stays-in-code.spec.ts b/e2e/code-conversation-stays-in-code.spec.ts
index 6a50368b..d33d6f74 100644
--- a/e2e/code-conversation-stays-in-code.spec.ts
+++ b/e2e/code-conversation-stays-in-code.spec.ts
@@ -112,3 +112,24 @@ test('the Chat button goes back to the chat, and so does the start after a Code
await expect(page.getByText(CHAT_MARKE)).toBeVisible()
await expect(page.getByTestId('codex-transcript')).toHaveCount(0)
})
+
+test('New on an untouched Code session adds no second empty entry', async ({ page }) => {
+ // 3.0.4 box run: every click on New added another empty "Coding Agent".
+ await bootCode(page)
+ const codeConvs = () => page.evaluate(async () => {
+ const chatPath = '/src/stores/chatStore.ts'
+ const chat = await import(/* @vite-ignore */ chatPath) as typeof import('../src/stores/chatStore')
+ return chat.useChatStore.getState().conversations.filter((c) => c.mode === 'codex').length
+ })
+ const newButton = page.getByRole('button', { name: 'New', exact: true })
+ await newButton.click()
+ const before = await codeConvs()
+ await newButton.click()
+ await newButton.click()
+ expect(await codeConvs()).toBe(before)
+
+ // NEGATIVE CONTROL: once the session has a message, New starts a fresh one.
+ await codeVerlauf(page)
+ await newButton.click()
+ expect(await codeConvs()).toBe(before + 1)
+})
diff --git a/src/components/chat/CodexView.tsx b/src/components/chat/CodexView.tsx
index e8121de0..4d57c7c3 100644
--- a/src/components/chat/CodexView.tsx
+++ b/src/components/chat/CodexView.tsx
@@ -198,6 +198,12 @@ export function CodexView() {
const startNewSession = () => {
stopCodex()
if (!activeModel) return
+ // An untouched session IS a new session. Each click used to add another
+ // empty "Coding Agent" to the list (3.0.4 box run: two clicks, two rows).
+ const { conversations: convs, activeConversationId: current } = useChatStore.getState()
+ const open = convs.find((c) => c.id === current)
+ if (open?.mode === 'codex' && open.messages.length === 0
+ && !(useCodexStore.getState().threads[open.id]?.events.length)) return
const convId = createConversation(activeModel, '', 'codex')
// "New" keeps the Ask/Bypass the user last picked (Gegenprobe 01.10.2026).
useCodexStore.getState().startConversationMode(convId)