# Desktop custom-port recovery proof

Run each commit's real Linux Electron app with `T3CODE_DEV_SEED=0`, a separate fresh `XDG_CONFIG_HOME`, and `T3CODE_DESKTOP_REMOTE_DEBUGGING_PORT=9441`, under `headless-desktop vp run dev:desktop`. Install Electron with `node apps/desktop/node_modules/electron/install.js` if necessary. The launcher supplies `--no-sandbox` on this VM. Both captures use a 1100x780 app viewport and the default light theme.

Run a real remote T3 server from the base checkout in a Docker container using the `node:26-slim` image, with its own network namespace. Mount the checkout at `/app` and a fresh synthetic state directory, use `/app/apps/server` as the working directory, and run `node src/bin.ts serve --host 0.0.0.0 --port 19990 --base-dir /state --no-browser`. Pair this environment through Settings > Environments > Add environment. The hexadecimal environment label visible in the captures is the synthetic Docker container hostname. Import no existing projects or history; finish onboarding with no projects selected.

The driver accepts `CHECKOUT`, `OUTPUT_DIR`, `REMOTE_PID` (the container's host PID), and `CDP_PORT`. It uses Playwright over CDP to drive the real Electron renderer and its real desktop bridge. It neither replaces bridge methods nor injects locality state.

1. Stop previous forwards. Install a container-network INPUT rule rejecting TCP packets to port 19990 containing `/api/preview/tunnel`.
2. Reload the renderer while the rule is active, then open Ctrl+K. The firewall counter records exactly one rejected tunnel dial on each commit and the palette initially offers no Forwarded ports command.
3. Remove the rule without reconnecting the main environment connection.
4. Call the real desktop bridge: `sharesLoopback` returns false; `forwardPort(env, 6060)` succeeds with local port 6060. This is the same entry point used by Ctrl-click.
5. Wait five seconds, select Forwarded ports, and type 2020.
6. Base: no matching commands. Head: Forward port 2020 from the remote environment.

Stills were saved only after two screenshots 500 ms apart matched. Recordings consist of repeated unmodified app screenshots; frame durations preserve their capture times. Their start/end delays differ slightly because the base driver initially waited on a nonexistent optional text selector before falling back to the body text; the failure injection and app interaction steps are identical. No user turns or paid model calls were needed.

The Servers list button was not exercised; the proof focuses on the reported command-palette path.
