You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds `Runtime.resolvePath()` method to expand tildes and normalize paths
at workspace creation, ensuring consistent absolute paths are stored in
config for both local and SSH runtimes.
## Changes
**Runtime Interface:**
- Add `resolvePath(filePath: string): Promise<string>` to Runtime
interface
- Resolves paths to absolute form without checking existence (separation
of concerns)
**LocalRuntime:**
- Expands `~` to home directory using existing `expandTilde()` utility
- Resolves relative paths (e.g., `./foo`) to absolute paths via
`path.resolve()`
- Example: `~/workspace` → `/home/user/workspace`
**SSHRuntime:**
- Uses remote `readlink -m` command to normalize paths without requiring
they exist
- Expands `~` to remote user's home directory
- Includes timeout (5s) to prevent hangs on network issues
- Extract `execSSHCommand()` helper to reduce duplication
- Example: `~/cmux` → `/home/testuser/cmux`
**WORKSPACE_CREATE Handler:**
- Creates temporary runtime to resolve `srcBaseDir` via
`runtime.resolvePath()`
- If resolved path differs, recreates runtime with resolved path
- Stores resolved absolute path in config (not tilde path)
- Works for both local and SSH runtimes
**Integration Tests:**
- Update createWorkspace tests to verify tilde resolution (not
rejection)
- Remove test skipping logic - SSH server is required for SSH tests
- Verify resolved paths are stored in config
## Benefits
- **Consistent paths:** Both `~/workspace` and `/home/user/workspace`
work and store the same resolved path
- **Separation of concerns:** Path resolution separate from existence
checking
- **Better UX:** Users can use familiar tilde notation for both local
and SSH
- **Single source of truth:** Config always contains absolute paths
## Technical Notes
**Why separate resolution from validation:**
- Path resolution is purely syntactic (expanding `~`, normalizing
`./../`)
- Existence checking is semantic (does the path point to something
real?)
- Separating these concerns makes the code more flexible and testable
**Timeout requirement:**
- All SSH operations require timeouts to prevent network hangs
- `execSSHCommand()` now requires explicit timeout parameter
- Added class-level comment documenting this requirement
_Generated with `cmux`_
Copy file name to clipboardExpand all lines: docs/AGENTS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -203,8 +203,10 @@ This project uses **Make** as the primary build orchestrator. See `Makefile` for
203
203
- utils should be either pure functions or easily isolated (e.g. if they operate on the FS they accept
204
204
a path). Testing them should not require complex mocks or setup.
205
205
-**Integration tests:**
206
+
-**⚠️ IMPORTANT: Use `bun x jest` to run tests in the `tests/` folder** - Integration tests use Jest (not bun test), so you must run them with `bun x jest` or `TEST_INTEGRATION=1 bun x jest`
206
207
- Run specific integration test: `TEST_INTEGRATION=1 bun x jest tests/ipcMain/sendMessage.test.ts -t "test name pattern"`
207
208
- Run all integration tests: `TEST_INTEGRATION=1 bun x jest tests` (~35 seconds, runs 40 tests)
209
+
- Unit tests in `src/` use bun test: `bun test src/path/to/file.test.ts`
208
210
-**⚠️ Running `tests/ipcMain` locally takes a very long time.** Prefer running specific test files or use `-t` to filter to specific tests.
209
211
-**Performance**: Tests use `test.concurrent()` to run in parallel within each file
210
212
-**NEVER bypass IPC in integration tests** - Integration tests must use the real IPC communication paths (e.g., `mockIpcRenderer.invoke()`) even when it's harder. Directly accessing services (HistoryService, PartialService, etc.) or manipulating config/state directly bypasses the integration layer and defeats the purpose of the test.
0 commit comments