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:
teknium1 2026-03-17 04:31:26 -07:00
parent d2b10545db
commit 847ee20390
4 changed files with 8 additions and 13 deletions

View file

@ -94,10 +94,9 @@ DEFAULT_CONTEXT_LENGTHS = {
"gpt-5": 128000,
"gpt-5-codex": 128000,
"gpt-5-nano": 128000,
"claude-opus-4-6": 200000,
# Bare model IDs without provider prefix (avoid duplicates with entries above)
"claude-opus-4-5": 200000,
"claude-opus-4-1": 200000,
"claude-sonnet-4-6": 200000,
"claude-sonnet-4-5": 200000,
"claude-sonnet-4": 200000,
"claude-haiku-4-5": 200000,
@ -108,11 +107,7 @@ DEFAULT_CONTEXT_LENGTHS = {
"minimax-m2.5": 204800,
"minimax-m2.5-free": 204800,
"minimax-m2.1": 204800,
"glm-5": 202752,
"glm-4.7": 202752,
"glm-4.6": 202752,
"kimi-k2.5": 262144,
"kimi-k2-thinking": 262144,
"kimi-k2": 262144,
"qwen3-coder": 32768,
"big-pickle": 128000,