One harness setup path: pipelines harness setup <claude|codex|opencode|pi>

Checks the CLI on the server's PATH (install command when missing), signs in
with the harness's own login only when needed (--login forces it), keeps the
OpenCode/Pi model pickers, and verifies with the server's check. Works on
native and Docker installs (Docker delegates to the container setup); --host
is a hidden compatibility alias. harness list shows all four harnesses'
installed/signed-in/configured/default status. ./install --opencode|--pi now
point to the command; ./install ends with the next-step hint.
This commit is contained in:
2026-11-02 16:11:04 +00:00
parent 9d1c8bf910
commit 108c29f9eb
23 changed files with 1033 additions and 222 deletions
+5 -2
View File
@@ -308,6 +308,8 @@ exec pipelines provider-check --model "$1" --yes --json --timeout 90s
"Rerun when the registry/npm is reachable; refusing to silently install stale copies.") from None
def reconfigure_harness(self, name, options):
# `pipelines harness setup <name>` on a Docker installation lands here.
# The in-container setup signs in only when needed (or with --login).
# Reuse the setup resolution/verification path without rebuilding or
# restarting services: a stale image needs an explicit ./install upgrade.
releases = self.resolve_releases()
@@ -323,10 +325,10 @@ exec pipelines provider-check --model "$1" --yes --json --timeout 90s
"pi": found.get("pi", releases["pi"]["version"]),
"node": found.get("node", ""),
})
self.compose("exec", "pipelines", "pipelines", "harness", "setup", name, "--login", "--versions", label, *options)
self.compose("exec", "pipelines", "pipelines", "harness", "setup", name, "--versions", label, *options)
def link_host(self, name=None, config=None):
# Shared by fresh setup and --opencode/--pi reconfiguration. The host
# Shared by fresh setup and `pipelines harness setup` reconfiguration. The host
# launcher is linked from the container profile; it is never executed
# from a host harness runtime.
if config is None:
@@ -601,6 +603,7 @@ printf 'header = "Authorization: Bearer %s"\\n' "$(cat "$PIPELINES_NTFY_TOKEN_FI
if shutil.which("go") or shutil.which("pipelines"):
self.link_host()
print("Docker setup complete. Use docker compose ps / logs to manage it; no OS user service was registered.")
print("Next: set up your agent harnesses: pipelines harness setup opencode|pi")
def arguments(argv=None):
+7 -2
View File
@@ -1,5 +1,10 @@
#!/usr/bin/env python3
"""Reconfigure one harness without reinstalling/restarting services or deleting login."""
"""Docker backend of `pipelines harness setup opencode|pi`.
Reconfigures one harness in the Docker installation without reinstalling or
restarting services or deleting login. Run `pipelines harness setup <name>`
instead of calling this directly.
"""
import importlib.util
from pathlib import Path
import subprocess
@@ -19,7 +24,7 @@ setup_docker = module("setup_docker", "setup-docker.py")
def main():
root = Path(__file__).resolve().parents[1]
if len(sys.argv) < 2 or sys.argv[1] not in ("opencode", "pi"):
sys.exit("Usage: setup-harness.py opencode|pi [harness setup options]")
sys.exit("Usage: pipelines harness setup opencode|pi [--login] [--model P/M] [--pipeline-model P/M] [--default]")
name = sys.argv[1]
settings = root / ".env"
docker = settings.is_file() and "PIPELINES_HOST_REPOSITORY=" in settings.read_text()
+5 -2
View File
@@ -103,8 +103,9 @@ class Setup:
opencode = shutil.which("opencode")
if not opencode:
raise ValueError(
"OpenCode was not found on PATH. Install OpenCode yourself (this installer never installs, "
"upgrades or downloads it) and rerun; model selection happens in your existing OpenCode configuration.")
"OpenCode was not found on PATH. It is required: it runs pipeline stages and chat by default. "
"Install it yourself (this installer never installs, upgrades or downloads it): "
"curl -fsSL https://opencode.ai/install | bash -- then rerun ./install.")
pi = shutil.which("pi")
return {"opencode": str(Path(opencode).resolve()), "pi": str(Path(pi).resolve()) if pi else ""}
@@ -928,6 +929,8 @@ class Setup:
else:
print(f"Unauthenticated API bound to {args.bind_address}:{args.port}; use the authenticated web URL.")
app_build.print_web_urls(manifest, lan_host=lan_ip)
print("OpenCode is required (default stage and chat harness) and is set up by ./install.")
print("Next: set up your agent harnesses: pipelines harness setup claude|codex|opencode|pi")
def arguments(argv=None):
+2 -1
View File
@@ -627,7 +627,8 @@ fi
installer.verify_harness_versions = lambda resolved: {"opencode": "2.0.26", "pi": "1.1.0", "node": "22.19.0"}
installer.reconfigure_harness("pi", ["--model", "fixture/model"])
setup_call = next(c for c in calls if "setup" in c)
self.assertIn("--login", setup_call)
# The in-container setup signs in only when needed; --login is opt-in.
self.assertNotIn("--login", setup_call)
self.assertIn("--versions", setup_call)
label = setup_call[setup_call.index("--versions") + 1]
for want in ("OpenCode 2.0.26", "Pi 1.1.0", "Node 22.19.0"):
+8
View File
@@ -69,6 +69,14 @@ class HarnessSetupTests(unittest.TestCase):
with self.assertRaisesRegex(ValueError, "run ./install"):
setup.main()
def test_install_harness_flags_point_to_the_single_setup_command(self):
install = Path(__file__).resolve().parents[1] / "install.sh"
for flag, name in (("--opencode", "opencode"), ("--pi", "pi")):
result = subprocess.run(["sh", str(install), flag], capture_output=True, text=True)
self.assertEqual(result.returncode, 2)
self.assertEqual(result.stdout, "")
self.assertEqual(result.stderr.strip(), f"./install {flag} was removed; run: pipelines harness setup {name}")
if __name__ == "__main__":
unittest.main()
+4 -2
View File
@@ -473,8 +473,10 @@ class SetupNativeTests(unittest.TestCase):
installer.run(setup_native.arguments([]))
self.assertEqual((prefix / "secrets/publisher-token").read_text(), before)
self.assertEqual(manage.load(prefix)["web"]["port"], 8096)
self.assertEqual(output.getvalue().splitlines()[-2:], [
" http://localhost:8096/", " http://192.168.1.20:8096/"])
self.assertEqual(output.getvalue().splitlines()[-4:], [
" http://localhost:8096/", " http://192.168.1.20:8096/",
"OpenCode is required (default stage and chat harness) and is set up by ./install.",
"Next: set up your agent harnesses: pipelines harness setup claude|codex|opencode|pi"])
self.assertFalse(any("token" in call for call in recorder.calls), "reinstall re-created the token")
def test_ntfy_is_built_from_the_pinned_module(self):