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
🤖 Refactor SSH sync to avoid shell escaping complexity
Replace complex single-pipeline approach with multiple SSH round trips.
Problem:
- Complex shell escaping with nested quoting (4 backslashes, \\\\\$HOME, etc.)
- Hard to reason about what gets expanded when and where
- Tilde paths like ~/cmux/project failed due to escaping bugs
- User reported: "cd: /root/cmux/r2: No such file or directory"
Solution: Multiple SSH round trips (simpler, no escaping issues)
1. **Create bundle**: Pipe locally to remote via ssh (one level of quoting)
2. **Clone**: Use this.exec() with proper tilde expansion
3. **Remove**: Use this.exec() to clean up bundle file
Benefits:
- Zero complex escaping - each step is simple
- this.exec() handles all tilde expansion consistently
- Easier to debug (can run each step independently)
- More resilient error handling (cleanup on failure)
- User said: "It's ok if we have multiple SSH round trips"
Changes:
- syncProjectToRemote: 3 separate steps instead of one complex pipeline
- Use timestamp instead of $$ for bundle naming (simpler)
- Fixed bare '~' expansion in exec() (was only handling ~/...)
- Bundle path: ~/.cmux-bundle-<timestamp>.bundle
All 14 integration tests passing (6 local + 6 SSH + 2 SSH-specific).
Tilde path test verifies ~/workspace/... works correctly.
_Generated with `cmux`_
0 commit comments