Merge branch 'worktree-agent-ac54c8919e940163a'

# Conflicts:
#	scripts/setup-native.py
This commit is contained in:
2026-11-10 01:07:12 +00:00
34 changed files with 1825 additions and 66 deletions
+46 -2
View File
@@ -463,7 +463,11 @@ class SetupNativeTests(unittest.TestCase):
self.assertEqual(config["opencode"], "/usr/bin/opencode")
self.assertEqual(config["pi"], "")
self.assertEqual(config["opencode_env"]["PIPELINES_DEFAULT_MODEL"], "fixture/host-default")
self.assertEqual(config["opencode_env"]["PIPELINES_WEB_PUBLIC_URL"], "http://192.168.1.20:8082")
# A fresh install's proxy admits loopback and tailnet only, so the
# default web URL is not the LAN address.
self.assertEqual(config["opencode_env"]["PIPELINES_WEB_PUBLIC_URL"], "http://127.0.0.1:8082")
self.assertEqual((config["web"]["host"], config["web"]["lan"], config["web"]["lan_plain_login"]),
("tailnet", False, False))
host = json.loads(installer.harness_config_path().read_text())["profiles"]["opencode"]
self.assertEqual(host["model"], "fixture/host-default")
self.assertEqual(host["pipeline_model"], "fixture/host-default")
@@ -509,11 +513,51 @@ class SetupNativeTests(unittest.TestCase):
self.assertEqual((prefix / "secrets/publisher-token").read_text(), before)
self.assertEqual(manage.load(prefix)["web"]["port"], 8096)
self.assertEqual(output.getvalue().splitlines()[-4:], [
" http://localhost:8096/", " http://192.168.1.20:8096/",
" http://localhost:8096/", " http://127.0.0.1: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_upgrade_keeps_an_all_interfaces_web_host_with_a_warning_and_lan_is_opt_in(self):
with tempfile.TemporaryDirectory() as directory:
installer = self.installer(directory, Recorder())
prefix = Path(directory) / "prefix"
def install(argv):
with redirect_stdout(io.StringIO()) as output:
installer.run(setup_native.arguments(argv))
return manage.load(prefix)["web"], output.getvalue()
with patch.object(setup_native.shutil, "which", side_effect=self.which_all()), \
patch.object(setup_native.lan, "detect_lan", return_value="192.168.1.20"), \
patch.object(setup_native.configure, "host_timezone", return_value="Europe/London"):
# An install from before: the proxy on every interface.
install(["--web-host", "0.0.0.0"])
web, text = install([])
self.assertEqual(web["host"], "0.0.0.0")
self.assertIn("WARNING: the web proxy listens on 0.0.0.0 over plain HTTP", text)
self.assertIn("./install --web-host tailnet", text)
self.assertIn(" http://192.168.1.20:8082/", text)
# Opting into the LAN listener selects the new model; sign-in
# over the plain-HTTP LAN stays off until asked for.
web, text = install(["--web-lan"])
self.assertEqual((web["host"], web["lan"], web["lan_plain_login"]), ("tailnet", True, False))
self.assertNotIn("WARNING: the web proxy listens", text)
self.assertIn("Web proxy access: loopback + tailnet + LAN", text)
# The URL recorded by the old install is kept, and flagged.
self.assertIn("WARNING: the recorded web URL http://192.168.1.20:8082 is a plain-HTTP LAN", text)
web, text = install(["--web-lan-plain-login"])
self.assertEqual((web["host"], web["lan"], web["lan_plain_login"]), ("tailnet", True, True))
self.assertIn("WARNING: web.lan_plain_login is on", text)
web, _ = install(["--no-web-lan"])
self.assertEqual((web["host"], web["lan"], web["lan_plain_login"]), ("tailnet", False, False))
web, _ = install([])
self.assertEqual((web["host"], web["lan"]), ("tailnet", False))
with self.assertRaisesRegex(ValueError, "--web-lan applies to --web-host tailnet"):
installer.run(setup_native.arguments(["--web-host", "0.0.0.0", "--web-lan"]))
with self.assertRaisesRegex(ValueError, "Invalid --web-host"):
installer.run(setup_native.arguments(["--web-host", "everywhere"]))
def test_ntfy_is_built_from_the_pinned_module(self):
with tempfile.TemporaryDirectory() as directory:
recorder = Recorder()