Commit 0202716
authored
🤖 fix: add timeout to workspace list post-compaction state fetching (#1250)
## 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`_1 parent ca2367a commit 0202716
File tree
2 files changed
+95
-4
lines changed- src/node/services
2 files changed
+95
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
747 | 747 | | |
748 | 748 | | |
749 | 749 | | |
750 | | - | |
| 750 | + | |
| 751 | + | |
751 | 752 | | |
752 | 753 | | |
753 | 754 | | |
754 | | - | |
755 | | - | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
756 | 762 | | |
757 | 763 | | |
758 | 764 | | |
| |||
0 commit comments