Skip to content

Commit 14d52f2

Browse files
chore(logging): suppress harmless empty-message-cache warning and drop dead code
* Add a narrow logging.Filter on agent_framework._workflows._agent_executor that drops only the 'Running agent with empty message cache' message. This warning fires by design in GroupChat orchestration when the orchestrator routes back to the same speaker (broadcast cache is empty because _broadcast_messages_to_participants excludes the source executor). The framework's parent client prepends system instructions before the LLM call, so the API request still has content. Other warnings/errors from the same logger remain visible. * Remove three lines of commented-out duplicate callback invocation in groupchat_orchestrator._complete_agent_response. The live callback handler is in the block directly above; the commented block was refactor debris. No behavioural change. All 833 tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 03387c4 commit 14d52f2

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

src/processor/src/libs/agent_framework/groupchat_orchestrator.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,10 +1250,6 @@ async def _complete_agent_response(
12501250
"on_agent_response callback failed (agent=%s)", agent_name
12511251
)
12521252

1253-
# # Invoke callback
1254-
# if callback:
1255-
# await callback(response)
1256-
12571253
async def _build_groupchat(self) -> Workflow:
12581254
"""Build the GroupChat Orchestrator workflow"""
12591255
coordinator = self.agents[self.coordinator_name]

src/processor/src/utils/logging_utils.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,29 @@
2222
from azure.core.exceptions import HttpResponseError
2323

2424

25+
class _EmptyMessageCacheFilter(logging.Filter):
26+
"""Suppress the harmless ``empty message cache`` warning emitted by
27+
``agent_framework._workflows._agent_executor``.
28+
29+
This warning fires by design in GroupChat orchestration when the orchestrator
30+
routes back to the same speaker (its broadcast cache is empty because
31+
``_broadcast_messages_to_participants`` excludes the source executor). The
32+
framework's parent client prepends the agent's system instructions before
33+
calling the LLM, so the API call still has content. The warning is pure noise.
34+
35+
The filter is intentionally narrow: it matches only the exact message and
36+
leaves every other warning/error from the same logger visible.
37+
"""
38+
39+
_MARKER = "Running agent with empty message cache"
40+
41+
def filter(self, record: logging.LogRecord) -> bool: # noqa: D401
42+
try:
43+
return self._MARKER not in record.getMessage()
44+
except Exception:
45+
return True
46+
47+
2548
def configure_application_logging(debug_mode: bool = False):
2649
"""
2750
Comprehensive logging configuration with third-party suppression.
@@ -120,6 +143,13 @@ def configure_application_logging(debug_mode: bool = False):
120143
for logger_name in always_warning_loggers:
121144
logging.getLogger(logger_name).setLevel(logging.WARNING)
122145

146+
# Suppress only the harmless "Running agent with empty message cache" warning
147+
# emitted by agent_framework's GroupChat orchestration. Real warnings/errors
148+
# from the same logger are still surfaced.
149+
_executor_logger = logging.getLogger("agent_framework._workflows._agent_executor")
150+
if not any(isinstance(f, _EmptyMessageCacheFilter) for f in _executor_logger.filters):
151+
_executor_logger.addFilter(_EmptyMessageCacheFilter())
152+
123153
# Set environment variables to suppress verbose output at the source
124154
os.environ.setdefault("HTTPX_LOG_LEVEL", "WARNING")
125155
os.environ.setdefault("AZURE_CORE_ENABLE_HTTP_LOGGER", "false")

0 commit comments

Comments
 (0)