mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 19:20:16 +00:00
df03055def
Three small follow-ups from the review: 1. Remove the over-broad except Exception around get_active_hermes_home() in _handle_cron_run. The function is in-memory dict reads + one Path.is_dir() stat — if it raises from inside a request handler, api.profiles is in a state we shouldn't be making cron decisions in. A silent fallback to _profile_home=None re-introduces the exact bug #1573 fixes (worker thread runs unpinned against process-global HERMES_HOME). Better to 500 the request than risk silent cross- profile state corruption. 2. Add a thread-safety note on os.environ mutation in api/profiles.py explaining why _cron_env_lock is sufficient — CPython env-var assignment is GIL-protected at the bytecode level but the multi-step read-modify-write pattern (snapshot prev → assign new → restore on exit) is not atomic without explicit serialization. The lock makes the entire context-manager body run-to-completion serially, including any subprocess.Popen() calls inside run_job() that inherit the env. 3. New regression test (test_cron_run_does_not_silently_swallow_profile_resolution_errors) pinning the no-silent-fallback contract via source-level assertion. Catches future re-introduction of the over-broad except clause. Co-authored-by: kowenhaoai <kowenhaoai@users.noreply.github.com>