fix(agent): surface blocked AGENTS.md warning to user and remove mythic false positive - #59918
fix(agent): surface blocked AGENTS.md warning to user and remove mythic false positive#59918webtecnica wants to merge 1 commit into
Conversation
|
@teknium1 Ready for review. Two fixes in one small PR:
6 lines total, CI should be clean. 🙏 |
|
Code Quality Review: What I did: Findings: 1.
|
Duplicate of #59652 — same author, same two fixes (route threat-scanner context blocks through the truncation-warning pipeline in |
…ic false positive Two changes: 1. When _scan_context_content() blocks a file, the warning was only logged to file via logger.warning(). Now it also calls _record_truncation_warning() so the message is surfaced to the user via the existing drain_truncation_warnings() -> _emit_status() pipeline. 2. Remove 'mythic' from the known_c2_framework regex in threat_patterns.py. 'Mythic' is a common English word and the name of a well-known RPG product (Mythic Game Master Emulator). The comment on lines 109-114 already warns against adding common English words — 'praxis' was removed for exactly this reason. Closes NousResearch#59612
64d7ac0 to
999c0f9
Compare
|
Closing as duplicate — the sweeper identified this as already covered by another PR. Thanks for the contribution! |
Summary
When the threat-scanner blocks a project context file (AGENTS.md, CLAUDE.md, .cursorrules), the user receives no notification — only a
logger.warningto the log file. The content is silently replaced with[BLOCKED: ...]in the system prompt, invisible to the user.Additionally,
\bmythic\bin the C2 framework regex causes false positives on legitimate content mentioning "Mythic" (a well-known RPG product, Mythic Game Master Emulator).Changes
1. User notification for blocked files (
agent/prompt_builder.py)When
_scan_context_content()blocks a file, it now calls_record_truncation_warning()so the warning is surfaced to the user via the existingdrain_truncation_warnings()→_emit_status()pipeline — the same mechanism already used for truncation warnings.Before: Only
logger.warning()→ goes to log file, user never sees it.After:
logger.warning()+_record_truncation_warning()→ user sees the warning.2. Remove
mythicfalse positive (tools/threat_patterns.py)Removed
mythicfrom theknown_c2_frameworkregex. The comment on lines 109-114 already warns against adding common English words —praxiswas removed for exactly this reason. "Mythic" is a common English word and the name of a well-known RPG product (Mythic Game Master Emulator).Files Changed
agent/prompt_builder.py_record_truncation_warning()call when blocking context filestools/threat_patterns.pymythicfrom C2 framework regexVerification
_record_truncation_warning()is defined and exported in the same module (prompt_builder.py:1232), no import needed_emit_status()already consumesdrain_truncation_warnings()output — the pipeline is fully wiredmythicremoval matches the existing pattern forpraxisremoval documented in the commentCloses #59612