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:
+2
-1
@@ -537,7 +537,8 @@ def _execute_save_document(tool_input):
|
|||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
return "save_document: pandoc timed out (>120s)."
|
return "save_document: pandoc timed out (>120s)."
|
||||||
except FileNotFoundError:
|
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:
|
if proc.returncode != 0:
|
||||||
err = proc.stderr.decode("utf-8", errors="replace")[:400]
|
err = proc.stderr.decode("utf-8", errors="replace")[:400]
|
||||||
return f"save_document: pandoc failed: {err}"
|
return f"save_document: pandoc failed: {err}"
|
||||||
|
|||||||
Reference in New Issue
Block a user