fix: add keepalive to fly ssh + stop suppressing install output (#1641)

Two fixes for "session forcibly closed" during openclaw install:

1. The openclaw install command piped all output to /dev/null, so
   flyctl saw zero bytes flowing and killed the session. Removed
   the >/dev/null 2>&1 redirect.

2. Added a background keepalive to runServer that prints a dot to
   stderr every 10s. This prevents flyctl from tearing down silent
   SSH sessions even if the command itself produces no output for
   a while.

Co-authored-by: lab <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
A 2026-02-21 16:01:47 -08:00 committed by GitHub
parent 09d9f597ac
commit a2dfddec3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -630,7 +630,12 @@ export async function runServer(
const fullCmd = `export PATH="$HOME/.local/bin:$HOME/.bun/bin:$PATH" && ${cmd}`;
const flyCmd = getCmd()!;
const escapedCmd = fullCmd.replace(/'/g, "'\\''");
// Wrap command with a background keepalive that prints a dot to stderr every
// 10s. Without this, flyctl tears down silent SSH sessions ("session forcibly
// closed") when no data flows for too long (e.g. during bun install).
const wrappedCmd = `(while true; do sleep 10; printf '.' >&2; done) & _ka=$!; (${fullCmd}); _rc=$?; kill $_ka 2>/dev/null; wait $_ka 2>/dev/null; exit $_rc`;
const escapedCmd = wrappedCmd.replace(/'/g, "'\\''");
// Use fly ssh console (WireGuard) instead of fly machine exec (HTTP) to avoid
// 408 deadline_exceeded on long-running commands.
const args = [flyCmd, "ssh", "console", "-a", flyAppName, "-C", `bash -c '${escapedCmd}'`];