HERMES-GIELIE/docs
nesquena-hermes 29878259ca docs(troubleshooting): bake the #1695 diagnostic flow into the error message + a new troubleshooting doc
Closes #1695.

@Patrick-81 reported the bare "AIAgent not available -- check that
hermes-agent is on sys.path" error on a symlinked install (~/Programmes/hermes-agent
linked to ~/hermes-agent). The maintainer's response — three diagnostic
commands plus `pip install -e .` in the agent dir — fixed it for them.
This PR captures both halves of that learning so the next user with the
same shape doesn't have to file a new issue:

1. **Error message diagnostic block.** New helper
   `_aiagent_import_error_detail()` in api/streaming.py builds a multi-line
   diagnostic when the import fails, including:
     - the running Python interpreter
     - HERMES_WEBUI_AGENT_DIR (set value, or "(not set)")
     - sys.path entries that mention hermes/agent (or "no entries mention..."
       — itself a strong diagnostic signal)
     - the most-common fix (`pip install -e .` in the agent dir)
     - a pointer to docs/troubleshooting.md

   The original error message string is preserved as the FIRST line so
   existing log scrapers and docs-search keep matching.

   Helper is kept as a separate function so it stays out of the hot path
   until we actually need to raise — building it on every successful import
   would be wasted work.

2. **New docs/troubleshooting.md.** Symptom → Why → Diagnostic commands →
   Fix → When-to-file-a-bug template, with one entry to start: the
   "AIAgent not available" flow Patrick-81 walked through. Future
   recurring failure modes follow the same template. Required a one-line
   addition to .gitignore — docs/* is gitignored with an allowlist, and
   the new file needed `!docs/troubleshooting.md` to be tracked.

3. **README link.** docs/troubleshooting.md added to the `## Docs` section
   so users know where to look first.

13 regression tests in tests/test_1695_aiagent_import_error_detail.py:
9 for the helper output shape (preserves original message line, includes
running python, shows HERMES_WEBUI_AGENT_DIR set/unset both ways, includes
pip-install-e hint, points at troubleshooting doc, lists relevant sys.path
entries when present, says "no entries..." when absent, output is multi-line)
plus 4 for the docs-presence regression (file exists, has the AIAgent
section, includes pip install -e ., describes the diagnostic chain with
readlink + agent/__init__.py verification).

190 streaming/aiagent tests pass after the change. ast.parse on
api/streaming.py clean.

CI failure on prior push was due to the docs/* gitignore swallowing the
new troubleshooting.md file silently — this commit adds the allowlist
entry so the file is tracked.
2026-05-05 22:14:07 +00:00
..
images docs: HERMES.md deep-dive, Why Hermes in README, screenshot layout 2026-04-03 22:03:19 -07:00
pr-assets fix(ui): restore rail-era app titlebar state (v0.50.226) (#1163) 2026-04-27 11:43:32 -07:00
pr-media Stage 303: PR #1719 2026-05-05 21:58:21 +00:00
ui-ux feat: remove bubble_layout setting end-to-end (#777) 2026-04-20 22:34:45 +00:00
docker.md v0.50.260: Docker reliability batch - PR #1428 + broader UX/docs improvements + Opus advisor fixes 2026-05-01 23:10:52 +00:00
EXTENSIONS.md Opus pre-release follow-ups for PR #1445 2026-05-02 03:49:40 +00:00
ISSUES.md fix(#1195): route sessions to profile dir even when dir doesn't exist yet (#1373) 2026-04-30 23:24:31 +00:00
supervisor.md fix: harden persistent WebUI health checks 2026-05-04 15:30:37 -07:00
troubleshooting.md docs(troubleshooting): bake the #1695 diagnostic flow into the error message + a new troubleshooting doc 2026-05-05 22:14:07 +00:00
wsl-autostart.md docs: add WSL WebUI autostart helpers 2026-05-05 01:12:07 +00:00