Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Problem

When the POST_COMPACTION_CONTEXT experiment is enabled, the workspace.list() API call blocks for up to 2 minutes per SSH workspace if SSH hosts are unreachable. This causes the app to hang on "Loading workspaces..." forever.

Root cause: getPostCompactionState() calls fileExists() which calls runtime.stat(), which for SSH runtimes waits on the connection pool with a 2-minute default timeout. The existing catch block only fires after the timeout expires.

Solution

Add a 3-second timeout wrapper around each getPostCompactionState() call in list(). If the timeout expires, the workspace is returned without post-compaction state (matching existing error-case behavior).

This ensures app startup completes quickly even when SSH hosts are unreachable - users can work with local workspaces while SSH workspaces simply lack the post-compaction state indicator until connectivity is restored.

Changes

  • src/node/services/workspaceService.ts: Wrap getPostCompactionState() calls with Promise.race() timeout
  • src/node/services/workspaceService.test.ts: Add test verifying timeout behavior

Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: high

When the POST_COMPACTION_CONTEXT experiment is enabled, workspace listing
would block on SSH connections with a 2-minute timeout per workspace.
This could cause app startup to hang with 'Loading workspaces...' forever
when SSH hosts are unreachable.

Add a 3-second timeout to getPostCompactionState calls during list().
If the timeout expires, the workspace is returned without post-compaction
state (same behavior as when an error occurs). This prevents SSH connection
failures from blocking the UI startup.
@ammario ammario merged commit 0202716 into main Dec 20, 2025
17 of 19 checks passed
@ammario ammario deleted the fix/workspace-list-ssh-timeout branch December 20, 2025 21:12
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.

2 participants