mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-24 18:50:15 +00:00
stage-360: Opus follow-up — update _ENV_LOCK docstring to reflect narrow-lock semantics
Opus stage-360 review caught that the docstring at api/streaming.py:40-43 said 'around the entire agent run' which is no longer accurate after the narrow-lock refactor. The lock is now held only briefly for the env-mutation critical section; the agent runs outside the lock and the finally block re-acquires to atomically restore env vars. Docstring now points to both narrow-lock implementations as references: - _run_agent_streaming at line ~2719 (the original pattern) - profile_env_for_background_worker at api/profiles.py:715 (added stage-360)
This commit is contained in:
+5
-1
@@ -40,7 +40,11 @@ from api.turn_journal import append_turn_journal_event_for_stream
|
||||
# Global lock for os.environ writes. Per-session locks (_agent_lock) prevent
|
||||
# concurrent runs of the SAME session, but two DIFFERENT sessions can still
|
||||
# interleave their os.environ writes. This global lock serializes the env
|
||||
# save/restore around the entire agent run.
|
||||
# save/restore — held only briefly across the env-mutation critical section,
|
||||
# NOT for the entire agent run. The agent runs outside the lock; the finally
|
||||
# block re-acquires to atomically restore env vars. See narrow-lock pattern
|
||||
# in _run_agent_streaming (line ~2719) and profile_env_for_background_worker
|
||||
# (api/profiles.py:715).
|
||||
_ENV_LOCK = threading.Lock()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user