ef1b06d853
hermes_cli/main.py calls setup_logging() at module scope. That resolves get_hermes_home() and attaches rotating file handlers to the ROOT logger via a QueueHandler. So merely importing it - which many test modules do, directly or transitively - points the whole pytest session's logging at <HERMES_HOME>/logs/agent.log and errors.log. The _isolate_env fixture already sandboxes HERMES_HOME, but fixtures run after collection has imported the test modules, and by then the handler holds an absolute path to the real file. Verified by importing hermes_cli.main in a clean interpreter and walking the queue listener: both handlers pointed at the developer's own ~/.hermes/logs/. Measured on a live install: 126 warnings in a personal agent.log came from test runs rather than the running gateway - phantom 'FakeTree' Discord registration failures and 'rejected invalid API key' entries whose paths only exist in tests/gateway/test_api_server_runs.py. That noise makes genuine warnings hard to find exactly when someone is debugging. conftest is imported before any test module, so sandboxing HERMES_HOME there closes the window. The per-test fixture still applies afterwards. Also fixes 4 pre-existing failures: tests/gateway/test_channel_directory.py TestBuildFromSessions was reading the operator's real sessions data for the same reason. Full gateway+tools suites: 66 failures on clean origin/main, 62 with this change, 0 new. The regression guard asserts the value captured AT conftest import - reading os.environ inside a test passes even with the fix removed, because the per-test fixture has sandboxed it by then. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>