Skip to content

Read a notification's code whole, and only when it starts by its keyword - #18556

Merged
omarchybot merged 1 commit into
quattrofrom
code-window-start
Nov 16, 2026
Merged

omarchybot merged 1 commit into
quattrofrom
code-window-start

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

A notification with the summary 123456 and the body Your verification code is 123456 offered two buttons, Copy 123456 and Copy 23456, and the second copied the code with its first digit gone. AB12CD34 over Use the sign-in code AB12CD34 offered Copy B12CD34 the same way, and a code that runs past the end of its keyword's window was copied short: 48291 from 48291375.

Detect.js looks for a code in a window around each code keyword, 24 characters before and 72 after. codes() cut each window out with slice() and matched the code shapes inside the piece, and the shapes' word-boundary checks treated the cut's edges as word edges. A number crossing the window's start was read from the cut onward, and one crossing its end up to the cut.

harvest() now matches over the whole text, so each shape's boundaries read the real characters on both sides and a code is taken whole. A match counts only when the code itself starts inside a window. A match that merely reaches into a window is not enough: 12345678 followed by twenty dots and code A9F3K2 would then offer 12345678, and since a numeric code wins over a letter-and-digit one, it would hide the real A9F3K2. The file's own rule is that a false positive is worse than a miss, so a number that only grazes a window's start is left out. Order, de-duplication, the year filter, the cap, the Do Not Disturb bypass on the first code and the redaction of stored rows are unchanged.

The new case in test/shell.d/notifications/logic.cjs checks all four texts above and fails on quattro, which offers 123456 23456, B12CD34 AB12CD34, 48291 and 5678. With this change it offers 123456, AB12CD34, 48291375 and A9F3K2. On a worker built from the Omarchy ISO with its shell serving this branch, each was sent with notify-send and its buttons pressed with omarchy-shell notifications invokeAction. On quattro the reported card's buttons copied 123456 and 23456; with this change it has one button, which copies 123456, and the long-code card copies 48291375 instead of 48291. Sign in over the same body still offers one button that copies 123456.

Not changed here: isProductName still reads only the 20 characters before Code, and codes and links are still read from the first 32K characters only.

Found by Prime's QA pass; matching over the whole text is their approach, narrowed here to codes that start inside a window. The other detector bug, a number the text says is not a code, is a separate fix.

Reviewed by Codex Medium, which found no defect and timed the scan on 32K hostile input well inside the existing budget; its independence is not guaranteed. A second panel reviewer, muse-wonder via pi, did not answer.

🤖 Generated by Opus 5.5 in Claude Code. Reviewed by Codex Medium.

Codes were matched inside a slice cut out around each keyword, and the slice's edges counted as word boundaries, so a number crossing a window's start was offered as its tail (23456) and one crossing its end was cut short (48291). Matching over the whole text reads each code to its real edges; keeping only matches whose code starts inside a window stops a number that merely grazes a window's start from being pulled in and outranking the real code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Detect.js now matches codes against the whole bounded text and keeps only codes that start inside a keyword window.

  • Notification cards copy whole codes that start near a code keyword.

omarchybot explicitly describes excluding codes that merely overlap a window as intentional.

Reviews (1) · Last reviewed commit: "Read a notification's code whole, and on..." · Reviewed by Greptile

@omarchybot
omarchybot merged commit 0a004aa into quattro Nov 16, 2026
3 checks passed
@omarchybot
omarchybot deleted the code-window-start branch November 16, 2026 07:45
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.

2 participants