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

+7 -2
View File
@@ -281,8 +281,13 @@ day:
- **`--resume` only ever runs when nothing is running.** That check is the - **`--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 fix for the incident below, and the reason there is one entry point
(`ClaudeDriver::launch`) rather than a spawn and an attach. (`ClaudeDriver::launch`) rather than a spawn and an attach.
- Local only: an ssh session's child dies with its connection, so it takes - Remote sessions are adopted too. The pid recorded for one is the **`ssh`
the ordinary `--resume` path. 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**, 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 because the two disagree in the way that matters: these transcripts embed
+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 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 session file duplicate the conversation into it and bill the second for
re-reading all of it. re-reading all of it.
- **Local only.** An ssh session's child sits behind a connection that dies - **Remote sessions are adopted too, and the recorded pid is the `ssh`
with the server, so there is nothing to adopt; nothing is recorded for one client's.** This was written down as "local only" and that was wrong about
and it takes the ordinary `--resume` path. 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 `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, going away and means to come back) and `stop` (the session is being deleted,