Skip to content

Conversation

@kylecarbs
Copy link
Member

Problem

When using force delete in web/server mode, an unhandled promise rejection occurs, causing the error to be logged but not properly handled in the UI.

Root Cause: The browser API client's invokeIPC function throws errors for string error messages, while Electron's ipcRenderer.invoke() returns error objects. This inconsistency meant that force delete errors in web mode were thrown as exceptions instead of being returned as { success: false, error: '...' }.

Solution

  1. Fixed browser API error handling: Modified src/browser/api.ts to return error objects instead of throwing, matching Electron's behavior
  2. Added defensive error handling: Wrapped removeWorkspace and renameWorkspace in try-catch blocks for extra safety against network/parsing errors
  3. Added comprehensive tests: Created src/browser/api.test.ts to verify error handling behavior and prevent regressions

Testing

  • Added unit tests demonstrating the fix
  • Verified type checking passes
  • Confirmed existing tests still pass (3 pre-existing failures unrelated to this change)

Generated with cmux

- Browser API was throwing on string errors while Electron returns error objects
- This caused unhandled promise rejections when force delete failed in web mode
- Added try-catch in useWorkspaceManagement for defensive error handling
- Added comprehensive tests for browser API error handling behavior
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ 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".

… .catch()

The browser API now returns error objects matching Electron's behavior.
Updated the only caller using .catch() to properly check result.success.
@kylecarbs kylecarbs added this pull request to the merge queue Oct 23, 2025
@kylecarbs kylecarbs removed this pull request from the merge queue due to a manual request Oct 23, 2025
@kylecarbs kylecarbs merged commit 3106a56 into main Oct 23, 2025
13 checks passed
@kylecarbs kylecarbs deleted the force-delete-web branch October 23, 2025 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant