An always-on second brain you talk to. Voice notes in Telegram → typed, linked knowledge in your Obsidian vault. Runs 24/7 on the Claude subscription you already have.
Python ai-agentsai-automationclaudeclaude-codeebbinghausknowledge-graphllmmemory-systemobsidianpersonal-assistantpkmproductivitypythonsecond-braintelegram-botvoice-assistant
fix(doctor): resolve the claude binary outside PATH
smixsfdbea6c6d36d
diff --git a/src/d_brain/services/doctor.py b/src/d_brain/services/doctor.pyindex 91565c6..11584a6 100644--- a/src/d_brain/services/doctor.py+++ b/src/d_brain/services/doctor.py@@ -90,10 +90,17 @@ def check_disk(runtime_dir: Path, min_bytes: int = 500_000_000) -> CheckResult:return CheckResult("disk", free >= min_bytes, f"{gb:.1f} GB свободно")-def check_claude_version(claude_bin: str = "claude") -> CheckResult:+def check_claude_version(claude_bin: str | None = None) -> CheckResult:+ # Manual runs (ssh, cron) often lack ~/.local/bin in PATH — resolve the+ # binary the way the install lays it out instead of false-alarming.+ bin_ = (+ claude_bin+ or shutil.which("claude")+ or str(Path.home() / ".local" / "bin" / "claude")+ )try:out = subprocess.run(- [claude_bin, "--version"], capture_output=True, text=True, timeout=15+ [bin_, "--version"], capture_output=True, text=True, timeout=15)return CheckResult("claude", out.returncode == 0, out.stdout.strip() or "ok")except (OSError, subprocess.SubprocessError) as exc:diff --git a/tests/test_doctor.py b/tests/test_doctor.pyindex 9bab73a..9907b37 100644--- a/tests/test_doctor.py+++ b/tests/test_doctor.py@@ -85,3 +85,21 @@ def test_canary_is_tagged_as_maintenance():sess = RecordingSession(AskResult("ok", reply="DBRAIN_OK"))Doctor(sess, checks=[]).run()assert sess.request_ids and sess.request_ids[0].startswith("maint-")+++def test_check_claude_version_resolves_binary_outside_path(monkeypatch, tmp_path):+ # Manual runs (ssh, cron) often lack ~/.local/bin in PATH — the check+ # must resolve the binary like the services do, not false-alarm.+ import d_brain.services.doctor as doc++ fake_bin = tmp_path / ".local" / "bin" / "claude"+ fake_bin.parent.mkdir(parents=True)+ fake_bin.write_text("#!/bin/sh\necho 2.1.0\n")+ fake_bin.chmod(0o755)++ monkeypatch.setenv("PATH", "/usr/bin:/bin") # no ~/.local/bin+ monkeypatch.setattr(doc.Path, "home", staticmethod(lambda: tmp_path))++ res = doc.check_claude_version()+ assert res.ok+ assert "2.1.0" in res.detail