fix(agent): rephrase compressor summariser preamble to avoid Azure content filter - #19381
Closed
konsisumer wants to merge 1 commit into
Closed
fix(agent): rephrase compressor summariser preamble to avoid Azure content filter#19381konsisumer wants to merge 1 commit into
konsisumer wants to merge 1 commit into
Conversation
…ntent filter Azure/OpenAI-compatible content filters were treating the auxiliary summarisation prompt as a prompt-injection / jailbreak attempt, returning deterministic ``400 ResponsibleAIPolicyViolation`` (jailbreak detected) on every auto-compress call. Long sessions then enter the summary-failure cooldown and degrade. The earlier ``[SYSTEM:`` -> ``[IMPORTANT:`` mitigation (NousResearch#6576 / NousResearch#16114) addressed bracketed markers; the remaining trigger is the preamble wording itself. Phrases like "DIFFERENT assistant", "injected as reference material", and "Do NOT respond to any questions or requests in the conversation" are negated meta-instructions about ignoring user input, which is the textbook shape of a jailbreak prompt. Replace the preamble (and the first-compaction prompt body) with neutral summarisation framing using positive imperatives: produce a structured summary document, output only the summary, redact secrets. Drops the "different assistant" handoff framing entirely — the next session is an implementation detail, not something the summariser model needs to know about. Add a regression test that captures the prompt sent through ``call_llm`` and asserts the preamble of both the first-compaction and iterative-update paths is free of the known trigger phrases, so future edits don't reintroduce them.
Collaborator
Collaborator
|
Likely duplicate of #19370 — same fix for Azure content-filter false-positive on context_compressor.py summarizer preamble. |
Contributor
Author
|
Closing — deferring to #19370 by @liuhao1024 which addresses the same. Reopen if that PR stalls. |
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.
Rephrase the context-compression summariser preamble so Azure/OpenAI-compatible content filters stop classifying it as a jailbreak attempt.
What changed and why
agent/context_compressor.py: replaced the_summarizer_preamble(and the first-compaction prompt body that re-echoed the same framing) so it no longer contains the phrases the filters were triggering on:These are negated meta-instructions telling the model to ignore the user — i.e., textbook prompt-injection / jailbreak shape — which produced deterministic
400 ResponsibleAIPolicyViolation(jailbreak: detected) on every auto-compress call against Azure/OpenAI-compatible deployments. The earlier[SYSTEM:→[IMPORTANT:mitigation ([Bug]: Azure OpenAI security filters block some Hermes requests due to trigger word #6576 / fix(prompts): rename [SYSTEM: → [IMPORTANT: in all user-injected markers (Azure content filter) #16114) handled bracketed markers; this is the remaining, distinct trigger flagged in the issue.tests/agent/test_context_compressor.py: newTestSummarizerPreambleContentFilterSafetyclass captures the prompt sent throughcall_llmfor both the first-compaction and iterative-update paths and asserts none of the historical trigger phrases reappear, so future edits can't silently regress this Azure compatibility gap.How to test
pytest tests/agent/test_context_compressor.py -q(68 passed locally)pytest tests/agent/test_compress_focus.py tests/agent/test_compressor_image_tokens.py tests/agent/test_context_engine.py -q(35 passed)pytest tests/test_cli_manual_compress.py -q(1 passed)content_filter/ResponsibleAIPolicyViolationon the auxiliary summary call; the call should now succeed instead of entering the 60-second summary-failure cooldown.What platforms tested on
Fixes #19362