HERMES-GIELIE/api
Nathan Esquenazi 4422a87de9 fix: resolve _ENV_LOCK deadlock that blocks chat after first message
The v0.39.0 security sprint introduced _ENV_LOCK to protect env var
mutations in the streaming path. The implementation held the lock for
the entire agent run (potentially minutes), then tried to re-acquire
it in the finally block — a guaranteed deadlock on any non-reentrant
threading.Lock().

Result: first message completes (done event fires before finally hits),
but the lock is never released. Every subsequent chat/start POST blocks
forever waiting for that lock.

Fix: narrow the lock scope to just the env mutation. Set the vars inside
the with block, then let the lock release before the agent starts. The
finally block re-acquires cleanly since it no longer re-enters an
already-held lock.

No logic change — only the critical section boundary moves.
2026-04-08 14:22:39 +00:00
..
__init__.py Hermes Web UI — Sprints 11-14: multi-provider models, settings, session QoL, alerts, polish 2026-03-31 07:02:47 +00:00
auth.py release: v0.39.0 — security hardening, 12 fixes (#171) 2026-04-07 22:26:03 -07:00
config.py release: v0.39.0 — security hardening, 12 fixes (#171) 2026-04-07 22:26:03 -07:00
helpers.py release: v0.39.0 — security hardening, 12 fixes (#171) 2026-04-07 22:26:03 -07:00
models.py release: v0.39.0 — security hardening, 12 fixes (#171) 2026-04-07 22:26:03 -07:00
profiles.py chore: add missing type hints across 10 files 2026-04-05 13:30:20 +07:00
routes.py release: v0.39.0 — security hardening, 12 fixes (#171) 2026-04-07 22:26:03 -07:00
state_sync.py fix: sync message_count to state.db for /insights (#163) (#164) 2026-04-06 22:56:27 -07:00
streaming.py fix: resolve _ENV_LOCK deadlock that blocks chat after first message 2026-04-08 14:22:39 +00:00
updates.py fix: apply_update concurrency lock, boot.js settings-fail guard, dead workspace code, test_updates URL param 2026-04-05 16:20:12 +00:00
upload.py chore: add missing type hints across 10 files 2026-04-05 13:30:20 +07:00
workspace.py chore: add missing type hints across 10 files 2026-04-05 13:30:20 +07:00