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): das Arbeitsverzeichnis im Coding Agent laesst sich wieder entfernen
purplee085dd00886a
diff --git a/src/components/chat/CodexView.tsx b/src/components/chat/CodexView.tsxindex 3c7e2cde..66e31b99 100644--- a/src/components/chat/CodexView.tsx+++ b/src/components/chat/CodexView.tsx@@ -23,7 +23,7 @@ import { useSettingsStore } from '../../stores/settingsStore'import { useModelStore } from '../../stores/modelStore'import { StagedChangesPanel } from './StagedChangesPanel'import { SlashStepsBlock } from './SlashStepsBlock'-import { User, Code, Eye, GitBranch, Download, RefreshCw, RotateCcw, Folder, Check, AlertTriangle } from 'lucide-react'+import { User, Code, Eye, GitBranch, Download, RefreshCw, RotateCcw, Folder, FolderX, Check, AlertTriangle } from 'lucide-react'import { useEffect, useState } from 'react'import { checkGitInstalled, openExternal, type GitStatus } from '../../api/backend'import { CodexConfirmDialog } from './CodexConfirmDialog'@@ -78,6 +78,16 @@ export function CodexView() {const activeModel = useModelStore((s) => s.activeModel)const createConversation = useChatStore((s) => s.createConversation)const codexWorkingDir = useCodexStore((s) => s.workingDirectory)+ const clearWorkingDirectory = useCodexStore((s) => s.clearWorkingDirectory)+ const anyThreadRunning = useCodexStore((s) =>+ Object.values(s.threads).some((t) => t.status === 'running'),+ )+ // A8 (2.6.8): the same Remove sits in the explorer column, but that column+ // can be collapsed, and two users looked for a way out of their folder and+ // found none. The header always shows the folder, so it also carries the way+ // to give it back. Locked, not hidden, while a coding turn is in flight.+ const removeFolderLocked =+ anyThreadRunning || Object.values(generatingMap).some(Boolean)// Git availability for the Codex view (v2.5.0). Codex shells out to git for// git_status/diff/commit/log; if git is missing those tools fail. Probe on@@ -142,6 +152,21 @@ export function CodexView() {<Folder size={9} className="shrink-0 opacity-70" /><span className="truncate">{codexWorkingDir || 'sandbox · ~/agent-workspace'}</span></span>+ {codexWorkingDir && (+ <button+ onClick={() => { if (!removeFolderLocked) clearWorkingDirectory() }}+ disabled={removeFolderLocked}+ data-testid="codex-remove-folder"+ title={+ removeFolderLocked+ ? 'Wait for the current run to finish, then you can remove the folder.'+ : 'Remove this folder. The agent falls back to its own sandbox under ~/agent-workspace until you pick a new one.'+ }+ className="p-0.5 rounded text-gray-400 dark:text-gray-600 hover:text-red-500 dark:hover:text-red-400 hover:bg-gray-100 dark:hover:bg-white/5 disabled:opacity-30 disabled:hover:text-gray-400 transition-colors shrink-0"+ >+ <FolderX size={9} />+ </button>+ )}<div className="flex-1" />{/* New coding session — aborts any running loop and starts a freshchat/thread (keeps the working directory). David 2026-06-04:@@ -207,9 +232,10 @@ export function CodexView() {<p className="text-[0.55rem] text-gray-400 dark:text-gray-600 mt-0.5 max-w-[300px]">Send a coding instruction. The coding agent will read your codebase, write code, and run commands.</p>- {!thread?.workingDirectory && (- <p className="text-[0.55rem] text-amber-500/70 mt-2">- Set a working directory in the file tree panel →+ {!codexWorkingDir && (+ <p className="text-[0.55rem] text-amber-500/70 mt-2" data-testid="codex-no-folder-hint">+ No folder set. The agent works in its own sandbox under ~/agent-workspace.+ Pick a project with "Select folder..." in the file tree panel on the right.</p>)}</div>diff --git a/src/components/chat/ExplorerPanel.tsx b/src/components/chat/ExplorerPanel.tsxindex 23bb0b29..dbc665f5 100644--- a/src/components/chat/ExplorerPanel.tsx+++ b/src/components/chat/ExplorerPanel.tsx@@ -36,8 +36,10 @@ import {PanelRightClose,PanelRightOpen,RefreshCw,+ X,} from 'lucide-react'import { useCodexStore } from '../../stores/codexStore'+import { useGenerationStore } from '../../stores/generationStore'import { useUIStore } from '../../stores/uiStore'import { backendCall, isTauri, isMacOS } from '../../api/backend'import {@@ -67,8 +69,20 @@ interface Props {export function ExplorerPanel({ onApprovePlan }: Props) {const root = useCodexStore((s) => s.workingDirectory)const setWorkingDirectory = useCodexStore((s) => s.setWorkingDirectory)+ const clearWorkingDirectory = useCodexStore((s) => s.clearWorkingDirectory)const fileTreeVersion = useCodexStore((s) => s.fileTreeVersion)+ // A8 (2.6.8): the folder is GLOBAL, so removing it while any coding turn is+ // in flight would pull the rug out from under a run in another chat as well.+ // Locked with a reason on the button while that is the case, not hidden.+ const anyTurnGenerating = useGenerationStore((s) =>+ Object.values(s.generating).some(Boolean),+ )+ const anyThreadRunning = useCodexStore((s) =>+ Object.values(s.threads).some((t) => t.status === 'running'),+ )+ const runActive = anyTurnGenerating || anyThreadRunning+const width = useUIStore((s) => s.explorerWidth)const collapsed = useUIStore((s) => s.explorerCollapsed)const setExplorerWidth = useUIStore((s) => s.setExplorerWidth)@@ -158,6 +172,15 @@ export function ExplorerPanel({ onApprovePlan }: Props) {if (picked) setWorkingDirectory(picked)}+ // Give the folder back (A8). Users reported no way out of a folder they had+ // opened by mistake, one of them was ready to reinstall the app over it.+ // Clearing the store also unpins every open thread, so the CURRENT chat falls+ // back to its own sandbox instead of keeping the tree it was born with.+ const removeFolder = () => {+ if (runActive) return+ clearWorkingDirectory()+ }+const startDrag = (e: React.PointerEvent) => {e.preventDefault()const startX = e.clientX@@ -231,6 +254,21 @@ export function ExplorerPanel({ onApprovePlan }: Props) {<span className="text-[0.5rem] text-gray-400 dark:text-gray-600 flex-1">Select folder...</span>)}</button>+ {root && (+ <button+ onClick={removeFolder}+ disabled={runActive}+ data-testid="explorer-remove-folder"+ title={+ runActive+ ? 'Wait for the current run to finish, then you can remove the folder.'+ : 'Remove this folder. The agent falls back to its own sandbox until you pick a new one.'+ }+ className="p-1 rounded hover:bg-gray-100 dark:hover:bg-white/5 text-gray-400 dark:text-gray-600 hover:text-red-500 dark:hover:text-red-400 disabled:opacity-30 disabled:hover:text-gray-400 transition-colors shrink-0"+ >+ <X size={10} />+ </button>+ )}<buttononClick={refresh}disabled={!root}@@ -251,7 +289,13 @@ export function ExplorerPanel({ onApprovePlan }: Props) {<div className={`overflow-y-auto scrollbar-thin p-1 ${selected ? 'max-h-[45%] shrink-0' : 'flex-1 min-h-0'}`}>{!root ? (- <p className="text-[0.5rem] text-gray-400 dark:text-gray-600 px-1 py-2">Click above to set a folder</p>+ <p+ data-testid="explorer-no-folder"+ className="text-[0.5rem] text-gray-400 dark:text-gray-600 px-1 py-2 leading-relaxed"+ >+ No folder. The agent works in its own sandbox under ~/agent-workspace.+ Click "Select folder..." above to point it at a project.+ </p>) : error ? (<p className="text-[0.5rem] text-red-500/80 px-1 py-2 break-words">{error}</p>) : !rootListing ? (diff --git a/src/stores/codexStore.ts b/src/stores/codexStore.tsindex 1b141a05..5d2279b2 100644--- a/src/stores/codexStore.ts+++ b/src/stores/codexStore.ts@@ -48,7 +48,20 @@ interface CodexState {planApprovalByConversation: Record<string, CodexPlanApproval>setChatMode: (mode: ChatMode) => void+ /**+ * Pick the folder the agent works in. It also re-pins every EXISTING thread,+ * because a thread copies the folder once at init and never looked at the+ * store again: a mis-click used to stay the agent's root for the rest of the+ * conversation, no matter what the picker said afterwards (A8, 2.6.8).+ */setWorkingDirectory: (dir: string) => void+ /**+ * Give the folder back. Same re-pin as above, so the current conversation+ * falls back to its per-chat sandbox instead of staying attached to a tree+ * the user never meant to open. The empty string is persisted on purpose:+ * a restart must not resurrect the folder (A8, 2.6.8).+ */+ clearWorkingDirectory: () => voidbumpFileTreeVersion: () => void/**@@ -76,6 +89,35 @@ function omit<T>(map: Record<string, T>, key: string): Record<string, T> {return next}+/**+ * Point every open thread at `dir`.+ *+ * `initThread` copies the store's folder into the thread ONCE, and the run+ * resolver prefers `thread.workingDirectory` over the store. Without this the+ * store and the thread drift apart the moment the user picks again, which is+ * exactly what A8 reads like from the outside: the picker says one folder, the+ * agent keeps walking the old one, and clearing the store changes nothing.+ *+ * Returns the SAME object when there is nothing to change, so a no-op set does+ * not re-render every subscriber.+ */+function pinThreads(+ threads: Record<string, CodexThread>,+ dir: string,+): Record<string, CodexThread> {+ let changed = false+ const next: Record<string, CodexThread> = {}+ for (const [id, thread] of Object.entries(threads)) {+ if (thread.workingDirectory === dir) {+ next[id] = thread+ continue+ }+ next[id] = { ...thread, workingDirectory: dir }+ changed = true+ }+ return changed ? next : threads+}+export const useCodexStore = create<CodexState>()(persist((set, get) => ({@@ -89,7 +131,13 @@ export const useCodexStore = create<CodexState>()(planApprovalByConversation: {},setChatMode: (mode) => set({ chatMode: mode }),- setWorkingDirectory: (dir) => set({ workingDirectory: dir }),+ setWorkingDirectory: (dir) =>+ set((state) => ({ workingDirectory: dir, threads: pinThreads(state.threads, dir) })),+ // '' and not `undefined`: partialize writes this key on every change, so+ // the empty string is what lands in localStorage and what a restart reads+ // back. Deleting the key would let an older persisted value survive.+ clearWorkingDirectory: () =>+ set((state) => ({ workingDirectory: '', threads: pinThreads(state.threads, '') })),bumpFileTreeVersion: () => set((state) => ({ fileTreeVersion: state.fileTreeVersion + 1 })),chooseCodexMode: (conversationId, mode, runActive) =>