Skip to content

fix(openbot_cli): free the openbot command for the Electron launcher - #319

Merged
regnull merged 1 commit into
mainfrom
feat/restore-openbot-command
Nov 18, 2026
Merged

regnull merged 1 commit into
mainfrom
feat/restore-openbot-command

Conversation

@regnull

@regnull regnull commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Problem

The repository-root openbot script has launched the Electron desktop UI since commit 357a8cc ("launch Electron from openbot command", #156) — it ends with:

exec make -C "$repository_root" app ROOT_DIRECTORY="$workspace_root"

make app is an alias for make electron, which runs scripts/electron-dev.sh. That is the "before" behavior.

The terminal client added in #314 registered its console script as openbot:

[project.scripts]
openbot = "openbot_cli.cli:cli"

So pip install -e backend (or uv pip install -e .) installed a console script that shadowed the root launcher, and a bare openbot stopped starting the desktop app.

Solution

Free the openbot name for the Electron launcher by renaming the terminal client's entry point to openbot_cli:

[project.scripts]
# Terminal client (backend/openbot_cli) — a CLI/TUI alternative to the web UI.
# Named `openbot_cli` so the plain `openbot` command stays free for the
# repository-root Electron launcher (see the root `openbot` script → `make app`).
openbot_cli = "openbot_cli.cli:cli"

The repository-root openbot launcher and scripts/electron-dev.sh are unchanged — they already start Electron correctly; only the colliding name had to go.

Files changed

File Change
backend/pyproject.toml console script openbot → openbot_cli
backend/openbot_cli/cli.py docstring/usage examples use openbot_cli
backend/openbot_cli/config.py docstring openbot connect → openbot_cli connect
backend/openbot_cli/README.md all command examples use openbot_cli
backend/tests/test_openbot_cli.py two regression tests pinning the entry-point contract

Tests

Regression tests added so the two commands cannot silently collide again:

def test_pyproject_exposes_terminal_client_as_openbot_cli():
    scripts = tomllib.loads(pyproject.read_text())["project"]["scripts"]
    assert scripts["openbot_cli"] == "openbot_cli.cli:cli"
    # `openbot` must stay free for the Electron launcher (see scripts/test_openbot.py).
    assert "openbot" not in scripts

def test_root_launcher_keeps_launching_electron():
    text = (Path(__file__).resolve().parents[2] / "openbot").read_text()
    assert "app" in text and "ROOT_DIRECTORY" in text
  • uv run pytest -q → 863 passed, 30 deselected
  • uv run ruff check . → clean
  • scripts/test_openbot.py → 15 tests OK (root launcher still delegates to make ... app)
  • tests/test_openbot_cli.py → 19 passed

Acceptance criteria

  1. openbot launches the Electron desktop UI — the root launcher already does exec make app; the shadowing console script is gone. ✅
  2. Terminal client reachable as openbot_cli. ✅
  3. No unrelated WIP touched (work in a dedicated worktree). ✅
  4. CI green before hand-off. ✅

OpenBot - @engineer

The repository-root `openbot` script has launched the Electron desktop UI
since #156 (`exec make -C "$repository_root" app ROOT_DIRECTORY=...`). The
terminal client added in #314 registered its console script as `openbot`,
so a `pip install -e backend` shadowed the launcher and `openbot` stopped
starting the desktop app.

Rename the terminal client's entry point to `openbot_cli` and update its
docs/docstrings to match. The root `openbot` launcher and
`scripts/electron-dev.sh` are unchanged — they already start Electron.

Add regression tests pinning the entry-point contract so the two commands
cannot silently collide again.

@regnull regnull left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: PASS (COMMENTED — shared account blocks self-approval)

Verified against the diff at head 9782970, not the report. Scope is exactly the 5 briefed files (+61/−31); repo-root openbot, Makefile, scripts/electron-dev.sh are untouched (git diff --name-only origin/main...HEAD -- openbot Makefile scripts/electron-dev.sh → 0 paths).

1. Entry-point contract — OK. backend/pyproject.toml:41 defines openbot_cli = "openbot_cli.cli:cli" and no openbot key remains. I confirmed the usage string a user actually sees: invoking the group the way the installed script does (CliRunner().invoke(cli, ["--help"], prog_name="openbot_cli")) prints Usage: openbot_cli [OPTIONS] COMMAND [ARGS]... — click derives the prog name from sys.argv[0], not from the group object, so the bare cli function name is not user-visible. Nothing confusing left.

2. Rename completeness — OK. All 20 openbot <subcommand> occurrences in backend/openbot_cli/README.md (table + examples + auth + issues sections), the cli.py module docstring, and the config.py:3 docstring are openbot_cli. A repo-wide grep on the PR head for a bare openbot (connect|threads|thread|send|bots|runs|run|issues) returns zero hits, so no doc or test still instructs the old name. README.md:85-87 also adds the disambiguation note (terminal vs. Electron) — a nice touch.

3. New regression tests — tomllib test is good, launcher test is weak. test_pyproject_exposes_terminal_client_as_openbot_cli is a real guard: it pins the exact module path and that openbot stays out of [project.scripts]. test_root_launcher_keeps_launching_electron (test_openbot_cli.py:378-384) only substring-matches the launcher text ("app" in text and "ROOT_DIRECTORY" in text). It catches outright deletion but not a wrong target — e.g. flipping the exec line to make frontend ROOT_DIRECTORY=... would still pass. The real coverage for that behaviour already exists and is much stronger: scripts/test_openbot.py runs the launcher with a fake make on PATH and asserts args=-C| + |app|ROOT_DIRECTORY= from the actual argv. Non-blocking, but the assertion should be tightened to the invocation, e.g. assert "exec make" in text and "app ROOT_DIRECTORY=" in text.

4. Report-vs-diff accuracy — no material discrepancy. Both the PR body (a 5-row file table) and the engineer's in-thread report enumerate all five files; config.py and the README.md auth line are explicitly called out. The only drift is phrasing ("that, plus the two stragglers … is the whole diff" reads as if they were outside the listed set). Cosmetic.

Nits to carry (post-merge cleanup, none blocking):

  1. test_root_launcher_keeps_launching_electron assertion is too loose (see §3) — tighten it or drop it as a duplicate of scripts/test_openbot.py.
  2. test_openbot_cli.py:379-383 imports tomllib/Path inside the test body while the module already has a top-level import block — move them up for consistency.
  3. Operational, not code: an environment that already ran pip install -e backend still has a stale installed openbot script until it is reinstalled; the new entry point only takes effect on reinstall. Worth a line in the PR body for whoever tests it.

Note: PR is a draft; the pre-merge gate must check isDraft (currently true), not mergeStateStatus (reports CLEAN even for drafts).

OpenBot - @reviewer

@regnull
regnull marked this pull request as ready for review November 18, 2026 01:45
@regnull
regnull merged commit b02d166 into main Nov 18, 2026
4 checks passed
@regnull
regnull deleted the feat/restore-openbot-command branch November 18, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant