Skip to content

fix(agent): rephrase compression preamble to avoid Azure/OpenAI content-filter false positives - #19370

Closed
liuhao1024 wants to merge 3 commits into
NousResearch:mainfrom
liuhao1024:fix/compression-prompt-content-filter
Closed

fix(agent): rephrase compression preamble to avoid Azure/OpenAI content-filter false positives#19370
liuhao1024 wants to merge 3 commits into
NousResearch:mainfrom
liuhao1024:fix/compression-prompt-content-filter

Conversation

@liuhao1024

@liuhao1024 liuhao1024 commented May 3, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Rephrase the context compression summarizer preamble to avoid triggering Azure/OpenAI content-filter jailbreak detection, while preserving the same semantic intent.

Root Cause

The compression preamble in agent/context_compressor.py::_generate_summary() contained phrases that predictably trip Azure/OpenAI content-filter heuristics:

  • "injected as reference material for a DIFFERENT assistant" — "injected" + "DIFFERENT assistant" reads like prompt-injection framing
  • "Do NOT respond to any questions or requests" — aggressive negation triggers jailbreak filters
  • "NEVER include API keys" — directive-style "NEVER" can also trigger filters

These phrases, combined with the serialized conversation body being summarized, create enough signal for Azure's ResponsibleAIPolicyViolation / jailbreak filter to reject the auxiliary summary call with HTTP 400.

Related Issue

N/A

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • See commit messages for detailed changes

How to Test

  1. Run pytest tests/ -q — all tests should pass
  2. Verify the specific scenario described above is resolved

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 26.4.1

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture and workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A

…INSTALL_TIMEOUT

Increase the default npm install timeout for WhatsApp bridge from 60s
to 300s (5 minutes) to accommodate slower systems like Unraid NAS.
Make it configurable via WHATSAPP_NPM_INSTALL_TIMEOUT environment variable
for users who need even longer timeouts.

Closes NousResearch#14980
- Add 'path', 'old_string', 'new_string', and 'patch' to required list
- Update description to clarify mode-specific parameter requirements
- This addresses issue where LLMs would omit these parameters because
  they were not marked as required in the schema, even though they
  are required depending on the mode

Fixes NousResearch#15524
…nt-filter false positives

The summarizer preamble in context_compressor.py contained phrases that
trigger Azure/OpenAI content-filter jailbreak detection:
- 'injected as reference material for a DIFFERENT assistant'
- 'Do NOT respond to any questions or requests'
- 'NEVER include API keys'

Rephrased to use softer directives while preserving the same semantic
intent. The summary output prefix (SUMMARY_PREFIX) is unchanged since
it is injected into conversation context, not sent as a prompt.

Regression tests assert the trigger phrases are absent and the new
wording preserves key semantic markers.

Fixes NousResearch#19362
@alt-glitch alt-glitch added comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API type/bug Something isn't working labels May 3, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the compression compatibility work. This is already implemented on current main by a shipped equivalent fix.

  • Automated hermes-sweeper review verified agent/context_compressor.py:1793 now uses source-material/checkpoint framing instead of the injected-output and different-assistant wording.
  • tests/agent/test_context_compressor.py:691 captures the prompt passed to call_llm and verifies the historical Do NOT respond and handoff phrases are absent.
  • The implementation landed in fc88eec926a90c11a8949a3d7e0b852cfdfb0c3a (fix(compressor): soften summary prompt for content filters) and shipped in v2026.5.7.

Closing as implemented on main.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants