From 125d95d59d73e60e5976b520cefbbccd2a2ada71 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sun, 25 Oct 2026 03:33:27 -0700 Subject: [PATCH] test(agent): drain the log queue before reading errors.log in the config-load warning test errors.log is written by the logging QueueListener thread, so the file can lag the caplog records the test just asserted on. On a loaded runner the read saw only the first warning, or no file at all, and failed main CI after #144257. Drain the queue with hermes_logging.flush_log_queue() first, like the other log-file tests do. Hammered 24 runs each: origin/main 4 failures, this change 0. --- tests/agent/test_config_load_warning.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/agent/test_config_load_warning.py b/tests/agent/test_config_load_warning.py index b7be449a3e..f6efa9a3f5 100644 --- a/tests/agent/test_config_load_warning.py +++ b/tests/agent/test_config_load_warning.py @@ -6,6 +6,8 @@ from unittest.mock import patch import pytest +import hermes_logging + @pytest.fixture def make_agent(monkeypatch): @@ -134,6 +136,8 @@ def test_config_failure_warns_without_exposing_values_and_preserves_defaults( "sections": "memory", } messages = [record.getMessage() for record in warnings] + # errors.log is written by the logging QueueListener thread: drain it before reading the file. + hermes_logging.flush_log_queue() persisted = (home / "logs" / "errors.log").read_text(encoding="utf-8-sig") for scope in affected: assert any(expected_sections[scope] in message for message in messages)