Skip to content

fix(openbot_cli): wire connect to ping /health and drop inline pathlib import - #315

Merged
regnull merged 1 commit into
mainfrom
feat/terminal-client-cleanup
Nov 3, 2026
Merged

regnull merged 1 commit into
mainfrom
feat/terminal-client-cleanup

Conversation

@regnull

@regnull regnull commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follow-up cleanup to the terminal client (#314), folding in two carried-forward nits:

  • connect now actually probes the server. It builds an OpenBotClient from the saved settings and calls the existing ping() against the public /api/v1/health route, so a bad URL or key surfaces immediately. A failed probe is a warning (not fatal) — the config is still saved so the user can retry. (ping() already existed and was tested; it simply wasn't wired to any command.)
  • Dropped the inline __import__("pathlib") in cli.py in favour of a top-level from pathlib import Path import.

What changed

  • backend/openbot_cli/cli.py
    • connect: saves config, then builds a client and pings; prints Connection OK (/api/v1/health) on success or a Warning: on failure (config still saved).
    • top-level from pathlib import Path; import OpenBotClientError.
  • backend/tests/test_openbot_cli.py
    • test_cli_connect_saves_and_pings: config saved, client built with correct base_url/api_key, ping() called, output reports OK.
    • test_cli_connect_warns_when_server_unreachable: warning path + config still persisted on a failed probe.

Verification

  • uv run ruff check . — only pre-existing errors remain, all in out-of-scope files I did not touch: the pre-existing untracked WIP backend/openbot/cli_client.py (someone else's) and scripts/test_makefile.py on main. The openbot_cli package is ruff-clean.
  • uv run pytest -q tests/test_openbot_cli.py tests/test_config.py → 50 passed. The two new connect tests pass.
  • No changes to web-UI code; the shared-workspace untracked WIP (cli_client.py, delivery.py, pyproject.toml, test_actor_system.py) was left exactly as found.

Note for reviewers

PR #314 is already merged, so this is a small follow-up branch off current main. Draft until CI is green.

@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.

PASS — Ready to merge (posted as COMMENTED: self-approval is blocked on the shared fleet account, not an approval).

Verified against the actual diff + production code:

  • Scope: exactly 2 files (backend/openbot_cli/cli.py, backend/tests/test_openbot_cli.py). No web-UI files touched.
  • Nit #1 (README/connect /health claim) RESOLVED: connect now probes the server via probe.ping() -> GET /api/v1/health (client.py:71-73, documented on the public unauthenticated router). On failure it warns and still saves config — matches the stated design. The earlier "claims a /health probe it does not perform" nit is closed.
  • Nit #2 (inline __import__("pathlib")) RESOLVED: now a top-level from pathlib import Path.
  • OpenBotClientError is a real exported class (client.py:30) and is imported correctly.
  • Tests: two new tests assert the discriminating behavior (config saved + pinged=True; warning on OpenBotClientError with config still saved) — not vacuous.
  • CI green on exact head per Chief of Staff (combined review+QA gate, re-check skipped).

Both carried-forward nits from #314 are now closed. No blockers.

…lib import

Two carried-forward nits from the terminal-client work (#314):

- `connect` only saved config; it now builds an OpenBotClient from the saved
  settings and probes the server's public `/api/v1/health` route, so a bad URL
  or key surfaces immediately. A failed probe is a warning, not fatal — the
  config is still saved so the user can retry (matches `ping()` which already
  existed and was tested but unwired).
- Replace `__import__("pathlib").Path(...)` with a top-level
  `from pathlib import Path` import.

Tests:
- test_cli_connect_saves_and_pings: asserts config is saved, client is built
  with the right base_url/key, ping() is called, and output reports OK.
- test_cli_connect_warns_when_server_unreachable: asserts the warning path and
  that config is still saved on a failed probe.

ruff clean on the openbot_cli package; 17 CLI tests + 50 (cli+config) pass.
@regnull
regnull force-pushed the feat/terminal-client-cleanup branch from b0d8a22 to 63c82ac Compare October 29, 2026 18:09

@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.

PASS / LGTM (diff-only re-check). Risk 2. CI is green (backend and frontend) and the merge state is CLEAN at 63c82ac.

Musts: none. Shoulds: none.

Verified

  • git diff b0d8a223 63c82acd is empty: the trees are identical. 63c82ac is a re-commit of b0d8a22 on the same parent (0bda7e3, #314), and only the commit message changed (backticks).
  • main is still 0bda7e3, so main brought in nothing new.
  • uv run pytest -q tests/test_openbot_cli.py passed 17/17, and ruff check is clean on openbot_cli and the test file.

@regnull
regnull merged commit 57f66e7 into main Nov 3, 2026
4 checks passed
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