Skip to content

fix(auto-reply): strip stray punctuation before silent-reply token detection - #98224

Merged
steipete merged 5 commits into
openclaw:mainfrom
SunnyShu0925:fix/no-reply-sentinel-punctuation-98166
Jul 3, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
SunnyShu0925:fix/no-reply-sentinel-punctuation-98166

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

When a model emits .NO_REPLY or *NO_REPLY* instead of bare NO_REPLY, the silent-reply sentinel leaks as visible prose because the regex only matches token-only text with optional whitespace.

  • Problem: Stray punctuation around NO_REPLY (e.g. .NO_REPLY, *NO_REPLY*, .NO_REPLY) bypasses isSilentReplyText(), causing the sentinel to leak to the channel as visible content.
  • Solution: Try exact regex match first, then fall back to a whitespace-trimmed, edge-punctuation-stripped match. Uses \p{P} (Unicode punctuation) to avoid stripping emoji. Preserves exact custom-token semantics.
  • What changed: src/auto-reply/tokens.ts (new stripEdgePunct() helper + exact-first-then-fallback), src/auto-reply/tokens.test.ts (new test cases)
  • What did NOT change: Mixed-content detection; JSON-envelope or reasoning-prefixed paths; heartbeat token handling

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Motivation

The NO_REPLY sentinel is used by auto-reply to suppress silent model output. When the model adds stray punctuation — a common hallucination pattern — the sentinel leaks as visible text, causing user confusion.

Evidence

  • Behavior addressed: Token-only NO_REPLY with leading/trailing punctuation (with or without surrounding whitespace) is now suppressed instead of leaking
  • Real environment tested: Linux, Node 22, branch fix/no-reply-sentinel-punctuation-98166
  • Exact steps or command run after this patch:
$ node --import tsx -e "import { isSilentReplyText } from ".""/src/auto-reply/tokens.ts"; [".NO_REPLY","*NO_REPLY*"," .NO_REPLY ","😄 NO_REPLY","NO_REPLY","the sentinel is NO_REPLY, fyi"].forEach(c => console.log(JSON.stringify(c) + "\t" + isSilentReplyText(c)))"

$ pnpm vitest run src/auto-reply/tokens.test.ts src/auto-reply/reply/reply-utils.test.ts --run
  • Evidence after fix:
Input                          => isSilentReplyText
"NO_REPLY"                     => true   (unchanged)
".NO_REPLY"                    => true   (was false — fixed)
"*NO_REPLY*"                   => true   (was false — fixed)
" .NO_REPLY "                  => true   (was false — fixed)
"😄 NO_REPLY"                  => false  (emoji preserved)
"the sentinel is NO_REPLY, fyi" => false  (unchanged)
"*SILENT*" (custom token)      => true   (custom-token preserved)

 Test Files  2 passed (2)
      Tests  122 passed (122)
  • Observed result after fix: Punctuation-wrapped NO_REPLY variants (including with surrounding whitespace) are correctly suppressed; custom punctuation-edged tokens still work; emoji-mixed content unaffected.
  • What was not tested: Real channel E2E flow; JSON-envelope or reasoning-prefixed silent replies (separate matchers, unchanged)

Root Cause (if applicable)

In src/auto-reply/tokens.ts, getSilentExactRegex() generates /^\s*NO_REPLY(?:\s+NO_REPLY)*\s*$/i which requires token-only text with optional whitespace. Any stray punctuation causes the match to fail.

User-visible / Behavior Changes

Fewer false negatives: model output consisting only of NO_REPLY with stray punctuation is now correctly suppressed instead of leaking.

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Best-fix Verdict

  • Best fix: Yes. Minimal, Unicode-safe, preserves exact custom-token matching via exact-first ordering.
  • Refactor needed: No
  • Alternative considered: [^\p{L}\p{N}] — rejected because emoji would be stripped; direct regex modification — rejected due to pattern proliferation.

AI Assistance 🤖

  • AI-assisted: Yes
  • Co-Authored-By: Claude [email protected]
  • Human confirmed understanding of code changes: Yes

Risks and Mitigations

  • Highest risk area: Exported SDK helper (isSilentReplyText is in plugin-sdk/reply-chunking) behavior broadens slightly.
  • Mitigation: Only edge punctuation stripped after trim; exact match tried first so custom tokens preserved; existing mixed-content guard unchanged.
  • Compatibility: Fully backward compatible for common usage.

Related to #98166

@clawsweeper

clawsweeper Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 3, 2026, 5:19 PM ET / 21:19 UTC.

Summary
The branch adds edge-punctuation normalization to isSilentReplyText() and regression tests for punctuation-wrapped NO_REPLY plus custom-token boundaries.

PR surface: Source +9, Tests +31. Total +40 across 2 files.

Reproducibility: yes. Current main's exact matcher rejects punctuation-wrapped token-only replies by source inspection, and Mantis Telegram Desktop proof shows a baseline .NO_REPLY leak with the candidate suppressing the reply.

Review metrics: 1 noteworthy metric.

  • Exported helper behavior: 1 helper broadened. isSilentReplyText() is exported through plugin SDK subpaths, so a matcher tweak is also an external compatibility decision.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #98166
Summary: This PR is a candidate fix for the canonical punctuation-wrapped token-only silent-reply leak; the older matcher PR and broader mixed-content issue overlap but do not replace it.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

Risk before merge

  • [P1] Merging this PR broadens an exported plugin SDK helper, so callers that currently see punctuation-wrapped token-only text as deliverable will instead classify it as silent.
  • [P1] The same classifier feeds reply normalization and channel delivery, so this is a message-suppression policy change even though the code diff is small.
  • [P1] The branch overlaps fix(auto-reply): suppress silent tokens with trailing punctuation or quotes #93510; maintainers should choose one shared punctuation policy or explicitly supersede one PR before landing.

Maintainer options:

  1. Coordinate One Matcher Policy (recommended)
    Before merge, maintainers should choose whether this broader branch supersedes, folds in, or replaces fix(auto-reply): suppress silent tokens with trailing punctuation or quotes #93510 so only one SDK-visible silent-token contract ships.
  2. Accept The Broadened Helper Contract
    Maintainers may land this PR after explicitly accepting that punctuation-wrapped token-only replies are now silent for both internal delivery and exported SDK consumers.
  3. Pause For Contract Direction
    If the supported punctuation set is still unsettled, keep the canonical issue open and pause both matcher PRs until the product contract is decided.

Next step before merge

  • [P2] Human maintainer review should accept the SDK-visible matcher semantics and decide how to supersede or fold in the overlapping open PR; there is no narrow mechanical repair for automation.

Security
Cleared: The diff only changes TypeScript silent-token matching and tests; it adds no dependency, workflow, secret, package-resolution, network, or code-execution surface.

Review details

Best possible solution:

Land one coordinated shared matcher policy, preferably by accepting this broader edge-punctuation behavior or folding it with the narrower open PR, while preserving substantive-reply guards and exact custom-token matches.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main's exact matcher rejects punctuation-wrapped token-only replies by source inspection, and Mantis Telegram Desktop proof shows a baseline .NO_REPLY leak with the candidate suppressing the reply.

Is this the best way to solve the issue?

Yes for the implementation boundary: the shared classifier is the right place, and the patch preserves substantive-reply and exact custom-token guards. The unresolved part is maintainer acceptance of the exported helper contract and coordination with the overlapping open PR.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7d593bb9ae54.

Label changes

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR body includes after-fix helper output and Mantis Telegram Desktop screenshots show baseline .NO_REPLY leaking while the candidate stays silent.

Label justifications:

  • P2: This is a normal-priority user-visible message-delivery bugfix with narrow code scope but SDK-visible semantics.
  • merge-risk: 🚨 compatibility: The PR changes behavior of an exported plugin SDK helper that external consumers can call directly.
  • merge-risk: 🚨 message-delivery: The changed matcher controls whether punctuation-wrapped silent-token replies are delivered or suppressed across channel paths.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The PR body includes after-fix helper output and Mantis Telegram Desktop screenshots show baseline .NO_REPLY leaking while the candidate stays silent.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix helper output and Mantis Telegram Desktop screenshots show baseline .NO_REPLY leaking while the candidate stays silent.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR body includes after-fix helper output and Mantis Telegram Desktop screenshots show baseline .NO_REPLY leaking while the candidate stays silent.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The shared matcher affects visible Telegram chat delivery and the existing Mantis proof path can demonstrate the behavior in a short Telegram Desktop recording.
Evidence reviewed

PR surface:

Source +9, Tests +31. Total +40 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 10 1 +9
Tests 1 31 0 +31
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 41 1 +40

What I checked:

  • Repository policy read: Root review policy was read fully; no scoped AGENTS.md exists for src/auto-reply, and the root policy makes plugin SDK and message-delivery behavior compatibility-sensitive. (AGENTS.md:1, 7d593bb9ae54)
  • Current main still uses strict exact matching: Current main builds ^\s*TOKEN(?:\s+TOKEN)*\s*$ and isSilentReplyText() returns only that exact regex result, so punctuation-wrapped token-only replies are not already fixed on main. (src/auto-reply/tokens.ts:29, 7d593bb9ae54)
  • PR implementation boundary: The PR adds stripEdgePunctuation() and retries the existing exact matcher after trimming and stripping edge Unicode punctuation, while preserving the exact match path first. (src/auto-reply/tokens.ts:42, 2541bf7b7f28)
  • PR regression coverage: The PR adds tests for leading, trailing, both-sided, quoted, and whitespace-wrapped punctuation around token-only text, plus exact punctuation-edged custom tokens. (src/auto-reply/tokens.test.ts:109, 2541bf7b7f28)
  • Shared delivery caller: normalizeReplyPayload() drops a reply when isSilentReplyPayloadText() succeeds, so the matcher affects visible delivery rather than only local parsing. (src/auto-reply/reply/normalize-reply.ts:60, 7d593bb9ae54)
  • Exported SDK surface: isSilentReplyText and isSilentReplyPayloadText are exported through the reply-chunking plugin SDK subpath, making the behavior change compatibility-sensitive. (src/plugin-sdk/reply-chunking.ts:12, 7d593bb9ae54)

Likely related people:

  • aldoeliacim: Authored the merged whole-text-only isSilentReplyText fix that established the exact-token boundary this PR broadens. (role: strict matcher contributor; confidence: high; commits: 2f2110a32cfe, 97fa44dc8263; files: src/auto-reply/tokens.ts, src/auto-reply/tokens.test.ts)
  • obviyus: Merged the strict matcher PR and authored adjacent silent-token semantics work on the same helper surface. (role: strict matcher merger and adjacent contributor; confidence: high; commits: e64d72299e06, 133f14c0af92, 0817bf446fdc; files: src/auto-reply/tokens.ts, src/auto-reply/tokens.test.ts)
  • vincentkoc: Recently touched the same silent-reply classifier family and release history around quoted silent replies and SDK seams. (role: recent area contributor; confidence: medium; commits: 96c6f8022c24, e085fa1a3ffd; files: src/auto-reply/tokens.ts, src/plugin-sdk/reply-chunking.ts)
  • frankekn: Authored prior merged leading-token and reply-normalization hardening around NO_REPLY leakage. (role: silent-token hardening contributor; confidence: high; commits: 153e3add6885; files: src/auto-reply/tokens.ts, src/auto-reply/reply/normalize-reply.ts)
  • steipete: Assigned the PR, force-pushed the latest test-tightening commit, and has earlier main-history work on NO_REPLY filtering and auto-reply delivery paths. (role: current reviewer and adjacent contributor; confidence: medium; commits: 2541bf7b7f28, 96e17d407aff, a6a742f3d067; files: src/auto-reply/tokens.ts, src/auto-reply/tokens.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jun 30, 2026
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 1, 2026
@clawsweeper
clawsweeper Bot temporarily deployed to qa-live-shared July 1, 2026 01:30 Inactive
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 1, 2026
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 1, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 1, 2026
@openclaw-mantis

Copy link
Copy Markdown
Contributor

Mantis Telegram Desktop Proof

Summary: Mantis captured native Telegram Desktop before/after GIFs showing main leaking .NO_REPLY and this PR suppressing it.

Main screenshot This PR screenshot
Baseline native Telegram Desktop screenshot Candidate native Telegram Desktop screenshot
Main This PR
Baseline native Telegram Desktop proof GIF Candidate native Telegram Desktop proof GIF

Motion-trimmed clips:

Raw QA files: https://artifacts.openclaw.ai/mantis/telegram-desktop/pr-98224/run-28487170951-1/index.json

SunnyShu0925 and others added 5 commits July 3, 2026 22:13
…en detection

When the model emits .NO_REPLY or *NO_REPLY* instead of bare NO_REPLY,
isSilentReplyText() failed to detect it because the regex requires
the text to consist only of the token with optional whitespace.

Add stripEdgeNonAlnum() that strips leading/trailing non-letter,
non-number characters (Unicode-aware) before the regex test. This
catches stray punctuation while preserving the existing safeguard
against suppressing mixed-content text.

Related to openclaw#98166

Co-Authored-By: Claude <[email protected]>
Change stripEdgeNonAlnum to stripEdgePunct: strip only punctuation (\p{P}) instead of all non-letter/non-number characters. Emoji would be stripped by the former, causing false silent-reply on mixed content.

Related to openclaw#98166

Co-Authored-By: Claude <[email protected]>
…zation

Try exact regex match first, then fall back to stripEdgePunct.
This preserves exact matching for custom tokens whose first/last
character is punctuation (e.g. *SILENT*, #QUIET#), while still
catching the common case of NO_REPLY wrapped in stray punctuation.

Add regression test for punctuation-edged custom tokens.

ClawSweeper: openclaw#98224 (comment)

Related to openclaw#98166

Co-Authored-By: Claude <[email protected]>
Trim whitespace before stripping edge punctuation in the fallback
path so variants like " .NO_REPLY " and "NO_REPLY. " are also
caught by the silent-reply detector.

Add regression coverage for whitespace-wrapped edge punctuation.

ClawSweeper: openclaw#98224 (comment)

Related to openclaw#98166

Co-Authored-By: Claude <[email protected]>
@steipete
steipete force-pushed the fix/no-reply-sentinel-punctuation-98166 branch from 4099eb6 to 2541bf7 Compare July 3, 2026 21:13
@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Jul 3, 2026
@steipete

steipete commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Land-ready proof for exact head 2541bf7b7f286123d2650b7ebf81e07569a52d66:

  • Kept one canonical NO_REPLY matcher shared by reply flow and Slack block suppression. It now accepts whitespace/punctuation-wrapped sentinels while preserving symbols and emoji as substantive content; added negative guards for 💬NO_REPLY and NO_REPLY👍.
  • Focused production-path proof: node scripts/run-vitest.mjs src/auto-reply/tokens.test.ts src/auto-reply/reply/reply-flow.test.ts extensions/slack/src/send.blocks.test.ts — 97 tests passed.
  • Native Telegram before/after proof: Mantis run and screenshots, with artifact manifest. Current main leaked .NO_REPLY; this production matcher suppressed it. The later fixup only tightened tests/comments around the same matcher behavior.
  • Fresh local and full-branch autoreviews: no actionable findings.
  • Repo-native review artifacts validated; exact-head hosted CI is green.

No remaining proof gaps found. Ready to merge.

@steipete
steipete merged commit 19d621e into openclaw:main Jul 3, 2026
115 of 117 checks passed
@steipete

steipete commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 4, 2026
…tection (openclaw#98224)

* [AI] fix(auto-reply): strip stray punctuation before silent-reply token detection

When the model emits .NO_REPLY or *NO_REPLY* instead of bare NO_REPLY,
isSilentReplyText() failed to detect it because the regex requires
the text to consist only of the token with optional whitespace.

Add stripEdgeNonAlnum() that strips leading/trailing non-letter,
non-number characters (Unicode-aware) before the regex test. This
catches stray punctuation while preserving the existing safeguard
against suppressing mixed-content text.

Related to openclaw#98166

Co-Authored-By: Claude <[email protected]>

* [AI] fix: strip only punct not emoji before silent-reply detection

Change stripEdgeNonAlnum to stripEdgePunct: strip only punctuation (\p{P}) instead of all non-letter/non-number characters. Emoji would be stripped by the former, causing false silent-reply on mixed content.

Related to openclaw#98166

Co-Authored-By: Claude <[email protected]>

* [AI] fix: preserve exact custom-token match before edge-punct normalization

Try exact regex match first, then fall back to stripEdgePunct.
This preserves exact matching for custom tokens whose first/last
character is punctuation (e.g. *SILENT*, #QUIET#), while still
catching the common case of NO_REPLY wrapped in stray punctuation.

Add regression test for punctuation-edged custom tokens.

ClawSweeper: openclaw#98224 (comment)

Related to openclaw#98166

Co-Authored-By: Claude <[email protected]>

* [AI] fix: handle whitespace-wrapped punctuation in silent-reply fallback

Trim whitespace before stripping edge punctuation in the fallback
path so variants like " .NO_REPLY " and "NO_REPLY. " are also
caught by the silent-reply detector.

Add regression coverage for whitespace-wrapped edge punctuation.

ClawSweeper: openclaw#98224 (comment)

Related to openclaw#98166

Co-Authored-By: Claude <[email protected]>

* test(auto-reply): tighten silent-token boundaries

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
zeekay pushed a commit to hanzoai/bot that referenced this pull request Sep 11, 2026
…tection (#98224)

* [AI] fix(auto-reply): strip stray punctuation before silent-reply token detection

When the model emits .NO_REPLY or *NO_REPLY* instead of bare NO_REPLY,
isSilentReplyText() failed to detect it because the regex requires
the text to consist only of the token with optional whitespace.

Add stripEdgeNonAlnum() that strips leading/trailing non-letter,
non-number characters (Unicode-aware) before the regex test. This
catches stray punctuation while preserving the existing safeguard
against suppressing mixed-content text.

Related to #98166

Co-Authored-By: Claude <[email protected]>

* [AI] fix: strip only punct not emoji before silent-reply detection

Change stripEdgeNonAlnum to stripEdgePunct: strip only punctuation (\p{P}) instead of all non-letter/non-number characters. Emoji would be stripped by the former, causing false silent-reply on mixed content.

Related to #98166

Co-Authored-By: Claude <[email protected]>

* [AI] fix: preserve exact custom-token match before edge-punct normalization

Try exact regex match first, then fall back to stripEdgePunct.
This preserves exact matching for custom tokens whose first/last
character is punctuation (e.g. *SILENT*, #QUIET#), while still
catching the common case of NO_REPLY wrapped in stray punctuation.

Add regression test for punctuation-edged custom tokens.

ClawSweeper: openclaw/openclaw#98224 (comment)

Related to #98166

Co-Authored-By: Claude <[email protected]>

* [AI] fix: handle whitespace-wrapped punctuation in silent-reply fallback

Trim whitespace before stripping edge punctuation in the fallback
path so variants like " .NO_REPLY " and "NO_REPLY. " are also
caught by the silent-reply detector.

Add regression coverage for whitespace-wrapped edge punctuation.

ClawSweeper: openclaw/openclaw#98224 (comment)

Related to #98166

Co-Authored-By: Claude <[email protected]>

* test(auto-reply): tighten silent-token boundaries

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
zeekay pushed a commit to hanzoai/bot that referenced this pull request Sep 11, 2026
…tection (#98224)

* [AI] fix(auto-reply): strip stray punctuation before silent-reply token detection

When the model emits .NO_REPLY or *NO_REPLY* instead of bare NO_REPLY,
isSilentReplyText() failed to detect it because the regex requires
the text to consist only of the token with optional whitespace.

Add stripEdgeNonAlnum() that strips leading/trailing non-letter,
non-number characters (Unicode-aware) before the regex test. This
catches stray punctuation while preserving the existing safeguard
against suppressing mixed-content text.

Related to #98166

Co-Authored-By: Claude <[email protected]>

* [AI] fix: strip only punct not emoji before silent-reply detection

Change stripEdgeNonAlnum to stripEdgePunct: strip only punctuation (\p{P}) instead of all non-letter/non-number characters. Emoji would be stripped by the former, causing false silent-reply on mixed content.

Related to #98166

Co-Authored-By: Claude <[email protected]>

* [AI] fix: preserve exact custom-token match before edge-punct normalization

Try exact regex match first, then fall back to stripEdgePunct.
This preserves exact matching for custom tokens whose first/last
character is punctuation (e.g. *SILENT*, #QUIET#), while still
catching the common case of NO_REPLY wrapped in stray punctuation.

Add regression test for punctuation-edged custom tokens.

ClawSweeper: openclaw/openclaw#98224 (comment)

Related to #98166

Co-Authored-By: Claude <[email protected]>

* [AI] fix: handle whitespace-wrapped punctuation in silent-reply fallback

Trim whitespace before stripping edge punctuation in the fallback
path so variants like " .NO_REPLY " and "NO_REPLY. " are also
caught by the silent-reply detector.

Add regression coverage for whitespace-wrapped edge punctuation.

ClawSweeper: openclaw/openclaw#98224 (comment)

Related to #98166

Co-Authored-By: Claude <[email protected]>

* test(auto-reply): tighten silent-token boundaries

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants