A local-first multi-agent app development platform, built on PenguinHarness
Machines: the hop to a machine answers before the browser gives up
- Date: 2026-10-08
- Type: fix
- Scope:
server
A request this server forwards to a machine (/server/<id>/api/…) no longer waits forever when that
machine is not serving. When the machine's server is not listening, the request fails at once and
says so. When the ssh session has stalled, it fails within 8 s, naming the SOCKS layer. A read the
machine accepts but never answers gets a 504 after 15 s. Before, such requests could hang with no
answer; the browser gave up after its own 20 s and sent them again, and those retries hung as well
until Chromium refused every new request with ERR_INSUFFICIENT_RESOURCES. Ported from upstream
PenguinHarness (branch fix/machine-hop-answers-in-time, commit a2801c8d), which the fork did not
carry.
Details
- Every TCP connection to a machine is a SOCKS CONNECT through its ssh session's
-Dport. When nothing listens on the port on the far side, OpenSSH sends no failure reply: it closes the connection. The dial ignored a close that came before the reply, and its handshake timer stopped with the socket, so the dial never settled. It now fails at once with "the session closed the channel to 127.0.0.1: before answering — nothing is listening there, or the session is going down", and the forwarded request carries that sentence back (server_unreachable, 502). - The SOCKS handshake deadline is 8 s (was 20 s). A stalled session now fails with "the session's SOCKS handshake timed out" before the proxy's own deadline, and well before the browser's 20 s.
- A forwarded
GETorHEADwith no response headers after 15 s (dial included) is answered504 machine_not_answering. The upstream request is dropped, and the machine list records the failure in itsapifact. Writes are not cut: a write may rightly take long, and cutting one would make the browser repeat its effect. - An answer that has started is not affected: once its headers arrive, the body streams with no deadline.
- This fork's forward has one path (the proxy), so the port lands in
machines/proxy.tsandmachines/transport/socks.ts; the upstream relay layer it also touched is not in this tree.