Merge main; use the shared chatShutdownDetacher for OpenCode and Codex
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.
This commit is contained in:
@@ -13,23 +13,20 @@ import (
|
||||
// Chat sessions survive a Pipelines restart. Only an operator action (closing
|
||||
// the chat, or Stop on its turn) stops one.
|
||||
//
|
||||
// Per-backend contract. A chat backend whose sessions can outlive the server
|
||||
// process implements chatSessionDetacher. On shutdown the server calls
|
||||
// DetachSessions instead of Close: the backend releases its own connection or
|
||||
// process handles but must not interrupt, abort or kill any session, turn,
|
||||
// Per-backend contract (chatShutdownDetacher and chatSessionReleaser in
|
||||
// chat_manager.go). On shutdown chatManager.Close calls Detach on a backend
|
||||
// that implements it instead of Close: the backend releases its own connection
|
||||
// or process handles but must not interrupt, abort or kill any session, turn,
|
||||
// question or background task. On the next start the server reattaches through
|
||||
// the ordinary broker surface: chatTurnProber.ProbeTurn (is the turn still
|
||||
// running?), Stream (re-subscribe), Permissions/Forms (pending questions and
|
||||
// approvals), Shells (background tasks) and Messages (read back a turn that
|
||||
// ended while the server was down). A backend without DetachSessions is closed
|
||||
// as before, and its sessions end with the server.
|
||||
// ended while the server was down). chat_close calls ReleaseSession on a
|
||||
// backend that keeps an agent alive until released. A backend without Detach
|
||||
// is closed as before, and its sessions end with the server.
|
||||
//
|
||||
// OpenCode (an attached or detached owned service) and Codex (its App Server)
|
||||
// implement it; a Claude Code host that keeps its CLI processes alive can
|
||||
// implement the same method.
|
||||
type chatSessionDetacher interface {
|
||||
DetachSessions()
|
||||
}
|
||||
// OpenCode (an attached or detached owned service), Codex (its App Server) and
|
||||
// Claude Code (its detachable hosts) implement Detach.
|
||||
|
||||
// chatLiveStore records, on shutdown, the chats left live on their harness so
|
||||
// the next start reattaches exactly those; *pipeline.Store implements it.
|
||||
|
||||
Reference in New Issue
Block a user