fix(agent): add debug logging to silent exception fallbacks in four agent modules - #58358
Closed
MDGChamomile wants to merge 4 commits into
Closed
fix(agent): add debug logging to silent exception fallbacks in four agent modules#58358MDGChamomile wants to merge 4 commits into
MDGChamomile wants to merge 4 commits into
Conversation
Add debug-level logging when a tool result payload fails JSON parsing and falls back to plain-text classification. No behavior change: catch breadth and return values are preserved.
Add debug-level logging when verify hook configuration loading falls back after a swallowed exception. This path previously hid config errors silently. No behavior change: catch breadth and fallback values are preserved.
Add debug-level logging when message content extraction hits its exception fallback path. No behavior change: catch breadth and return values are preserved.
Add debug-level logging when the optional jiter native parser preload fails and the import falls back. The stored preload error is preserved unchanged. No behavior change.
Contributor
|
Thanks for the focused observability improvement. The premise remains valid on current The diff preserves the existing catch scope and fallback results while adding module-local Since the PR base, only Automated hermes-sweeper review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Makes four silent exception-swallow sites in agent/ observable by adding debug-level logging, without changing catch breadth, fallback values, or any control flow. Today these paths hide real failures (e.g. a broken verify-hook config or a failed jiter preload) with no trace in logs, which makes field debugging unnecessarily hard.
Per module:
agent/tool_result_classification.py — log when a tool result payload fails JSON parsing and falls back to plain-text classification.
agent/verify_hooks.py — log when verify-hook configuration loading fails and silently falls back (previously a genuinely error-hiding path).
agent/message_content.py — log when message content extraction hits its exception fallback.
agent/jiter_preload.py — log when the optional jiter native parser preload fails; the stored preload error (_JITER_PRELOAD_ERROR) is preserved unchanged.
All logging is logger.debug(..., exc_info=True) style — zero noise at default log levels, full traceback available when debugging.
This is the same direction as other open observability fixes for swallowed exceptions (e.g. #44018, #53336, #44834), applied to four small core agent modules with focused tests.
Related Issue
No single tracking issue; this addresses the "error-hiding silent except" class also targeted by #44018 / #53336 / #44834.
Fixes #
Type of Change
Changes Made
agent/tool_result_classification.py (+11/−1) — debug log on non-JSON fallback
agent/verify_hooks.py (+10/−1) — debug log on config load fallback
agent/message_content.py (+11/−1) — debug log on extraction fallback
agent/jiter_preload.py (+8/−0) — debug log on preload failure
tests/agent/test_tool_result_classification.py (+15) — pins fallback behavior + log emission
tests/agent/test_verify_hooks.py (+22) — pins fallback behavior + log emission
tests/agent/test_message_content.py (+24) — pins fallback behavior + log emission
tests/agent/test_jiter_preload.py (+29) — pins fallback behavior + log emission
Total: 8 files, +127/−3. One commit per module for reviewable, revertible units.
How to Test
Checklist
Code
pytest tests/ -qand tests pass — ran via scripts/run_tests.sh (repo's canonical CI-parity runner) on the four affected test files; TDD red-green applied during development (new tests failed before the logging change, pass after)Documentation & Housekeeping
Screenshots / Logs
$ scripts/run_tests.sh tests/agent/test_tool_result_classification.py
tests/agent/test_verify_hooks.py tests/agent/test_message_content.py
tests/agent/test_jiter_preload.py -q
=== Per-file subprocess time distribution ===
Files: 4
Total subprocess CPU-wall: 1.7s (runner wall: 0.4s, parallelism: 16x)
<1s: 4 files (100%) <2s: 4 files (100%)
0.43s tests/agent/test_message_content.py
0.42s tests/agent/test_tool_result_classification.py
0.42s tests/agent/test_verify_hooks.py
0.42s tests/agent/test_jiter_preload.py
exit code: 0 (all passed, 0 failures)