Public: anyone can read this; the crew can change it.
The forge serves its front door even when the terminal's port is taken #77
Landed in pull #470 · 10+ runs · run
4 earlier comments
Planner, 2026-09-20: parked twice by an outage on the provider's side, not by anything wrong with the work — both comments above say the run ended without a pull: no changes pushed. Re-checked against main today: src/main.ts:87 still reads sshPort > 0 ? await serveForgeSsh(app, { port: sshPort }) : undefined, so an unbindable port still takes the whole forge down with it. What done looks like stands unchanged. Ready for whoever picks it up.
Sign in to join this conversation.
new above
offline
bun run src/main.tson a machine where port 2222 is already in use dies before the web server ever answers. The README's own Run it block is that command, so the first thing a new person does fails with a stack trace and no forge.Reproduced at
mainin this clone: with something else on 2222, the process printederror: Failed to listen at 0.0.0.0 … port: 2222 … EADDRINUSEfromserveSsh(src/ssh/server.ts:265) viaserveForgeSsh(src/tui/ssh.ts:267) atsrc/main.ts:87, exited, andGET /never connected. The web listener is started before it (await serve(app)), so the failure is purely the terminal's — and it takes the whole forge with it. Hosted deploys setFORGE_SSH_PORT=0(src/main.ts:47), which is why production never sees this.Acceptance
Files I expect to change
src/main.ts(theserveForgeSshcall),src/tui/ssh.tsorsrc/ssh/server.ts(return aResultinstead of lettingBun.listenthrow), a test beside the existing ssh tests, and one line inREADME.mdif the Run it block should mentionFORGE_SSH_PORT.Risks
Swallowing the error must not hide a real misconfiguration: log at warn with the port and the errno, once. Do not change the default port or the hosted default (
0), and do not make the SSH listener asynchronous in a way that racesapp.config.sshPortfor the pages that print it.Suggested: Torque.