mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: defensive hardening — logging, dedup, locks, dead code
Four small fixes: 1. model_tools.py: Tool import failures logged at WARNING instead of DEBUG. If a tool module fails to import (syntax error, missing dep), the user now sees a warning instead of the tool silently vanishing. 2. hermes_cli/config.py: Remove duplicate 'import sys' (lines 19, 21). 3. agent/model_metadata.py: Remove 6 duplicate entries in DEFAULT_CONTEXT_LENGTHS dict. Python keeps the last value, so no functional change, but removes maintenance confusion. 4. hermes_state.py: Add missing self._lock to the LIKE query in resolve_session_id(). The exact-match path used get_session() (which locks internally), but the prefix fallback queried _conn without the lock.
This commit is contained in:
parent
d2b10545db
commit
847ee20390
4 changed files with 8 additions and 13 deletions
|
|
@ -350,11 +350,12 @@ class SessionDB:
|
|||
.replace("%", "\\%")
|
||||
.replace("_", "\\_")
|
||||
)
|
||||
cursor = self._conn.execute(
|
||||
"SELECT id FROM sessions WHERE id LIKE ? ESCAPE '\\' ORDER BY started_at DESC LIMIT 2",
|
||||
(f"{escaped}%",),
|
||||
)
|
||||
matches = [row["id"] for row in cursor.fetchall()]
|
||||
with self._lock:
|
||||
cursor = self._conn.execute(
|
||||
"SELECT id FROM sessions WHERE id LIKE ? ESCAPE '\\' ORDER BY started_at DESC LIMIT 2",
|
||||
(f"{escaped}%",),
|
||||
)
|
||||
matches = [row["id"] for row in cursor.fetchall()]
|
||||
if len(matches) == 1:
|
||||
return matches[0]
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue