Correct the claim that reattach is local only

Written down as "an ssh session's child dies with its connection, so it
takes the ordinary --resume path". The code never had that branch: `start`
records a pid whatever the transport, and for a remote session the process
the backend owns is the ssh client. Adopting it is right -- the fifo feeds
it, its logs capture the far end, and ssh lives exactly as long as the
remote command, so its liveness is the session's.

The docs claimed less than the code does, which is the safe direction to be
wrong in but still wrong, and it was about to mislead someone: a remote
`claude` has an sshd pipe on stdin under every version of this server,
because the fifo is on the backend's side of the connection. Reading a
remote session's stdin therefore says nothing about which backend started
it, and we were an inch from concluding otherwise.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VETa8afmpWaYezLCqJhDB8
This commit is contained in:
irisandClaude Opus 5 committed 2026-08-29 13:57:12 -04:00
1 parent 4cbd567c35
commit 184b6fc6a6
2 files changed
+18 -5

No files matched your search

+11 -3
View File
@@ -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,