From 80ea7e4bd4d8b07847b20209a5fe44e536d9fc2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Walter?= <18620296+ClementWalter@users.noreply.github.com> Date: Thu, 26 Nov 2026 21:09:15 +0100 Subject: [PATCH] Skip live install steps whose harness CLI is missing, so live join works on a machine without Codex --- one_conv/live/bridge_cli.py | 2 +- one_conv/live/cli.py | 4 +++- one_conv/live/install.py | 10 ++++++++-- tests/test_live.py | 22 ++++++++++++++++++++++ 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/one_conv/live/bridge_cli.py b/one_conv/live/bridge_cli.py index 8d8e423..de3732b 100644 --- a/one_conv/live/bridge_cli.py +++ b/one_conv/live/bridge_cli.py @@ -196,7 +196,7 @@ def join_command(invitation, hub_port, accept_teleport, yes): raise click.UsageError(str(error)) from None hub = _check_hub(hub) saved = bridge.settings() - missing = [step for step in installer.plan(launcher) if not step.done()] + missing = [step for step in installer.plan(launcher) if step.available() and not step.done()] if not yes: click.echo("DRY-RUN (nothing changed). Re-run with --yes to join.") click.echo(f" redeem the one-time invite for node {node} at {hub}") diff --git a/one_conv/live/cli.py b/one_conv/live/cli.py index 3a96c04..9c8041a 100644 --- a/one_conv/live/cli.py +++ b/one_conv/live/cli.py @@ -341,7 +341,9 @@ def install_command(harness, yes): from . import bridge steps = [step for step in installer.plan(launcher) if harness in (None, step.harness)] for step in steps: - if step.done(): + if not step.available(): + click.echo(f" skipped [{step.harness}] {step.cli} is not installed") + elif step.done(): click.echo(f" ok [{step.harness}] {step.summary}") elif yes: step.apply() diff --git a/one_conv/live/install.py b/one_conv/live/install.py index 40a03f5..3bdb78e 100644 --- a/one_conv/live/install.py +++ b/one_conv/live/install.py @@ -12,6 +12,7 @@ import re import shlex import shutil +import shutil import subprocess import sys from collections.abc import Callable @@ -27,6 +28,11 @@ class Step: summary: str done: Callable[[], bool] apply: Callable[[], None] + # The harness command the step runs; without it on PATH the step is skipped, not failed. + cli: str = "" + + def available(self, which=None) -> bool: + return not self.cli or (which or shutil.which)(self.cli) is not None def _json_file(path: Path) -> dict: @@ -177,14 +183,14 @@ def agy_hooks_apply(): Step("claude", "register the one-conv MCP server (user scope)", lambda: _registered(["claude", "mcp", "get", "one-conv"], mcp), lambda: _replace(["claude", "mcp", "remove", "--scope", "user", "one-conv"], - ["claude", "mcp", "add", "--scope", "user", "one-conv", "--", *mcp])), + ["claude", "mcp", "add", "--scope", "user", "one-conv", "--", *mcp]), cli="claude"), Step("claude", f'set "crossSessionInbound": "accept" in {settings}; any local process running as ' "you can then inject user turns into every Claude Code session, including bypass ones", inbound_done, inbound_apply), Step("codex", "register the one-conv MCP server", lambda: _registered(["codex", "mcp", "get", "one-conv"], mcp), lambda: _replace(["codex", "mcp", "remove", "one-conv"], - ["codex", "mcp", "add", "one-conv", "--", *mcp])), + ["codex", "mcp", "add", "one-conv", "--", *mcp]), cli="codex"), Step("omp", f"write the relay extension {omp.extension_path()}", extension_done, extension_apply), Step("cursor", f"add the one-conv MCP server to {cursor_mcp}", cursor_mcp_done, cursor_mcp_apply), Step("cursor", f"add the relay stop hook to {cursor_hooks}", cursor_hook_done, cursor_hook_apply), diff --git a/tests/test_live.py b/tests/test_live.py index 5df5e00..2700e00 100644 --- a/tests/test_live.py +++ b/tests/test_live.py @@ -992,6 +992,28 @@ def _step(summary_part): return next(step for step in install.plan(["one-conv"]) if summary_part in step.summary) +def _codex_step(): + return next(step for step in install.plan(["one-conv"]) if step.harness == "codex") + + +def test_install_step_without_its_cli_is_unavailable(): + assert not _codex_step().available(which=lambda name: None) + + +def test_install_step_with_its_cli_is_available(): + assert _codex_step().available(which=lambda name: f"/usr/bin/{name}") + + +def test_install_file_step_needs_no_cli(): + assert _step("stop hook").available(which=lambda name: None) + + +def test_install_lists_a_missing_harness_cli_as_skipped(homes, monkeypatch): + monkeypatch.setattr(install.shutil, "which", lambda name, **kw: None if name == "codex" else f"/usr/bin/{name}") + result = CliRunner().invoke(build_live_group(["one-conv"]), ["install", "--harness", "codex"]) + assert "skipped [codex] codex is not installed" in result.output + + def test_install_inbound_setting_keeps_other_settings(homes): (homes / "claude" / "settings.json").write_text(json.dumps({"theme": "dark"})) _step("crossSessionInbound").apply()