Skip to content

fix(prompt): reword agent identity phrase blocked by z.ai content filter - #63534

Open
loothoarder wants to merge 1 commit into
NousResearch:mainfrom
loothoarder:fix/zai-system-prompt-phrase-filter-upstream
Open

fix(prompt): reword agent identity phrase blocked by z.ai content filter#63534
loothoarder wants to merge 1 commit into
NousResearch:mainfrom
loothoarder:fix/zai-system-prompt-phrase-filter-upstream

Conversation

@loothoarder

Copy link
Copy Markdown

fix(prompt): reword agent identity phrase blocked by z.ai content filter

Symptom

Every Hermes-routed z.ai GLM request fails immediately with HTTP 429, code 1305 (service temporarily overloaded), even while direct API calls using the same key and coding-plane endpoint succeed.

Root cause

The z.ai coding-plane applies a server-side, exact-phrase content filter to the 23-character literal You run on Hermes Agent when it appears in a system message. HERMES_AGENT_HELP_GUIDANCE in agent/prompt_builder.py injects that literal into every Hermes system prompt, so every routed GLM call is affected.

Characterization matrix

Request content / role Result
System role + You run on Hermes Agent HTTP 429 / code 1305
User role + the same phrase HTTP 200
System role + lowercase phrase HTTP 200
System role + Hermes Agent alone HTTP 200
System role + You run on X HTTP 200
System role + You run on the Hermes Agent platform HTTP 200

Change

Reword the opening of HERMES_AGENT_HELP_GUIDANCE (line 137) to You run on the Hermes Agent platform (by Nous Research). This is a one-line, semantics-preserving change that avoids the filter while keeping the system prompt byte-stable for the lifetime of each conversation.

Reproduction

POST to https://api.z.ai/api/coding/paas/v4/chat/completions with a valid coding-plane bearer token and a system message whose content is You run on Hermes Agent: the endpoint returns 429/1305. Change only that system content to You run on the Hermes Agent platform: the endpoint returns 200.

Forensic evidence

Full local forensic record: /Users/chubai/local/coco/runs/mem0_rollout_20260712/zai_fix/FIX_RECORD.md.

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/zai ZAI provider P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels Jul 13, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #59958 (earliest-open, and it ships the regression test) — both reword the exact same HERMES_AGENT_HELP_GUIDANCE opening line in agent/prompt_builder.py to dodge the z.ai Coding Plan WAF's false 429/1305 on the literal You run on Hermes Agent. Same code-site, same trigger, same mechanism; the different reword wording doesn't change that (closed #60933 was already deduped here). Related: #59975/#60140 (runtime brand-string redaction, different site) and #56823 (the skill_view() call-syntax trigger, different substring).

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for isolating the source-level trigger. Current main still defines the reported literal at agent/prompt_builder.py:141, and agent/system_prompt.py:198 appends that guidance to every newly assembled system prompt.

Problems

  • This only changes newly assembled prompts. Continuing sessions restore matching persisted prompts verbatim at agent/conversation_loop.py:330-334, and the request path replays the cached prompt at agent/conversation_loop.py:861-870; pre-upgrade Z.AI sessions can therefore continue sending the old phrase.
  • The diff adds no regression test for the exact literal. The related open fix(agent): reword help guidance to avoid Z.AI WAF prompt-block false 429 #59958 contains a narrowly scoped prompt-builder test, but that test is not on main.

Suggested changes

  • Add a constant-level regression test that preserves the identity guidance while excluding the blocked literal.
  • Either document this as a fresh/rebuilt-session mitigation, or address resumed Z.AI sessions with an outbound request-copy transformation that does not mutate persisted or cached prompt state.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-massive Sweeper blast radius: massive — everyone, every turn (invariant surface) labels Jul 16, 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 duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists provider/zai ZAI provider sweeper:blast-massive Sweeper blast radius: massive — everyone, every turn (invariant surface) sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants