Skip to content

t3code: run the T3 SSH launcher with a separate HOME - #1743

Merged
SpyrosPsarras merged 1 commit into
mainfrom
t3/ssh-launch-separate-home
Oct 9, 2026
Merged

SpyrosPsarras merged 1 commit into
mainfrom
t3/ssh-launch-separate-home

Conversation

@SpyrosPsarras

Copy link
Copy Markdown
Owner

Works around pingdotgg/t3code#5749 and #14115: when the main T3 server is slow to answer, the desktop app's SSH launcher starts a second serve --base-dir ~/.t3 on our live data, and that server moves T3 Connect to port 3774.

Change

  • one/files/ssh-command.sh, set as sshd ForceCommand. Only the exact launcher command sh -l -s -- <16 hex> runs with HOME=~/.t3-ssh-launch (mode 0700, refused if it is a symlink or owned by someone else). That HOME holds a fresh copy of server-runtime.json on every launch and a link to the shared ~/.t3/runtime downloads.
  • Healthy server: reused on 3773 as before. Slow server: the fallback server starts on empty data with no T3 Connect link, and the launcher stops it on the next launch once the main server answers.
  • Interactive ssh t3code, other commands, rsync and the app's pairing, stop and log scripts (sh -s) keep the real HOME.
  • one/files/ssh-command.test.sh, run in CI.

Checks

  • New test: 6 groups pass (isolation, stable HOME, stale runtime file, symlink refusal, HOME/stdin/exit status passthrough, near-miss commands).
  • shellcheck and sync-shared.sh --check pass.
  • Throwaway real sshd with this ForceCommand: two launches share the launch HOME, sh -s keeps the real HOME, true works.

Revert

Revert once an upstream fix that stops a second server on a live state directory is in the pinned T3 nightly. A daily scheduled check watches for that.

Merged before the independent review finished, at Spyros's request. Review findings will land in a follow-up PR.

The T3 desktop app's SSH launcher starts a second server on ~/.t3 when the
main one is slow to answer, and that server moves T3 Connect to its port
(pingdotgg/t3code#5749, #14115). sshd now runs that one launch command with
HOME=~/.t3-ssh-launch, which holds a copy of server-runtime.json and a link to
the shared T3 downloads. A healthy server is reused as before; a fallback
server gets empty data. Every other SSH command keeps the real HOME.
@SpyrosPsarras
SpyrosPsarras merged commit cc17143 into main Oct 9, 2026
4 checks passed
@SpyrosPsarras
SpyrosPsarras deleted the t3/ssh-launch-separate-home branch October 9, 2026 20:03
SpyrosPsarras added a commit that referenced this pull request Oct 9, 2026
Review fixes for #1743 (`one/files/ssh-command.sh`).

- F1: create the real `~/.t3/runtime` before linking it. Without it, a
first launch failed on a dangling link even with a healthy server. The
live pod already has the folder, so #1743 was not affected.
- F4: replace the copied `server-runtime.json` with an atomic rename,
and let two parallel launches create the launch HOME without failing.
- F5: print why a launch HOME is refused (symlink, wrong owner) instead
of exiting silently.
- F2: name the runtime file path once.

Checks: `ssh-command.test.sh` adds a first-launch case with no `~/.t3`,
10 rounds of two parallel launches, and the refusal messages. shellcheck
passes. The ownership case is skipped where the test can't `chown`.
SpyrosPsarras added a commit that referenced this pull request Oct 15, 2026
Upstream T3 fixed the cause: since pingdotgg/t3code#16102 a server locks
its state directory, and a second server on the same data exits with
code 78. The pinned nightly 0.0.46-nightly.20261014.3118 contains it.

This reverts #1743 and #1744, plus the later additions from #1804 and the
ForceCommand line in isolated-sshd.sh, and drops the wrapper from the
homelab README.
SpyrosPsarras added a commit that referenced this pull request Oct 15, 2026
Removes the A3 SSH launch wrapper (`one/files/ssh-command.sh`). Upstream
fixed the problem it worked around.

## Why
- pingdotgg/t3code#14115 was closed as completed on 2026-10-14. The
maintainer wrote "Fixed by merged #16102". #5749 is still open.
- pingdotgg/t3code#16102 (merge
`570542662a3f9f3fb44f88778cb24753072f78aa`, "fix(server): enforce one
database owner and guard update rollback"): before it opens the
database, a server takes an exclusive lock on its state directory
(`userdata/server-owner.sqlite`). A second server on the same directory
exits with code 78 instead of starting.
- `gh api
repos/pingdotgg/t3code/compare/570542662a3f9f3fb44f88778cb24753072f78aa...v0.0.46-nightly.20261014.3118
--jq .status` returns `ahead` (by 66). We pin
`0.0.46-nightly.20261014.3118` in
`2-k3s/13.t3code/env/tools/package.json`, so the pod's server has the
lock.

## Change
- Reverts #1743 and #1744. Also removes what #1804 added to the wrapper,
which was a later extension of the same file.
- Deletes `ssh-command.sh` and `ssh-command.test.sh`, plus their CI line
and both kustomization entries.
- Removes `ForceCommand` from `one/files/sshd.sh` and
`env/files/isolated-sshd.sh`. The isolated runtimes still use the rest
of `isolated-sshd.sh` as their sshd.
- Removes the wrapper from `13.t3code-homelab/README.md`.
- Not touched: the phone's LAN pairing route through
https://t3code.epaflix.com, and `~/.t3-ssh-launch` on the pod. Deleting
that directory is a separate decision.

## Caveat
The SSH launcher's fallback server runs the desktop app's T3 version,
downloaded into `~/.t3/runtime/versions`, not the pod's pinned version.
The lock only protects us if that version contains #16102.
- homePC desktop: `t3code-nightly-bin 0.0.46_nightly.20261014.3118`,
which contains the fix.
- Newest launcher download on the pod: `0.0.46-nightly.20261013.3053`.
It does NOT contain the fix (compare status `behind`).
- Laptop: unreachable, so its desktop version is unverified.

An outdated desktop app can still start a second server on the live
data.

## Checks
- `git grep -n "ssh-command\|t3-ssh-launch\|ForceCommand" -- .
':!docs/superpowers'` returns nothing.
- `bash 2-k3s/13.t3code/one/tools/sync-shared.sh --check` passes.
- The whole "T3 config and placement tests" CI step passes locally.
- `kustomize build` passes for `13.t3code-homelab` and `13.t3code-work`.
`13.t3code/one` needs ksops, so I didn't build it locally.
- Standards and Spec review: both passed with no blocking findings.

Do not merge without Spyros's approval.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant