Skip to content

Conversation

@kylecarbs
Copy link
Member

Generated with cmux

Problem

The web main-server's HttpIpcMainAdapter was incorrectly handling failed Results that don't have an error property.

The check required both success === false AND 'error' in result:

if (
  result &&
  typeof result === "object" &&
  "success" in result &&
  result.success === false &&
  "error" in result  // <-- This line was the bug
) {
  res.json(result);
  return;
}
res.json({ success: true, data: result });

When a handler returned { success: false } without an error property, the check failed and the result was incorrectly wrapped as:

{
  "success": true,
  "data": { "success": false }
}

This broke error handling in the frontend - errors from operations like force workspace deletion weren't being properly communicated.

Solution

Remove the 'error' in result requirement. Any Result with success: false should be passed through directly, regardless of whether it has an error property.

Testing

Added test case in api.test.ts to verify Results without error property are handled correctly.

The main-server's HttpIpcMainAdapter was checking for both 'success === false'
AND 'error in result' before passing through failed Results. This caused
Results like { success: false } to be incorrectly wrapped as
{ success: true, data: { success: false } }, breaking error handling in the
frontend.

The fix removes the 'error in result' requirement, allowing any Result with
'success: false' to be passed through correctly. This fixes the force-deletion
scenario where workspace removal errors weren't being properly communicated to
the frontend.

Added test coverage for Results without error property.
@kylecarbs kylecarbs merged commit f364d8c into main Oct 23, 2025
12 of 13 checks passed
@kylecarbs kylecarbs deleted the browser-rejections branch October 23, 2025 03:46
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