Unloading the replaced thread is cleanup; a thread the App Server no
longer holds must not block /new or closing the chat.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/new already released the old native session through the chat-close
release path, but two gaps let the replaced session stay alive, and the
client told the operator it could still be resumed in a terminal:
- Claude Code: ReleaseSession only closed a host this server was
attached to. A host registered for the session but not attached (a
failed reattach, or one left by an earlier server) kept running. It is
now asked to close over its socket and killed as a fallback.
- Codex: ReleaseSession only interrupted an active turn. It now also
sends thread/unsubscribe so the App Server unloads the thread; a later
prompt reloads it through the existing "thread not found" resume path.
- The /new notice now says the previous session was stopped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenCode and Codex chats implement Detach (called by chatManager.Close)
instead of a parallel DetachSessions interface. Docs follow the Claude Code
host and the systemd KillMode=process unit. The opt-in live restart check
copies only the stage provider's login row into its scratch OpenCode
database, builds the CLI for skill install and removes its scratch tree.
A stopping server no longer interrupts harness sessions. Runs are canceled
with a shutdown cause, so stage clients leave admitted sessions running and
owned; start-up recovery re-adopts live OpenCode V2 stage sessions (wait,
read back the result, continue the graph), restarts unadmitted visits,
continues runs between stages, and falls back to interrupted with a reason
when the harness is gone. Chats with live work are recorded on shutdown and
reattached on start; turns that ended during the downtime are folded in
from history. The server-spawned V2 chat serve is now a detached owned
service. PIPELINES_SHUTDOWN_SESSIONS=stop restores the old behaviour.