Merge: Claude Code chats survive server restarts via a detachable host

This commit is contained in:
2026-11-04 16:15:06 +00:00
21 changed files with 2400 additions and 40 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ def package(output, version, target):
if system not in ("darwin", "linux") or arch not in ("arm64", "amd64"):
raise ValueError("Supported: source, darwin-arm64/amd64, linux-arm64/amd64")
env = dict(os.environ, GOOS=system, GOARCH=arch, CGO_ENABLED="0")
for command, binary in (("pipelines-server", "pipelines-server"), ("pipelines-tui", "pipelines-tui"), ("pipelines", "pipelines")):
for command, binary in (("pipelines-server", "pipelines-server"), ("pipelines-tui", "pipelines-tui"), ("pipelines", "pipelines"), ("pipelines-claude-host", "pipelines-claude-host")):
subprocess.run(["go", "build", "-trimpath", "-o", str(binaries / binary), "./cmd/" + command],
cwd=ROOT, env=env, check=True)
(binaries / "platform.json").write_text(json.dumps({"os": "Darwin" if system == "darwin" else "Linux", "arch": "arm64" if arch == "arm64" and system == "darwin" else "aarch64" if arch == "arm64" else "x86_64"}))
+7 -1
View File
@@ -149,6 +149,10 @@ class Setup:
content = (f"# {SERVICE_MARKER}\n[Unit]\nDescription=Pipelines native services\n"
"\n[Service]\nType=simple\nExecStart=" + " ".join(map(quote, command))
+ "\nRestart=on-failure\nRestartSec=5\nTimeoutStopSec=90\nUMask=0077\n"
# The supervisor stops its own children. Only it is
# signalled, so a Claude Code chat host (its own
# session) outlives a restart as it does under launchd.
"KillMode=process\n"
"\n[Install]\nWantedBy=default.target\n").encode()
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
self._write_atomic(path, content, 0o600)
@@ -444,7 +448,9 @@ class Setup:
# --- build and skill -------------------------------------------------
COMMANDS = ("pipelines-server", "pipelines")
# pipelines-claude-host keeps Claude Code chats alive across server
# restarts; the server finds it next to its own executable.
COMMANDS = ("pipelines-server", "pipelines", "pipelines-claude-host")
def build(self, prefix):
"""Builds the server and CLI into bin/.next; install_binaries moves
+3 -2
View File
@@ -305,7 +305,7 @@ class SetupNativeTests(unittest.TestCase):
with self.assertRaisesRegex(ValueError, "Node.js 18"):
installer.configure_web(Path(directory) / "prefix", setup_native.arguments([]))
def test_build_installs_only_server_and_cli_with_trimpath(self):
def test_build_installs_only_server_cli_and_claude_host_with_trimpath(self):
with tempfile.TemporaryDirectory() as directory:
recorder = Recorder()
installer = self.installer(directory, recorder)
@@ -313,11 +313,12 @@ class SetupNativeTests(unittest.TestCase):
installer.prepare_layout(prefix)
installer.build(prefix)
builds = [call for call in recorder.calls if call[:2] == ["go", "build"]]
self.assertEqual(len(builds), 2)
self.assertEqual(len(builds), 3)
for call in builds:
self.assertIn("-trimpath", call)
self.assertTrue(any(call[-1] == "./cmd/pipelines-server" for call in builds))
self.assertTrue(any(call[-1] == "./cmd/pipelines" for call in builds))
self.assertTrue(any(call[-1] == "./cmd/pipelines-claude-host" for call in builds))
self.assertFalse(any("pipelines-tui" in part for call in recorder.calls for part in call))
def test_layout_creates_private_prefix_and_copies_manage(self):