Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

docs: correct comments and harness README that lagged the design

parsa222d00324518022
diff --git a/src/main/remote-ssh/ssh-agent.ts b/src/main/remote-ssh/ssh-agent.ts
index a472f4146..8d38bc032 100644
--- a/src/main/remote-ssh/ssh-agent.ts
+++ b/src/main/remote-ssh/ssh-agent.ts
@@ -21,7 +21,8 @@
// - A credential that lives ONLY in an agent (1Password, Secretive, a smartcard) has no key file
// to unlock, so overriding the socket would lock those users out. Most are unaffected because
// `IdentityAgent` in ~/.ssh/config overrides `SSH_AUTH_SOCK` and is the documented setup for
-// them; ssh-project.ts covers the rest with a one-shot retry on the ambient agent.
+// them; ssh-project.ts surfaces an error hint naming IdentityAgent for the rest (a hint, not
+// a retry - see connectOnce's failure tail for why retrying on the ambient agent is wrong).
//
// The agent runs in the FOREGROUND (`-D`) as a direct child, so `kill()` really ends it (the
// default double-forks away and would survive us), and with a default identity lifetime (`-t`)
diff --git a/src/main/remote-ssh/ssh-askpass.ts b/src/main/remote-ssh/ssh-askpass.ts
index f6b4a3b36..7e588fb4f 100644
--- a/src/main/remote-ssh/ssh-askpass.ts
+++ b/src/main/remote-ssh/ssh-askpass.ts
@@ -8,7 +8,7 @@
// successful unlock loads the key into an ssh-agent and every later connect (reconnect, watchdog
// respawn) authenticates through it without askpass ever being invoked (measured against a real
// sshd: second connect on a fresh master, zero prompts, even with SSH_ASKPASS removed). The agent
-// supersedes the in-app passphrase cache that used to live in ssh-passphrase-cache.ts: it holds
+// supersedes the in-app passphrase cache an earlier revision of this change used: it holds
// the decrypted key in a purpose-built process instead of a plaintext string in Electron main
// memory. That agent is nodeterm's OWN (ssh-agent.ts), spawned and killed with the app, so the
// unlock lasts one app run rather than until the user's next logout. When no agent is reachable
@@ -321,7 +321,7 @@ export class AskpassServer {
/**
* Did THIS master ever ask for a passphrase? A connect that failed without ever asking had no
* key FILE in play at all, which is what separates "wrong/declined passphrase" from "the only
- * credential lives in an agent we are not pointing at" (see ssh-project's ambient-agent retry).
+ * credential lives in an agent we are not pointing at" (see connectOnce's agent-only hint).
*/
askedBy(masterPid?: number): boolean {
if (masterPid === undefined) return false
diff --git a/src/main/remote-ssh/ssh-project.test.ts b/src/main/remote-ssh/ssh-project.test.ts
index 24b1b3e6d..73a0189e4 100644
--- a/src/main/remote-ssh/ssh-project.test.ts
+++ b/src/main/remote-ssh/ssh-project.test.ts
@@ -1128,9 +1128,9 @@ describe('SshProjectManager', () => {
it('bounds the wait by WALL CLOCK, not attempt count, when each check is slow', async () => {
// Regression: the loop counted attempts, but every attempt is a real `ssh -O check` process
// whose cost is not fixed (up to run()'s 15s execFile timeout against a bound-but-unresponsive
- // master). A 3000-attempt ceiling therefore meant up to ~12 hours of "connecting", not the 5
- // minutes intended. Here each check takes 3s and the master is dead, so the 5s budget must end
- // it in a couple of checks rather than tens.
+ // master). An attempt-count ceiling therefore has no fixed wall-clock meaning: the same count
+ // spans seconds or minutes depending on per-check cost. Here each check takes 3s and the
+ // master is dead, so the 5s budget must end it in a couple of checks rather than tens.
vi.spyOn(fs, 'mkdir').mockResolvedValue(undefined as never)
vi.spyOn(fs, 'stat').mockRejectedValue(Object.assign(new Error('ENOENT'), { code: 'ENOENT' }))
vi.useFakeTimers()
diff --git a/src/main/remote-ssh/ssh-project.ts b/src/main/remote-ssh/ssh-project.ts
index 8ef2a276a..8bd2cb18c 100644
--- a/src/main/remote-ssh/ssh-project.ts
+++ b/src/main/remote-ssh/ssh-project.ts
@@ -117,10 +117,10 @@ const MASTER_WATCHDOG_MS = 45_000
* These are WALL-CLOCK budgets, not attempt counts, and that distinction is load bearing: each
* check is a real `ssh -O check` process whose cost is not fixed. Normally it fails instantly
* (the control socket is not bound until after auth, so the connect is an immediate ENOENT), but
- * against a bound-yet-unresponsive master it blocks until `run`'s own 15s execFile timeout. A
- * 3000-attempt ceiling therefore meant anywhere from 5 minutes to 12 hours depending on how the
- * checks happened to behave, with the user watching "connecting" the whole time. A deadline
- * bounds the wait regardless of per-check cost. */
+ * against a bound-yet-unresponsive master it blocks until `run`'s own 15s execFile timeout. An
+ * attempt-count ceiling (upstream bounded this loop at 50 checks) therefore has no fixed
+ * wall-clock meaning, and no count can both cover a passphrase prompt a human takes minutes to
+ * answer and still fail fast. A deadline bounds the wait regardless of per-check cost. */
const BASE_WAIT_MS = 5_000
/** Budget while the master process is still alive: mid-handshake, or waiting on the askpass
* passphrase prompt a human can take minutes to answer. Mirrors the askpass script's own curl
@@ -664,7 +664,7 @@ export class SshProjectManager {
!cancelled &&
/permission denied/i.test(stderr ?? '') &&
!(this.r.askpassAsked?.(master.pid?.()) ?? false)
- ? ' nodeterm authenticates through its own ssh-agent, so a key held only in your system agent is not offered — set IdentityAgent in ~/.ssh/config, or give this server an identity file.'
+ ? ' nodeterm authenticates through its own ssh-agent, so a key held only in your system agent is not offered. Set IdentityAgent in ~/.ssh/config, or give this server an identity file.'
: ''
const message = cancelled
? 'SSH connection cancelled: this key needs its passphrase.'
diff --git a/test/ssh-docker/README.md b/test/ssh-docker/README.md
index 2f9746dfb..bc1ae101e 100644
--- a/test/ssh-docker/README.md
+++ b/test/ssh-docker/README.md
@@ -66,12 +66,15 @@ docker run --rm -it --network nt-ssh-net \
Swap `passuser` for `keyuser` (unencrypted key) or drop `-i` and use `pwuser` (password
`pwpass123`) to exercise the other two accounts.
-## Empirical SSH_ASKPASS probe (Q1-Q5)
-
-`matrix.sh` drives a fake `SSH_ASKPASS` helper against this container to answer the specific
-OpenSSH behaviors `ssh-askpass.ts` / `control-master.ts` assume (retry prompts are byte-identical,
-`$PPID` is the master pid, an empty answer abandons the key, and so on) - run it and read the
-labeled output for the raw evidence.
+## What pins the measured behaviors
+
+`matrix.sh` measures the connect/ask matrix (the before/after prompt counts and the no-agent
+degradation) with a fake `SSH_ASKPASS` helper. The finer OpenSSH behaviors the code depends on
+are pinned by `askpass-e2e.test.ts` against the real ssh binary: `$PPID` is the exact master pid
+(cancel attribution), an empty answer abandons the key, and the unlocked key lands only in the
+app's own agent, never the ambient one. One behavior is read from OpenSSH's source rather than
+measured here: a retry re-invokes askpass with a byte-identical prompt (readpass.c), which is why
+retries are detected by (key, pid) instead of prompt text.
## Layout