Repository navigation
fix(mentions): support single-char CJK names in mention pattern matching - #89864
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 1:50 AM ET / 05:50 UTC. Summary PR surface: Source +18, Tests +73. Total +91 across 2 files. Reproducibility: yes. —source-reproducible with high confidence: current main derives identity-name patterns with JavaScript word boundaries, while the supplied production-helper transcript demonstrates the failing CJK boundary case and the after-fix result. An independent live DingTalk run was not performed in this review. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep Unicode-aware boundaries in the shared derived-identity path, preserve explicit user-configured patterns as-is, and land only after the rebased exact head demonstrates matching and stripping behavior without regressions. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible with high confidence: current main derives identity-name patterns with JavaScript word boundaries, while the supplied production-helper transcript demonstrates the failing CJK boundary case and the after-fix result. An independent live DingTalk run was not performed in this review. Is this the best way to solve the issue? Yes, conditionally: changing the shared derived-name boundary logic is narrower and less duplicative than per-channel parser fixes, provided the refreshed head preserves explicit configured patterns and passes shared mention-routing validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cafa7606b757. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +18, Tests +73. Total +91 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
daaee81 to
e50492d
Compare
e50492d to
74095b5
Compare
74095b5 to
3bebb72
Compare
3bebb72 to
13bcec0
Compare
187d24f to
ccc0534
Compare
The \b word boundary assertion does not recognise CJK characters as word characters in JavaScript regex, so single-char CJK mention names (e.g. @包) failed to match in group chat messages. Replace \b with explicit lookaround assertions that treat CJK characters as boundary-worthy when the mention pattern contains CJK characters. Fixes openclaw#87303 Co-Authored-By: Claude Opus 4.8 <[email protected]>
The test config uses agents.default.identity.name but was calling buildMentionRegexes(cfg, undefined). Without an agentId, resolveAgentConfig is never called and the identity is not resolved, producing empty regexes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Use the canonical agents.list array config shape instead of the non-existent agents.default object. Pass the matching agent id to buildMentionRegexes so resolveAgentConfig finds the identity. Co-Authored-By: Claude Opus 4.8 <[email protected]>
ccc0534 to
07288a6
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Merged via squash.
|
…ing (openclaw#89864) * fix(mentions): support single-char CJK names in mention pattern matching The \b word boundary assertion does not recognise CJK characters as word characters in JavaScript regex, so single-char CJK mention names (e.g. @包) failed to match in group chat messages. Replace \b with explicit lookaround assertions that treat CJK characters as boundary-worthy when the mention pattern contains CJK characters. Fixes openclaw#87303 Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(tests): pass agentId to buildMentionRegexes in CJK mention tests The test config uses agents.default.identity.name but was calling buildMentionRegexes(cfg, undefined). Without an agentId, resolveAgentConfig is never called and the identity is not resolved, producing empty regexes. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(tests): use agents.list config shape for CJK mention tests Use the canonical agents.list array config shape instead of the non-existent agents.default object. Pass the matching agent id to buildMentionRegexes so resolveAgentConfig finds the identity. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(mentions): match derived names with Unicode boundaries --------- Co-authored-by: Claude Opus 4.8 <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
…ing (openclaw#89864) * fix(mentions): support single-char CJK names in mention pattern matching The \b word boundary assertion does not recognise CJK characters as word characters in JavaScript regex, so single-char CJK mention names (e.g. @包) failed to match in group chat messages. Replace \b with explicit lookaround assertions that treat CJK characters as boundary-worthy when the mention pattern contains CJK characters. Fixes openclaw#87303 Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(tests): pass agentId to buildMentionRegexes in CJK mention tests The test config uses agents.default.identity.name but was calling buildMentionRegexes(cfg, undefined). Without an agentId, resolveAgentConfig is never called and the identity is not resolved, producing empty regexes. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(tests): use agents.list config shape for CJK mention tests Use the canonical agents.list array config shape instead of the non-existent agents.default object. Pass the matching agent id to buildMentionRegexes so resolveAgentConfig finds the identity. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(mentions): match derived names with Unicode boundaries --------- Co-authored-by: Claude Opus 4.8 <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
fix(mentions): support single-char CJK names in mention pattern matching
Summary
Problem: The
\bword boundary assertion in JavaScript regex does not recognise CJK characters as word characters. When an agent identity name is a single CJK character (e.g. "包"), the derived mention pattern\b@?包\bfails to match@包in group chat messages. This affected DingTalk/钉钉 and other Chinese group chat channels.Fix: Added a
wrapWithBoundarieshelper inderiveMentionPatternsthat detects CJK characters in the pattern and replaces\bwith explicit Unicode-aware lookaround assertions. ASCII-only patterns continue to use\bunchanged.Out of scope: No changes to extension-specific mention parsers. Only the core shared
deriveMentionPatternsfunction is affected.Linked context
Closes #87303
Real behavior proof
\bdoes not work with CJK characters in JavaScript regexbuildMentionRegexeshelper vianode --import tsx proof-87303.mjswith a realagents.listconfig containing a CJK identity namebuildMentionRegexesandmatchesMentionPatternshelpers:buildMentionRegexeswithagents.list: [{ id: "cjk-agent", identity: { name: "包" } }]produces a regex that correctly matches@包in Chinese text and correctly rejects面包好吃(no false positive inside longer CJK word). Two-char CJK names (苏苏) also work correctly.Tests and validation
src/auto-reply/reply/mentions.test.ts: Newdescribe("CJK single-char mention matching (regression #87303)")— 5 tests usingagents.listconfig shape with concrete agent idRisk checklist
Current review state
agents.listwith concrete agent idbuildMentionRegexeshelper