fix(auto-reply): support custom silent tokens with digits and punctuation in prefix matcher#100007
fix(auto-reply): support custom silent tokens with digits and punctuation in prefix matcher#100007Simon-XYDT wants to merge 2 commits into
Conversation
…tion in prefix matcher [AI] Remove the hard-coded /[^A-Z_]/ character guard from isSilentReplyPrefixText that prevented streamed fragments of custom silent tokens containing digits or punctuation (e.g. "NOREPLY2", "NO-ANSWER") from matching their token prefix. Instead of a static character whitelist, use the configured token's own alphabet: tokens with non-letter characters (digits, hyphens) allow partial prefix matching since their fragments won't collide with natural-language words. Tokens with only A-Z_ letters keep the existing underscore guard. Fixes openclaw#99982 Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed July 5, 2026, 12:07 AM ET / 04:07 UTC. Summary PR surface: Source +5, Tests +26. Total +31 across 2 files. Reproducibility: yes. source-level: current main rejects matching custom-token prefixes containing digits or hyphens at the hard-coded character guard before token comparison. I did not run tests because this review was required to keep the checkout read-only. 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: Land the narrow shared-helper fix with regression tests after maintainer review and required checks; avoid channel-specific workarounds or a new config surface. Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main rejects matching custom-token prefixes containing digits or hyphens at the hard-coded character guard before token comparison. I did not run tests because this review was required to keep the checkout read-only. Is this the best way to solve the issue? Yes. The PR fixes the shared prefix helper used by streaming and typing paths, preserves the natural-language guard, and avoids a channel-specific workaround or new configuration knob. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 02af382a06b3. Label changesLabel justifications:
Evidence reviewedPR surface: Source +5, Tests +26. Total +31 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 (11 earlier review cycles; latest 8 shown)
|
…suppression For custom tokens with non-letter characters (e.g., HELP-QUIET), require the streamed prefix to include at least one of those non-letter characters before marking it as silent. Pure-letter prefixes like "HE" for "HELP-QUIET" can no longer suppress natural language text that happens to share the prefix. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
Thank you for the contribution. This fix landed with contributor co-authorship preserved in #100258 ( I consolidated the source fixes into a maintainer takeover because the contributor branches were based on rewritten pre- |
Fixes #99982
What Problem This Solves
isSilentReplyPrefixTextnever matches custom silent tokens containing digits or punctuation (e.g.,NO_REPLY2,HELP-QUIET). The character guard/[^A-Z_]/.test(normalized)rejects any input containing non-letter chars, causing streamed prefix detection to fail for custom tokens with digits/hyphens.Why This Change Was Made
The guard checked the input fragment instead of the token. Custom tokens with non-letter chars cannot be mistaken for natural language, so their prefixes are safe once the prefix includes a non-letter char from the token.
User Impact
Before: custom silent tokens like
"NO_REPLY2"never match in the streaming prefix matcher.After: prefix fragments containing a non-letter character from the token (e.g.,
"NO_"for"NO_REPLY2","HELP-"for"HELP-QUIET") are correctly recognized. Pure-letter prefixes like"HE"for"HELP-QUIET"are still rejected.Real behavior proof
fix/silent-prefix-digits-99982Console output from self-contained Node script simulating character-by-character streaming:
Unit tests:
NO_REPLY2: MATCH at "NO_" (underscore triggers)HELP-QUIET: MATCH at "HELP-" (hyphen triggers); pure-letter "HE","HEL","HELP" correctly rejectedSILENT42: MATCH at "SILENT4" (digit triggers); pure-letter "SILENT" correctly rejectedNO_REPLYpreservedEvidence
src/auto-reply/tokens.tssrc/auto-reply/tokens.test.ts(43 pass)git diff --numstat: 2 files changed, 44 insertions(+), 1 deletion(-)AI Assistance
This commit was co-authored with AI. The AI implemented the fix, tests, and PR description under human supervision.