Skip to content

fix: v1.7.4 — strip date stamps ("May 18") injected by chat UI into message body - #7

Merged
sbcmsbgithub merged 1 commit into
masterfrom
fix/strip-date-from-body
May 18, 2026
Merged

sbcmsbgithub merged 1 commit into
masterfrom
fix/strip-date-from-body

Conversation

@sbcmsbgithub

Copy link
Copy Markdown
Owner

Problem

Messages were being spoken as <firstname> <Month> <Day> <fullname> <message>, e.g.:

"Alice May 18 Alice Smith hello everyone"

Root cause

The chat UI injects a date string (e.g. May 18) directly into each app-st-compactmessage element's innerText, between the sender name and the message body. The existing regex set only strips HH:MM-style timestamps — month-name dates passed through untouched.

With the date sitting at the front of the body, stripSenderFromStart couldn't reach the duplicated sender name either, so both the date and the full name leaked into the spoken output.

Fix

Added DATE_RE:

const DATE_RE = /\b(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+\d{1,2}(?:,?\s*\d{4})?\b/gi;

Applied in three places — in the correct order (dates before sender strip):

  1. extractMessageFromRoot — after TS_BRACKET/TS_BARE, before stripSenderFromStart
  2. extractMessageGeneric — same
  3. normalizeMsg — safety net, also keeps the dedup key consistent

Result

"Alice: hello everyone"

Test plan

  • Observe a new message arrive — should hear only <name>: <message>, no date
  • Messages containing the word "May" in actual text (e.g. "it may work") should not be affected — the regex requires May followed by a 1–2 digit number

🤖 Generated with Claude Code

…ore speaking

The chat UI injects a date string into each message element's innerText.
This landed in the body after timestamp stripping, blocked the sender-name
strip, and caused spoken output like "Alice May 18 Alice Smith hello".

Added DATE_RE (/\b(?:Jan|Feb|...)\ +\d{1,2}(?:,?\s*\d{4})?\b/gi) applied in
extractMessageFromRoot, extractMessageGeneric, and normalizeMsg so dates are
removed before the sender strip runs and before the dedup key is computed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sbcmsbgithub
sbcmsbgithub merged commit 49f33f1 into master May 18, 2026
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.

1 participant