Skip to content

Unexpected behavior: isSilentReplyPrefixText never matches custom silent tokens containing digits/punctuation #99982

Description

@devin-ai-integration

What happened

isSilentReplyPrefixText guards streamed silent-token prefixes (so a transient "NO" fragment from a streaming NO_REPLY is suppressed). But the character guard rejects any normalized fragment containing characters outside A-Z_:

if (normalized.length < 2) {
return false;
}
if (/[^A-Z_]/.test(normalized)) {
return false;
}
const tokenUpper = token.toUpperCase();
if (!tokenUpper.startsWith(normalized)) {
return false;
}
if (normalized.includes("_")) {
return true;
}
// Keep underscore guard for generic tokens to avoid suppressing unrelated
// uppercase words (e.g. HEART/HE with HEARTBEAT_OK). Only allow bare "NO"
// because NO_REPLY streaming can transiently emit that fragment.
return tokenUpper === SILENT_REPLY_TOKEN && normalized === "NO";

if (/[^A-Z_]/.test(normalized)) {
  return false;
}

So for any custom silent token containing a digit or hyphen (the rest of the tokens API takes an arbitrary token parameter, and comments in the same file explicitly mention custom-token support), streamed prefix fragments like "NOREPLY2"/"NO-ANSWER" prefixes can never match — prefix suppression silently never engages for those tokens, while full-token suppression (isSilentReplyText) does.

Expected

The prefix check should be derived from the configured token's alphabet (e.g. test tokenUpper.startsWith(normalized) against a normalization that permits the token's own characters), not a hard-coded A-Z_ class.

Impact

Deployments using a custom silent-reply token with digits/punctuation get inconsistent behavior: complete tokens are suppressed but streamed prefixes leak to the channel.

Environment

Current main (4287d26).

Found via source review (AI-assisted).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions