Commit Graph

8 Commits

Author SHA1 Message Date
Teknium fdd32f81d4 fix(web): report a corrupt state.db as a throttled 503 status instead of a traceback per poll
The dashboard polls /api/analytics/usage and /api/analytics/models every
few seconds. When state.db is malformed the read raised straight through
the handler, so uvicorn logged a full traceback at ERROR on every poll —
one fleet host wrote ~520K identical journal entries in 24 h.

Wrap both analytics handlers in `corrupt_store_as_status`: a corrupt-image
sqlite3.DatabaseError (is_malformed_db_error) becomes a 503 with an
explicit `state_db_corrupt` payload pointing at `hermes doctor`, and the
warning is gated per store path via `{path: monotonic}` (>=300 s), then
debug. Busy/locked and every other error propagate unchanged, and the file
is never renamed or quarantined from the dashboard — repair stays with
`hermes doctor` / `hermes sessions repair`. `_session_db_path_for_profile`
is split out of `_open_session_db_for_profile` so the router can name the
store without opening it.

Refs #96591
Reported-by: #96591
2026-09-11 06:37:27 -07:00
Teknium 08bd8aea74 simplify(compat): web_routers — repoint 231 web_server.<name> seams to the owning module (105 direct imports, 113 late()/LateState() with module arg, 12 lazy imports + kanban plugin _ws_auth_ok) 2026-09-03 14:21:43 -07:00
Teknium e83816a4d1 review-fix(comments): restore lost #NNNN rationale comments across non-test source (mechanical sweep, condensed, code unchanged)
For each issue anchor present in BASE 63279301bc non-test .py and absent on HEAD, the BASE comment/docstring block was re-attached at the HEAD location of the code it explained (matched by the distinctive code line / enclosing def). Sentences already covered by an existing HEAD comment were deduped; the issue number always survives. Insert-only: no code lines changed.
2026-09-03 09:44:26 -07:00
Teknium e808742450 refactor(hermes_cli/web_routers/analytics): _rows query helper, _AUX_SUMMED_KEYS table, comprehension for model cards 2026-09-02 21:43:57 -07:00
Teknium 953939d7c7 refactor(hermes_cli/web_routers/analytics): extract _fold_session_only_rows/_model_capabilities, dedupe usage-key tuples, drop orphaned comment block 2026-09-02 21:13:30 -07:00
Teknium 8ac12223bb refactor(web): late() proxies replace per-handler lazy web_server imports in extracted routers 2026-09-02 13:32:45 -07:00
Teknium ba91166b1c refactor(web): hoist stdlib imports in extracted routers; drop unused web_server imports 2026-09-02 13:32:28 -07:00
Teknium 94309ad40a refactor(web): extract raw-config + analytics routes into web_routers/analytics.py 2026-09-02 13:32:02 -07:00