diff --git a/AGENTS.md b/AGENTS.md index 292a4d4..58f6167 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -281,8 +281,13 @@ day: - **`--resume` only ever runs when nothing is running.** That check is the fix for the incident below, and the reason there is one entry point (`ClaudeDriver::launch`) rather than a spawn and an attach. -- Local only: an ssh session's child dies with its connection, so it takes - the ordinary `--resume` path. +- Remote sessions are adopted too. The pid recorded for one is the **`ssh` + client's**, on this machine — that is the process the backend owns, and it + lives as long as the remote command does. (This said "local only" until + 2026-08-29; the code never had that branch.) Note the far `claude` always + has an sshd pipe on stdin whichever version started it, since the fifo is + on the backend's side — so you cannot tell a backend's version by looking + at a remote session's stdin. The import list reports each session's **size as well as its line count**, because the two disagree in the way that matters: these transcripts embed diff --git a/PLAN.md b/PLAN.md index b600277..3b23e95 100644 --- a/PLAN.md +++ b/PLAN.md @@ -266,9 +266,17 @@ Two consequences worth stating: rule as the import refusal below, and for the same reason: two CLIs on one session file duplicate the conversation into it and bill the second for re-reading all of it. -- **Local only.** An ssh session's child sits behind a connection that dies - with the server, so there is nothing to adopt; nothing is recorded for one - and it takes the ordinary `--resume` path. +- **Remote sessions are adopted too, and the recorded pid is the `ssh` + client's.** This was written down as "local only" and that was wrong about + the code: `start` records a pid whatever the transport, and for a remote + session the process the backend owns *is* the ssh client. Adopting it is + coherent — the fifo still feeds it, its logs still capture the far end's + output, and `ssh` lives exactly as long as the remote command does, so its + liveness is the session's liveness. + The consequence worth knowing: **the remote `claude` always has an sshd + pipe on stdin, under old code and new alike**, because the fifo is on the + backend's side of the connection. So the far process's stdin says nothing + about which version of this server started it. `Driver` therefore has two ways out rather than one: `detach` (the server is going away and means to come back) and `stop` (the session is being deleted,