[codex] Fix workspace switch crash#131
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
flashtype-website | 03e849d | Commit Preview URL Branch Preview URL |
Jun 17 2026, 06:35 PM |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03e849d1d1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| registerAppIpc(); | ||
| registerWorkspaceIpc((event) => BrowserWindow.fromWebContents(event.sender)); | ||
| registerWorkspaceIpc((event) => BrowserWindow.fromWebContents(event.sender), { | ||
| beforeChange: () => closeLixSession({ ignoreOpenError: true }), |
There was a problem hiding this comment.
Don't ignore old-session close failures
In the workspace-switch path this passes ignoreOpenError into closeLixSession, but closeCurrentLix applies that flag to the whole try, including await lix.close(). If the previous workspace opened successfully but its native close/flush fails, the switch still advances to the new workspace and clears lixPromise, leaving the old session unclosed—the stale-handle state this change is meant to avoid. Please only ignore rejection from the old open promise, not failures from closing an already-open session.
Useful? React with 👍 / 👎.
Summary
Fixes workspace switching so Flashtype closes the current Lix session before adopting the next workspace.
The crash/stale-state path came from updating the main-process workspace descriptor before tearing down the old Lix handle. That could leave the window showing the new workspace while data was still served from the previous one, especially when switching into an empty folder.
Changes
workspace.opencalls cannot race.Validation
pnpm exec oxlint --tsconfig ./tsconfig.json --format stylish electron/main.mjs electron/ipc-lix.mjs electron/lix.mjs electron/workspace.mjs e2e/workspace-switch.spec.tspnpm run typecheckpnpm exec playwright test e2e/workspace-switch.spec.tsnode scripts/validate-changes.mjsNote
Medium Risk
Touches main-process workspace and Lix lifecycle ordering; behavior change on every folder switch, though scoped and covered by a new e2e test.
Overview
Fixes crashes and stale UI when switching workspaces (especially into an empty folder) by tearing down the current Lix session before the main process adopts the next workspace path.
Workspace opens are serialized via a queue so overlapping
workspace.opencalls cannot race.registerWorkspaceIpcnow accepts abeforeChangehook; startup wires it tocloseLixSession({ ignoreOpenError: true })so a failed old Lix open does not block switching. Lix teardown is centralized incloseLixSession(IPC handles, transactions/observers, thencloseLixwith optionalignoreOpenError).Adds an Electron e2e regression (populated folder → empty folder) and a patch changenote.
Reviewed by Cursor Bugbot for commit 03e849d. Bugbot is set up for automated code reviews on this repo. Configure here.