api.py: save_document — distinguish PATH miss from missing install in error

The systemd unit pins PATH to the venv only, so subprocess.run(['pandoc', ...])
raised FileNotFoundError even though pandoc was installed at /usr/bin/pandoc.
The handler's "pandoc not installed" message was misleading — pandoc was
reachable from a login shell but not from the service. Rephrased to point at
the actual cause: the service's PATH. The systemd drop-in to extend PATH is
not committed here (lives at /etc/systemd/system/aaronai.service.d/path.conf
on the host).
This commit is contained in:
2026-05-20 00:51:41 +00:00
parent fda61ad622
commit 8c2c597687
+2 -1
View File
@@ -537,7 +537,8 @@ def _execute_save_document(tool_input):
except subprocess.TimeoutExpired:
return "save_document: pandoc timed out (>120s)."
except FileNotFoundError:
return "save_document: pandoc not installed."
return ("save_document: pandoc binary not reachable from the api process "
"(check that PATH in aaronai.service includes /usr/bin).")
if proc.returncode != 0:
err = proc.stderr.decode("utf-8", errors="replace")[:400]
return f"save_document: pandoc failed: {err}"