Commit 60a2570
authored
🤖 perf: shard OpenSSH exec paths and simplify SSH project sync (#3125)
## Summary
This keeps the SSH scaling wins that matter in practice — sharded
OpenSSH exec paths, serialized same-project sync/import work, hashed
remote project layout, and persisted SSH workspace roots where they
still match a known checkout shape — while deleting the explicit
master-pool/coordinator machinery and replacing most mock-heavy runtime
unit suites with higher-level SSH integration coverage.
## Background
The original branch tackled real SSH bottlenecks: one implicit control
socket per host, duplicate same-project bundle imports, and
basename-derived remote roots that could collide. But the first
implementation grew into an app-managed OpenSSH master scheduler with a
large amount of lifecycle, compatibility, and mock-test surface area.
This revision deliberately simplifies the design so the branch still
improves SSH scalability without carrying most of that maintenance
burden.
## Implementation
- shard short-lived OpenSSH exec/file traffic across a small
deterministic set of `ControlPath`s via `ControlMaster=auto`, keep
`sshConnectionPool` as the single bootstrap/backoff layer, re-check
requested shard readiness after waiting on another inflight probe, and
cap any follow-up shard probe to the remaining acquire budget
- simplify `SSHRuntime` to one hashed remote project layout, one
serialized per-project sync path, one current-snapshot marker, and
ref-manifest validation before snapshot reuse
- keep bundle imports in `refs/mux-bundle/*` and UUID bundle temp paths,
but remove the explicit `openSshMasterPool`, `projectSyncCoordinator`,
remote branch-metadata persistence, and hot-path legacy layout
auto-detection layers
- preserve persisted SSH workspace roots only when config still points
at a known canonical or legacy checkout shape, including sibling
multi-project path hints for repo operations and resolving an upgraded
worktree's actual common git dir before rename/delete worktree commands
- replace the runtime-internal unit suites with focused Docker-backed
SSH integration coverage for concurrent exec bursts, rename/delete
lifecycle, snapshot recovery, and checked-out branch collision cases,
plus targeted `sshConnectionPool` and legacy-worktree regressions
## Validation
- `make typecheck`
- `make static-check`
- `bun test ./src/node/runtime/runtimeHelpers.test.ts`
- `bun test ./src/node/runtime/sshConnectionPool.test.ts`
- `bun test src/node/services/workspaceProjectRepos.test.ts
src/node/services/workspaceService.test.ts
src/node/services/workspaceService.multiProject.test.ts`
- `TEST_INTEGRATION=1 bun x jest tests/runtime/runtime.test.ts
--runInBand --testNamePattern='SSHRuntime'`
- `TEST_INTEGRATION=1 bun x jest tests/runtime/runtime.test.ts
--runInBand --testNamePattern='legacy base repo for upgraded SSH
worktrees'`
## Risks
Moderate. The simplified transport no longer has the same theoretical
ceiling as the previous explicit master-pool design, but it still
improves on the original baseline by removing the single implicit
host-wide control path from short-lived SSH execs. The main
compatibility edge is that SSH workspaces rooted outside the known
canonical or legacy checkout shapes now fall back to the canonical
hashed layout and may need re-init instead of transparent path
inference.
## Pains
The original explicit-pool direction accumulated a lot of policy and
mock-test code. The cleanup work here was mostly about deleting that
surface area without giving back the core scaling fixes, which in turn
meant shifting confidence into the real Docker-backed SSH integration
harness.
---
_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` •
Cost: `$269.00`_
<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=269.00
-->1 parent 9331413 commit 60a2570
File tree
27 files changed
+1881
-1501
lines changed- src/node
- runtime
- transports
- services
- utils
- tests
- e2e/utils
- runtime
27 files changed
+1881
-1501
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
357 | 360 | | |
358 | 361 | | |
359 | 362 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
48 | | - | |
49 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | | - | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
66 | | - | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | 90 | | |
97 | 91 | | |
98 | 92 | | |
| |||
138 | 132 | | |
139 | 133 | | |
140 | 134 | | |
141 | | - | |
142 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
143 | 142 | | |
144 | 143 | | |
145 | 144 | | |
| |||
163 | 162 | | |
164 | 163 | | |
165 | 164 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
173 | 174 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 175 | + | |
178 | 176 | | |
179 | 177 | | |
180 | 178 | | |
181 | 179 | | |
182 | 180 | | |
| 181 | + | |
183 | 182 | | |
184 | 183 | | |
185 | 184 | | |
| |||
226 | 225 | | |
227 | 226 | | |
228 | 227 | | |
229 | | - | |
230 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
231 | 232 | | |
232 | 233 | | |
233 | 234 | | |
| |||
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
248 | | - | |
| 249 | + | |
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
| |||
0 commit comments