fix: strip internal tool-trace banner lines from chat gateway delivery - #55243
fix: strip internal tool-trace banner lines from chat gateway delivery#55243Stoltemberg wants to merge 1 commit into
Conversation
Chat gateway final replies could contain internal tool-trace scaffold lines like '⚠️ 🛠️ `search repos (agent)` failed' that are diagnostic noise, not user-facing content. Add a regex pattern to strip these lines from chat surfaces while keeping them on programmatic/raw surfaces (local, api_server, webhook). Fixes NousResearch#54957
Related: this fixes #54957 at the single |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
Clean fix — strips internal tool-trace banner lines from chat gateway delivery. The regex is well-targeted and the test coverage is thorough: verifies stripping on Telegram while preserving on raw surfaces (local, api_server).
Security: Prevents internal diagnostic scaffolding from leaking to users.
Testing: Two tests covering both the stripping and preservation paths.
Reviewed by Hermes Agent
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
Strips internal tool-trace banner lines from chat gateway delivery. Uses regex to match diagnostic scaffolding lines like Warning: tool (agent) failed.
- Clean fix with good test coverage
- Well-scoped: 2 files, 27 additions
Reviewed 2 files, 27 additions. Approved.
|
Closing — duplicate detected by alt-glitch bot. Consolidating into earlier PRs. 🙏 |
What does this PR do?
Chat gateway final replies could contain internal tool-trace scaffold lines like
⚠️ 🛠️ \search repos (agent)` failedthat are diagnostic noise, not user-facing content. Add a regex pattern to strip these lines from chat surfaces while keeping them on programmatic/raw surfaces (local,api_server,webhook`).Related Issue
Fixes #54957
Type of Change
Changes Made
gateway/run.py: Add_TOOL_TRACE_BANNER_REregex pattern that matches lines like⚠️ 🛠️ `tool (agent)` failed. Apply it in_sanitize_gateway_final_response()after secret redaction and provider error classification.tests/gateway/test_telegram_noise_filter.py: Add 2 regression tests:test_tool_trace_banner_stripped_from_chat— banner stripped on Telegramtest_tool_trace_banner_kept_on_raw_surface— banner kept onlocalHow to Test
uv run --extra dev python -m pytest tests/gateway/test_telegram_noise_filter.py::test_tool_trace_banner_stripped_from_chat tests/gateway/test_telegram_noise_filter.py::test_tool_trace_banner_kept_on_raw_surface -q— both passChecklist
Code
uv run --extra dev python -m pytest tests/gateway/test_telegram_noise_filter.py -qand all tests passDocumentation & Housekeeping
cli-config.yaml.example— or N/A