# #11287 runtime transcript: desktop SSH reconnects while the remote T3 server is stalled

Setup (synthetic, throwaway): Linux VM, dev desktop app (`vp run dev:desktop`, `T3CODE_DEV_SEED=0`) under
`headless-desktop`, SSH environment added through Settings > Environments > Add environment > SSH,
target `t3remote@127.0.0.1:2222` (private sshd, `LogLevel VERBOSE`, a throwaway user with its own HOME,
remote server = the same checkout's `apps/server/src/bin.ts`). After the environment connected, the
remote T3 server was stalled with `kill -STOP <pid>` for 4-5 minutes (sshd and the SSH tunnel stay up;
the server stops answering HTTP), then resumed with `kill -CONT`.
Sources: sshd log (accepts timestamped as they arrive) and the desktop trace
(`.t3/userdata/logs/desktop.trace.ndjson`), times relative to the SIGSTOP.

## Before: main 5d91ab1117

sshd (one session per launch, each starting the second the previous one closes):
```
05:01:15 SIGSTOP
05:01:31 Disconnected (healthy tunnel torn down) / Accepted port 53032
05:02:32 Disconnected port 53032 / Accepted port 49452
05:03:33 Disconnected port 49452 / 05:03:34 Accepted port 36524
05:04:35 Disconnected port 36524 / Accepted port 49974
05:05:36 Disconnected port 49974 / Accepted port 41666
```
desktop trace: five `ensureSshEnvironment` IPC calls start within 99 s and queue on the per-target lock;
each then runs its own SSH launch back to back:
```
desktop.ipc.sshEnvironment.ensureEnvironment  start +0.0s   end +63.2s   Failure
desktop.ipc.sshEnvironment.ensureEnvironment  start +18.5s  end +124.4s  Failure   (queued)
desktop.ipc.sshEnvironment.ensureEnvironment  start +40.8s  end +185.6s  Failure   (queued)
desktop.ipc.sshEnvironment.ensureEnvironment  start +66.0s  end +246.7s  Failure   (queued)
desktop.ipc.sshEnvironment.ensureEnvironment  start +98.3s  end +283.2s  Failure   (queued)
ssh/tunnel.launchOrReuseRemoteServer          +2.0s→+63.2s, +63.2s→+124.4s, +124.4s→+185.6s, +185.6s→+246.7s
```
(relative to the first IPC call; ensureEnvironment durations grow 63 s → 105 s → 144 s.)

## After: fix 52a8c03fde

sshd:
```
05:31:30 SIGSTOP
05:31:52 Disconnected (tunnel torn down) / Accepted port 47006
05:32:53 Disconnected port 47006
05:32:57 Accepted port 33022
05:33:58 Disconnected port 33022
05:34:49 Accepted port 54386
05:35:51 Disconnected port 54386
05:36:00 SIGCONT
```
desktop trace: one IPC call at a time; interrupted retries adopt the call still running, and the
client's backoff separates attempts:
```
desktop.ipc.sshEnvironment.ensureEnvironment  start +19.9s   end +83.3s   Failure
desktop.ipc.sshEnvironment.ensureEnvironment  start +87.3s   end +148.5s  Failure
desktop.ipc.sshEnvironment.ensureEnvironment  start +199.4s  end +260.6s  Failure
```
After SIGCONT the environment reconnects (launch + tunnel, 2 sessions) and stays connected.

Other variants run on main: healthy host idle 3.5 min after adding: 3 accepts total (launch, tunnel,
pairing), no loop. Port 2222 rejected with an iptables tcp-reset (UFW-style) and the server stopped:
attempts fail in ~0.1 s, one attempt in 3 min, no queue builds up.
