Stop the replaced session on /new for every harness
/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>
This commit is contained in:
@@ -231,11 +231,15 @@ and with the same title. OpenCode makes a new `ses_` session, Codex a new thread
|
||||
and Claude Code a new session UUID. The server then re-keys the
|
||||
`operator_sessions` row in one transaction. The new row keeps the title,
|
||||
directory, tag, backend, colour, star, creation time, model override and mode.
|
||||
The old row is not deleted: it records `replaced_by`, is no longer listed, and
|
||||
its native session can still be resumed in a terminal. Before the row is moved,
|
||||
the server releases the old native runtime; this stops active/background work
|
||||
without deleting the native transcript. If release fails, `/new` reports an
|
||||
error and leaves the registry row on the old session.
|
||||
The old row is not deleted: it records `replaced_by` and is no longer listed.
|
||||
Before the row is moved, the server releases the old native runtime, the same
|
||||
release chat close uses, so `/new` never leaves the replaced session running:
|
||||
Claude Code's host and CLI exit (including a registered host this server is not
|
||||
attached to), a Codex thread's turn is interrupted and the thread is
|
||||
unsubscribed so the App Server unloads it, and OpenCode's turn and running
|
||||
shells are stopped (the shared OpenCode service itself has no per-session
|
||||
process). The native transcript is kept on disk. If release fails, `/new`
|
||||
reports an error and leaves the registry row on the old session.
|
||||
|
||||
The row is re-keyed rather than mapped from a stable id because every other
|
||||
layer is keyed by the native id: rooms, queues, transcripts, shells, exports and
|
||||
|
||||
Reference in New Issue
Block a user