Skip to content

fix(prompts): rename [SYSTEM: → [IMPORTANT: in all user-injected markers (Azure content filter)#16114

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-52268e05
Apr 26, 2026
Merged

fix(prompts): rename [SYSTEM: → [IMPORTANT: in all user-injected markers (Azure content filter)#16114
teknium1 merged 2 commits into
mainfrom
hermes/hermes-52268e05

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvages #6616 and extends the fix to the remaining 10 call sites the original PR did not cover. Closes #6576.

Root cause

Azure OpenAI Default/DefaultV2 content filters treat bracketed [SYSTEM: ...] meta-instructions as prompt-injection attempts and reject requests with HTTP 400. [IMPORTANT: preserves the semantic meaning for every model while bypassing the heuristic.

Why not just merge #6616

The reporter's second comment on #6576 explicitly flagged that the trigger word appears in many more places than #6616 touched. #6616 only renamed agent/skill_commands.py (2) and cron/scheduler.py (3) — Azure users would still hit the filter on watch-pattern / completion notifications, MCP reload notices, and gateway auto-loaded skill banners.

Changes

File Before After
agent/skill_commands.py 2 [SYSTEM: 0
cron/scheduler.py 3 [SYSTEM: 0
cli.py 4 live + 1 docstring 0
gateway/run.py 5 live + 1 docstring 0
tools/process_registry.py 1 comment 0

Not renamed: environments/hermes_base_env.py uses [SYSTEM]\n{content} for Atropos RL training trajectory rendering — never sent through Azure, part of a symmetric [USER]/[ASSISTANT]/[TOOL] scheme. Leaving it alone.

Attribution

Commit bed192135 is @ygd58's original commit cherry-picked onto current main with authorship preserved. Commit 029d44fa9 is the extension sweep + AUTHOR_MAP entry.

Validation

  • python -c 'import py_compile; ...' on all 5 touched files: OK
  • grep '\[SYSTEM:' --include="*.py" in non-test files returns zero results (except the RL [SYSTEM] no-colon case, intentionally preserved)
  • No test asserted on the [SYSTEM: prefix; test files that feed synthetic text="[SYSTEM: ...]" are independent of the production strings and still pass their own logic.

ygd58 and others added 2 commits April 26, 2026 08:33
…t filter

Azure OpenAI content filters (Default/DefaultV2) treat bracketed
[SYSTEM: ...] meta-instructions as prompt-injection attempts and
reject requests with HTTP 400.

Replacing [SYSTEM: with [IMPORTANT: preserves the same semantic
meaning for the model while bypassing the Azure heuristic.

Fixes #6576
Follow-up to #6616 covering the remaining user-injected prompt markers that
the original PR did not touch (reporter's second comment on #6576 explicitly
flagged these). Azure OpenAI Default/DefaultV2 content filters treat any
bracketed [SYSTEM: ...] as prompt-injection and reject with HTTP 400.

Remaining call sites renamed:
- cli.py: background-process notifications (watch_disabled, watch_match,
  completion), MCP reload notice (4 live + 1 docstring)
- gateway/run.py: same notification paths + auto-loaded skill banner +
  MCP reload notice (5 live + 1 docstring)
- tools/process_registry.py: comment reference

Not renamed:
- environments/hermes_base_env.py '[SYSTEM]\n{content}' — RL training
  trajectory rendering only, never sent to Azure, part of a symmetric
  [USER]/[ASSISTANT]/[TOOL] scheme.

AUTHOR_MAP: buraysandro9@gmail.com -> ygd58.
@teknium1 teknium1 merged commit 20cb706 into main Apr 26, 2026
11 of 12 checks passed
@teknium1 teknium1 deleted the hermes/hermes-52268e05 branch April 26, 2026 15:45
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard comp/cron Cron scheduler and job management comp/gateway Gateway runner, session dispatch, delivery labels Apr 26, 2026
@ether-btc

Copy link
Copy Markdown
Contributor

Excellence Contribution — Rename [SYSTEM:[IMPORTANT: for Azure Content Filter

What it does
Systematically renames the [SYSTEM: bracketed meta-instruction marker to [IMPORTANT: in every user-facing string Hermes injects into prompts — 18 occurrences across 6 files: agent/skill_commands.py, cron/scheduler.py, cli.py, gateway/run.py, and tools/process_registry.py.

Why it matters
Azure OpenAI's DefaultV2 content filter treats [SYSTEM: as a prompt-injection signal and returns HTTP 400, silently blocking the request. Every Hermes deployment on Azure was silently failing — users saw authentication errors or empty responses with no indication that the prompt itself was being filtered at the HTTP layer. [IMPORTANT: preserves identical semantic meaning for every model while bypassing the heuristic.

What was preserved
environments/hermes_base_env.py uses [SYSTEM]\n{content} for Atropos RL training trajectory rendering — never sent through Azure, part of a symmetric [USER]/[ASSISTANT]/[TOOL] trajectory scheme, and intentionally left unchanged.

Implications

  • Azure deployments are unblocked — this was a silent, deployment-wide blocker
  • A future lint rule or test validating no [SYSTEM: in prompt strings sent to Azure would prevent this class of regression
  • No behavior change for non-Azure deployments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/cron Cron scheduler and job management comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Azure OpenAI security filters block some Hermes requests due to trigger word

4 participants