# SSH readiness over a 1000 ms round-trip link

AI-assisted; verified with the tests and tools listed above.

## Environment

Linux x64; actual Electron desktop packages built separately at base [f03db4fbef](https://github.com/pingdotgg/t3code/commit/f03db4fbef59c42113e37c32897bf4d25d31cb2b) and head [04ab91311c](https://github.com/pingdotgg/t3code/commit/04ab91311c780c307f2567c22697390a71a2b5cc). Light theme, 1100 × 780 window, Xvfb. Fresh isolated desktop homes, onboarding completed with all project imports unchecked; no project or conversation data. Published t3 0.1.9 Linux x64 remote runtime, preinstalled with its install-complete marker to remove downloading as a variable. No real agent turns.

A dedicated sshd listens on 10.77.0.2:2222 in a network namespace. A veth pair links it to 10.77.0.1 on the host. `tc netem delay 500ms` on each veth egress adds 1000 ms RTT. A separate UTS namespace names the synthetic remote host `slow-link`. The throwaway SSH user is `t3latency7733`; an ephemeral key authenticates via a PATH wrapper adding `ssh -F <scratch>/ssh-config`. All SSH traffic uses the real system OpenSSH client.

## Same interaction, both sides

1. Start the built desktop package on Xvfb with --no-sandbox --disable-gpu and an isolated T3CODE_HOME, XDG_CONFIG_HOME, and T3CODE_DEV_SEED=0. VITE_DEV_SERVER_URL points to that checkout's Vite renderer. Start the package directory (with package.json), so app version is 0.1.9 rather than Electron's version.
2. Open Settings → Environments → Add environment → SSH.
3. Enter slow-link, username t3latency7733, port 2222; click Add environment.
4. Wait for the readiness error or for the saved SSH environment row to settle at Connected (the earlier success toast is insufficient). Record the entire real-time interaction. For the final still, require two renderer screenshots 500 ms apart to be identical.
5. Stop the managed remote server and remove only this synthetic user's userdata and ssh-launch state between runs, preserving the same preinstalled runtime and network conditions.

The accompanying `prove.cjs` drives these controls over Electron's debugging endpoint and records the real Xvfb window with ffmpeg. It receives the checkout path, debugging port, backend child PID (for DISPLAY/XAUTHORITY), output root, and side as arguments. Every run creates a timestamped output directory. `setup-host.sh <scratch> <archive.tar.gz>` creates the namespace, veth pair, throwaway SSH account/config, synthetic UTS hostname, and preinstalled runtime. The network commands are also listed below for inspection.

## Network setup

```sh
sudo ip netns add proof7733
sudo ip link add proof7733h type veth peer name proof7733n
sudo ip link set proof7733n netns proof7733
sudo ip addr add 10.77.0.1/24 dev proof7733h
sudo ip link set proof7733h up
sudo ip netns exec proof7733 ip addr add 10.77.0.2/24 dev proof7733n
sudo ip netns exec proof7733 ip link set proof7733n up
sudo ip netns exec proof7733 ip link set lo up
sudo tc qdisc add dev proof7733h root netem delay 500ms
sudo ip netns exec proof7733 tc qdisc add dev proof7733n root netem delay 500ms
```

Run sshd under `unshare --uts` with `hostname slow-link` before executing `ip netns exec proof7733 /usr/sbin/sshd`. This hides the real host name; it does not change network latency. Download the published archive from the repository's v0.1.9 release and extract it with --strip-components=1 to the synthetic user's .t3/runtime/versions/0.1.9, then write `0.1.9` to .install-complete and make that directory owned by the synthetic user.

The runtime is the [published 0.1.9 Linux x64 archive](https://github.com/pingdotgg/t3code/releases/download/v0.1.9/t3-0.1.9-linux-x64.tar.gz).
