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:
@@ -176,13 +176,13 @@ func (c *Chat) Close() {
|
||||
_ = c.conn.Close(websocket.StatusNormalClosure, "")
|
||||
}
|
||||
|
||||
// DetachSessions is the server-restart shutdown: threads and their turns live
|
||||
// Detach is the server-restart shutdown (chatShutdownDetacher): threads and their turns live
|
||||
// in the Codex App Server, not in this client, so closing the control
|
||||
// connection leaves them running; no turn is interrupted. The next server
|
||||
// process reconnects and reconciles each thread through thread/read. An
|
||||
// approval or question the App Server sent to this connection is bound to it,
|
||||
// so one still pending at shutdown is not answerable after the restart.
|
||||
func (c *Chat) DetachSessions() { c.Close() }
|
||||
func (c *Chat) Detach() { c.Close() }
|
||||
|
||||
func (c *Chat) readLoop() {
|
||||
for {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
// A server restart detaches from the App Server without interrupting the
|
||||
// thread's turn; the next server's fresh connection still sees the turn in
|
||||
// progress, then completed, through the read-only turn list.
|
||||
func TestDetachSessionsLeavesTurnRunningForNextConnection(t *testing.T) {
|
||||
func TestDetachLeavesTurnRunningForNextConnection(t *testing.T) {
|
||||
var completed atomic.Bool
|
||||
var mu sync.Mutex
|
||||
var methods []string
|
||||
@@ -29,7 +29,7 @@ func TestDetachSessionsLeavesTurnRunningForNextConnection(t *testing.T) {
|
||||
if running, err := before.ProbeTurn(context.Background(), fixtureThread); err != nil || !running {
|
||||
t.Fatalf("turn not running before the restart: %v %v", running, err)
|
||||
}
|
||||
before.DetachSessions()
|
||||
before.Detach()
|
||||
after := modelTestChat(t, appServer)
|
||||
if running, err := after.ProbeTurn(context.Background(), fixtureThread); err != nil || !running {
|
||||
t.Fatalf("turn did not survive the restart: %v %v", running, err)
|
||||
|
||||
Reference in New Issue
Block a user