Skip to content

fix(identity-neutralize): neutralize Grok/xAI self-identification that trips the content policy#227

Merged
dwgx merged 1 commit into
dwgx:masterfrom
warelik:fix/grok-neutralize
Jul 25, 2026
Merged

fix(identity-neutralize): neutralize Grok/xAI self-identification that trips the content policy#227
dwgx merged 1 commit into
dwgx:masterfrom
warelik:fix/grok-neutralize

Conversation

@warelik

@warelik warelik commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

中文 TL;DR

中和 Grok CLI 的 "You are Grok ... released by xAI" 自我介绍 + 剥离
<executing_actions_with_care> 块 —— 它们会触发 Devin content policy 拦截(已 A/B 确认)。
与 a1-a5 同一规则族,受同一开关 WINDSURFAPI_NEUTRALIZE_CLIENT_ID 控制。

Summary

Closes #223. Extends the existing a1–a5 client-identity neutralization with an
a6-grok rule. Same gate, same style as the prior blocks (#213 / #214 family).

Fix

  • src/handlers/identity-neutralize.js: rewrite You are Grok <ver> released by xAI
    (and the bare noun-phrase form) to a generic assistant line; strip the whole
    <executing_actions_with_care>…</executing_actions_with_care> block.

Test plan

  • +7 tests: exact self-ID, bare noun phrase, version variants (4.5.1 / 3 mini),
    inline + multiline block strip, unrelated "Grok" untouched, opt-out gate respected
  • Full suite: npm test2768 pass / 0 fail

Branch is on current master (v3.5.0), applies cleanly.

…-grok)

Grok CLI's "You are Grok X.Y released by xAI." self-ID and its
<executing_actions_with_care> block trip Devin's content policy
(permission_denied), live-confirmed by A/B. Same rule family as a1-a5.

- src/handlers/identity-neutralize.js: rewrite the "You are Grok ... released by
  xAI" self-ID (and bare noun-phrase form) to a generic assistant line; strip the
  <executing_actions_with_care> block
- test/client-identity-neutralize.test.js: +7 — exact/variant/bare forms, multiline
  block strip, unrelated "Grok" untouched, opt-out gate respected
@dwgx
dwgx merged commit a335d51 into dwgx:master Jul 25, 2026
5 checks passed
dwgx added a commit that referenced this pull request Jul 25, 2026
- contributors.json: 新增 6 条(#224 S / #225 A+ / #226 S / #227 A / #228 B+ / #229 A)
- README 中英: warelik 段落补本轮六个 PR 的技术叙述
@dwgx

dwgx commented Jul 25, 2026

Copy link
Copy Markdown
Owner

已合并,谢谢 🙏 Grok 这条是 a1-a5 家族的第四个客户端,补得正是时候 —— 我这边同期正好在处理 codex 的同类问题(#219),两条一起进 master 之后,neutralizeClientIdentity 现在覆盖 Claude Code(a1-a4)/ Cline(a5)/ Grok(a6-grok,你)/ codex(a7)四个客户端。

正则的边界处理是这个 PR 质量的体现:任意版本号(4.5 / 4.5.1 / 3 mini)都命中,但未带 xAI 归属的 You are Grok, a helpful assistant. 和 Logstash 的 grok filter 都不动 —— 触发器是"released by xAI"这个归属式而不是品牌名本身,这个判断和 a5 那条(触发器是能力吹嘘句式而非 "Cline" 这个名字)是同一个思路,说明你读懂了既有规则的设计意图再动手的。

<executing_actions_with_care> 整块剥离也对,它和 self-ID 出现在同一个被拦请求里,单修一个可能还是被拦 —— 这跟 codex 那条"两个片段都得改才通过"是同一类现象。

合并后我做了四客户端共存的交叉验证(混合 prompt 同时含 Grok 身份和 codex 工具描述),规则互不干扰、总开关统一生效:

a1 ClaudeCode → You are an AI coding assistant.
a5 Cline      → You are Cline, a software engineer.
a6-grok Grok  → You are an AI coding assistant.   ← 你
a7 codex      → free-form ... provide as plain text

已加入致谢名单,评级 A。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Grok CLI "You are Grok ... released by xAI" self-ID 触发 Devin content policy (permission_denied)

2 participants