clawwork-ai/ClawWork

[Bug] SystemSection handleChangeWorkspace button stuck spinning on IPC error

Open

#398 opened on Apr 15, 2026

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (63 forks)github user discovery
area/uigood first issuekind/bug

Repository metrics

Stars
 (519 stars)
PR merge metrics
 (PR metrics pending)

Description

Problem

SystemSection.handleChangeWorkspace calls setChangingWorkspace(true)await window.clawwork.changeWorkspace(selected)setChangingWorkspace(false) without a try/catch. If the IPC throws (workspace migration exception, invalid path, disk error), the final state reset never runs and the "Change Workspace" button is stuck showing a spinner until the user closes Settings.

Location

File: packages/desktop/src/renderer/layouts/Settings/sections/SystemSection.tsx:62-78

const handleChangeWorkspace = useCallback(async () => {
  const selected = await window.clawwork.browseWorkspace();
  if (!selected || selected === workspacePath) return;
  const oldPath = workspacePath;
  setChangingWorkspace(true);
  const result = await window.clawwork.changeWorkspace(selected);  // throw → stuck
  setChangingWorkspace(false);
  if (result.ok) {
    // ...
  } else {
    toast.error(t('settings.workspaceChangeFailed', { error: result.error }));
  }
}, [workspacePath, t]);

Fix Approach

Wrap the body in try/finally:

setChangingWorkspace(true);
try {
  const result = await window.clawwork.changeWorkspace(selected);
  if (result.ok) {
    setWorkspacePath(selected);
    toast.success(...);
  } else {
    toast.error(t('settings.workspaceChangeFailed', { error: result.error }));
  }
} catch (err) {
  console.error('[SystemSection] changeWorkspace failed:', err);
  toast.error(t('settings.workspaceChangeFailed', { error: String(err) }));
} finally {
  setChangingWorkspace(false);
}

Consider also wrapping browseWorkspace for consistency.

Verification

  1. Run pnpm check — must pass.
  2. Manual: simulate IPC failure during workspace change — button must return to idle state.

Context

  • WG: UI & Design System
  • Priority: Low (good first issue)
  • Estimated effort: 10-15 minutes

Contributor guide