From c9d0c2dd19a1e46323d66ae74eb28acdcb9f65b2 Mon Sep 17 00:00:00 2001 From: ramansrivastava Date: Tue, 8 Sep 2026 16:42:32 +0530 Subject: [PATCH] Fix obsidian shell-out to use obsidian-cli instead of obsidian The obsidian real desktop app binary is also named `obsidian` on systems where it's installed, so _obsidian_create()/_obsidian_search() were launching the GUI app instead of obsidian-cli, waiting out the 10s timeout, then force-killing it. Repeated SIGKILLs can also leave a stale Electron SingletonLock behind. Fixes #1460 Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_017LiyU9TiqgNaGVu3gWaqE4 --- factory/obsidian/notes.py | 4 ++-- tests/test_obsidian.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/factory/obsidian/notes.py b/factory/obsidian/notes.py index cfb773fc0..b8755ff40 100644 --- a/factory/obsidian/notes.py +++ b/factory/obsidian/notes.py @@ -144,7 +144,7 @@ def _obsidian_create(name: str, content: str, vault: str = "factory") -> bool: try: result = subprocess.run( [ - "obsidian", + "obsidian-cli", "create", f"vault={vault}", f"name={name}", @@ -165,7 +165,7 @@ def _obsidian_search(query: str, vault: str = "factory", limit: int = 10) -> str try: result = subprocess.run( [ - "obsidian", + "obsidian-cli", "search", f"vault={vault}", f"query={query}", diff --git a/tests/test_obsidian.py b/tests/test_obsidian.py index e46a9e7af..7b4ac463e 100644 --- a/tests/test_obsidian.py +++ b/tests/test_obsidian.py @@ -288,7 +288,7 @@ def test_write_experiment_tries_cli_first( original_run = subprocess.run def mock_run(*args, **kwargs): - if args and args[0] and args[0][0] == "obsidian": + if args and args[0] and args[0][0] == "obsidian-cli": calls.append(args[0]) return Mock(returncode=1) # CLI fails return original_run(*args, **kwargs) @@ -298,7 +298,7 @@ def mock_run(*args, **kwargs): monkeypatch.setattr("factory.obsidian.notes._obsidian_create", _real_obsidian_create) path = write_experiment_note("test-project", sample_record) # Should have tried CLI - assert any("obsidian" in str(c) for c in calls) + assert any("obsidian-cli" in str(c) for c in calls) # Should have fallen back to file write assert path.exists()