Skip to content

fix(cli): never print a blank doctor failure message - #1058

Merged
phernandez merged 1 commit into
mainfrom
fix/1027-doctor-empty-error
Jul 15, 2026
Merged

fix(cli): never print a blank doctor failure message#1058
phernandez merged 1 commit into
mainfrom
fix/1027-doctor-empty-error

Conversation

@phernandez

Copy link
Copy Markdown
Member

Summary

Remnant of #1027: the main event-loop bug was fixed in #1018, but the doctor command's failure handlers rendered f"Doctor failed: {e}" directly. For message-less exceptions (e.g. httpx.ReadTimeout, a bare RuntimeError), str(e) is empty, so users saw a blank Doctor failed: line with no diagnostic.

Both handlers in src/basic_memory/cli/commands/doctor.py now fall back to repr(e) when str(e) is empty, so the failure line always names the error (the reporter explicitly asked for the repr). These two sites are the only exception renderings in the file; all other error paths raise with explicit messages.

Tests

New tests/cli/test_doctor_command.py (the doctor CLI previously had no test coverage — */cli/** is omitted from unit coverage) exercises the real command path via CliRunner, stubbing only run_doctor:

  • exceptions with a message keep printing that message
  • a message-less ValueError (expected-error handler) prints Doctor failed: ValueError()
  • a message-less RuntimeError (generic handler) prints Doctor failed: RuntimeError() on stderr

All 3 pass; ruff check/ruff format clean on touched files; just typecheck exits 0 (only pre-existing Python 3.14 event-loop-policy deprecation warnings in unrelated files).

Refs #1027

🤖 Generated with Claude Code

str() of a message-less exception (e.g. httpx.ReadTimeout or a bare
RuntimeError) is empty, so both doctor failure handlers could print a
blank "Doctor failed:" line with no diagnostic. Fall back to repr(e)
whenever str(e) is empty so the failure line always names the error.

Adds CLI regression tests covering the message-preserving case and the
message-less fallback in both the expected-error and generic handlers.

Refs #1027

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez
phernandez force-pushed the fix/1027-doctor-empty-error branch from 3a326a4 to 283ad65 Compare July 15, 2026 04:36
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

recheck

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 283ad65294

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@phernandez
phernandez merged commit c8bc128 into main Jul 15, 2026
23 checks passed
@phernandez
phernandez deleted the fix/1027-doctor-empty-error branch July 15, 2026 04:55
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