diff options
| author | Adam Malczewski <[email protected]> | 2026-06-25 22:15:04 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-25 22:15:04 +0900 |
| commit | 9b91d1bca83e7599fb7d7de6038cedf186e61764 (patch) | |
| tree | 7a6c2325e618eaf89743ef89734e7b5102744668 /packages/kernel/src/runtime | |
| parent | 2cc9ddfb590dc60557bba3ed76a6c4639df5f596 (diff) | |
| download | dispatch-9b91d1bca83e7599fb7d7de6038cedf186e61764.tar.gz dispatch-9b91d1bca83e7599fb7d7de6038cedf186e61764.zip | |
fix(ssh): POST /computers/:alias/test hangs after successful SSH connect
The test endpoint's runProbe() waited for the ssh2 stream's 'close' event,
which some SSH servers never emit for short-lived exec channels (the command
'true' exits instantly). This caused the promise to hang forever — the HTTP
response never returned, and the FE's Test spinner spun indefinitely.
Three fixes:
1. runProbe now resolves on the 'exit' event (not 'close') — the command has
finished and the exit code is available. 'close' is kept as a fallback.
Stream data/stderr are drained to prevent buffer deadlocks.
2. runProbe has a 15s timeout safety net — if the exec callback or 'exit'
event never fires (e.g. server requires a pty for exec), the probe
resolves false instead of hanging forever.
3. The entire test() method is wrapped in a 30s Promise.race timeout —
even if pool.acquire() or pool.drop() hangs, the endpoint ALWAYS
responds with { ok, error? }.
The probe is fully non-interactive (no blocking prompts). tsc EXIT 0,
biome clean, 1756 tests pass.
Diffstat (limited to 'packages/kernel/src/runtime')
0 files changed, 0 insertions, 0 deletions
