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): erfolgreiches Laden loeschte eine fremde Ablehnungsmeldung (R2-43)
purpled13ad40d6196
diff --git a/src/components/chat/ExplorerPanel.tsx b/src/components/chat/ExplorerPanel.tsxindex 9869200a..a3fe83d6 100644--- a/src/components/chat/ExplorerPanel.tsx+++ b/src/components/chat/ExplorerPanel.tsx@@ -130,6 +130,11 @@ export function ExplorerPanel({ onApprovePlan }: Props) {const [expanded, setExpanded] = useState<string[]>([])const [busy, setBusy] = useState<string[]>([])const [error, setError] = useState<string | null>(null)+ // R2-43: a folder-pick REFUSAL used to share `error` with the root-load+ // failure. A later, unrelated load of the (still valid) current root+ // succeeding cleared `error` on its way, wiping a refusal message the user+ // had not read yet. Its own state survives any load that isn't about it.+ const [pickError, setPickError] = useState<string | null>(null)const [selected, setSelected] = useState<ExplorerNode | null>(null)const planWaiting = useCodexStore((s) =>@@ -160,6 +165,7 @@ export function ExplorerPanel({ onApprovePlan }: Props) {setExpanded([])setSelected(null)setError(null)+ setPickError(null)if (root) load(root)// eslint-disable-next-line react-hooks/exhaustive-deps}, [root])@@ -211,7 +217,7 @@ export function ExplorerPanel({ onApprovePlan }: Props) {// steht in lib/dev-fs-jail.ts), der getippte Pfad ist der vorgesehene Weg// und er funktioniert. Deshalb steht er dort und nur dort.const pickFolder = async () => {- setError(null)+ setPickError(null)if (!isTauri()) {const typed = window.prompt('Enter folder path:', root || (isMacOS() ? '/Users/' : 'C:\\Users'))if (typed) setWorkingDirectory(typed)@@ -224,7 +230,7 @@ export function ExplorerPanel({ onApprovePlan }: Props) {})if (picked) setWorkingDirectory(picked)} catch (e) {- setError(workspacePickRefusedMessage(e))+ setPickError(workspacePickRefusedMessage(e))}}@@ -366,12 +372,12 @@ export function ExplorerPanel({ onApprovePlan }: Props) {der Grund verschwand ungelesen. Der Nutzer sah einen Klick, dernichts tat, und den einzigen Satz, der ihm haette sagen koennen,warum, bekam er nie. Der Fehler steht deshalb zuerst. */}- {error ? (+ {pickError || error ? (<pdata-testid="explorer-error"className="text-[0.5rem] text-red-500/80 px-1 py-2 break-words">- {error}+ {pickError || error}</p>) : !root ? (<pdiff --git a/src/components/chat/__tests__/the-picked-folder-is-not-swallowed.test.ts b/src/components/chat/__tests__/the-picked-folder-is-not-swallowed.test.tsindex 8a8b77a5..2f0960aa 100644--- a/src/components/chat/__tests__/the-picked-folder-is-not-swallowed.test.ts+++ b/src/components/chat/__tests__/the-picked-folder-is-not-swallowed.test.ts@@ -186,4 +186,43 @@ describe('die Ablehnung im leeren Zustand', () => {cleanup()vi.restoreAllMocks()})++ it('R2-43: survives a later, unrelated successful load of the still-valid root', async () => {+ const { render, screen, fireEvent, act, cleanup } = await import('@testing-library/react')+ const { createElement } = await import('react')+ const { useCodexStore } = await import('../../../stores/codexStore')+ const backend = await import('../../../api/backend')+ const { ExplorerPanel } = await import('../ExplorerPanel')++ vi.spyOn(backend, 'isTauri').mockReturnValue(true)+ vi.spyOn(backend, 'backendCall').mockImplementation(async (cmd: string) => {+ if (cmd === 'pick_folder') throw new Error('a home or mount container is not a workspace')+ if (cmd === 'fs_list') return { entries: [], truncated: false } as never+ return null as never+ })+ // A root that keeps loading fine on its own, unrelated to the refused pick.+ useCodexStore.setState({ workingDirectory: '/Users/x/existing-project' })++ render(createElement(ExplorerPanel, { onApprovePlan: () => {} }))+ await act(async () => { await new Promise((r) => setTimeout(r, 10)) })++ await act(async () => {+ fireEvent.click(screen.getByTestId('explorer-pick-folder'))+ await new Promise((r) => setTimeout(r, 30))+ })+ expect(screen.queryByTestId('explorer-error')!.textContent)+ .toContain('a home or mount container is not a workspace')++ // The agent writes a file: fileTreeVersion bumps, the (unchanged, valid)+ // root reloads and succeeds. The refusal must still be on screen.+ await act(async () => {+ useCodexStore.getState().bumpFileTreeVersion()+ await new Promise((r) => setTimeout(r, 30))+ })+ const fehler = screen.queryByTestId('explorer-error')+ expect(fehler, 'a harmless reload of the root wiped the refusal').not.toBeNull()+ expect(fehler!.textContent).toContain('a home or mount container is not a workspace')+ cleanup()+ vi.restoreAllMocks()+ })})