fix(run): refuse a run with ETMUXMISSING when the host has no tmux

Starting a run on a machine without tmux surfaced `spawnSync tmux ENOENT`
as a 400 — blaming the request for a missing host package, naming no fix,
and reaching the user as a raw errno in the console pane.

The guard goes in spawnRun, which both spawn paths (POST /api/run and
POST /api/lanes/:id/start) already route through, so one check covers
them; the message carries the install command. Both routes map the code to
503: the request was fine, the dependency is not installed. The client
already renders `error.message` from the body verbatim, so no UI change.

Also: README's node advice said "stay on 20/22/24"; 1712 server + 488
client tests are green on v26.8.1, so only 25 is actually the bad one.
This commit is contained in:
2026-09-11 15:32:24 +07:00
parent d4b949a6f4
commit 27313d4413
8 changed files with 77 additions and 6 deletions
+15
View File
@@ -181,6 +181,21 @@ function spawnRun(args) {
throw makeErr("EBADSESSION", "resumeSessionId is not a valid session id");
}
// A run IS a tmux session, so an absent binary is a precondition failure, not
// a spawn failure. Without this the caller gets `spawnSync tmux ENOENT` from
// three directories down — a message that names no fix — and the route maps
// it to 400, blaming the request for the host's missing package. Checked here
// rather than in each route because both spawn paths (POST /api/run and
// POST /api/lanes/:id/start) come through this function.
if (!tmux.isTmuxAvailable()) {
throw makeErr(
"ETMUXMISSING",
"tmux is not installed, and every run the dashboard starts is a tmux session. " +
"Install it (sudo apt install tmux / brew install tmux; on Windows run AgentHub under WSL2), " +
"then restart the dashboard. Everything else keeps working without it."
);
}
const id = runIdForLane(laneId);
const startedAt = Date.now();
const argv = buildArgv({