Claude Code chats survive server restarts in a detachable host
A pipelines-claude-host process owns each claude -p CLI and its pipes, spools its stream-json output with offsets and serves a private Unix socket. The server detaches on shutdown and reattaches on start, replaying the spool to rebuild turns, approvals, questions, background tasks and the live model. Explicit close, idle release and CLI exit stop the host; a crashed host falls back to --resume with a notice.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// Command pipelines-claude-host keeps one Claude Code CLI process alive across
|
||||
// Pipelines server restarts. The server starts it; it is not run by hand. See
|
||||
// internal/claudehost and docs/chat-backends.md.
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"git.a-wan.net/alan/pipelines/internal/claudehost"
|
||||
)
|
||||
|
||||
func main() {
|
||||
os.Exit(claudehost.Main(os.Args[1:]))
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"time"
|
||||
|
||||
"git.a-wan.net/alan/pipelines/internal/buildinfo"
|
||||
"git.a-wan.net/alan/pipelines/internal/claude"
|
||||
"git.a-wan.net/alan/pipelines/internal/discovery"
|
||||
"git.a-wan.net/alan/pipelines/internal/opencode"
|
||||
"git.a-wan.net/alan/pipelines/internal/paths"
|
||||
@@ -131,6 +132,9 @@ func main() {
|
||||
options.OpenCodeStatus = openCodeStatus
|
||||
// One manager routes each chat to its owning harness. OpenCode remains the
|
||||
// default; Codex is attached when its app-server control socket is present.
|
||||
// Claude Code chats run in detachable hosts scoped to this database, so a
|
||||
// restart does not end them (internal/claudehost).
|
||||
claude.ConfigureHosts(claude.DefaultHostDir(*db))
|
||||
chats := server.NewChatManager(ctx, options.Chat, store)
|
||||
if len(chats.Backends()) > 0 {
|
||||
options.Chat = chats
|
||||
|
||||
Reference in New Issue
Block a user