Fix @mention search to use word-boundary prefix matching#278
Merged
wpfleger96 merged 3 commits intomainfrom Apr 9, 2026
Merged
Fix @mention search to use word-boundary prefix matching#278wpfleger96 merged 3 commits intomainfrom
wpfleger96 merged 3 commits intomainfrom
Conversation
558465b to
45de905
Compare
wesbillman
approved these changes
Apr 9, 2026
Collaborator
wesbillman
left a comment
There was a problem hiding this comment.
LGTM but fails some e2e tests
Collaborator
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Substring matching with includes() produced irrelevant results: typing @g matched "Will Pfleger" because "g" appears mid-word in "Pfleger", and @c matched any member whose name or pubkey contained "c" anywhere. Replaced the filter with a scoring function that splits labels on spaces, hyphens, and underscores, then checks whether any resulting word starts with the query. Results are ranked by match quality (full label prefix > word prefix > substring fallback > pubkey prefix) and sorted before the 8-item cap so the best matches always appear first.
Separate actual display name from pubkey fallback label so scoring doesn't match against 8-char truncated pubkeys. Add pubkey substring as lowest-priority fallback tier to restore includes() behavior. Also fix type predicate narrowing and filter empty split tokens.
45de905 to
b9d81f8
Compare
@g still matched "Will Pfleger" because "pfleger" contains "g" as a substring (score tier 2). Standard mention UX (Slack, Discord, GitHub) only matches word-boundary prefixes — no arbitrary mid-word substrings. Pubkey substring matching (tier 4) is kept since pubkeys are opaque strings where pasting a middle chunk is reasonable.
Collaborator
Author
wesbillman
approved these changes
Apr 9, 2026
tlongwell-block
added a commit
that referenced
this pull request
Apr 11, 2026
…ona-migration * origin/main: feat(desktop): add Pulse social notes surface (#296) Fix flaky desktop smoke tests (#294) Add agent lifecycle controls to channel members sidebar (#291) Update nest_agents.md tagging info (#292) feat: add Sprout nest — persistent agent workspace at ~/.sprout (#290) Fix auth and SSRF vulns (#261) Add per-agent MCP toolset configuration to agent setup (#279) feat(desktop): team & persona import/edit flows (#288) Remove menu item subtitles and fix persona card overflow (#289) feat: Phase 1 video upload support (Blossom-compliant-ish) (#285) Add inline subtitles to menu items and field descriptions (#276) Improve ephemeral channel affordances and hide archived sidebar rows (#286) Fix @mention search to use word-boundary prefix matching (#278) Allow bot owners to remove their agents from any channel (#284) [codex] Polish agent selectors and settings layout (#283) # Conflicts: # desktop/scripts/check-file-sizes.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This PR fixes
@mentionsearch to eliminate irrelevant results caused by substring matching on short queries.String.includes()matched any substring:@greturned "Will Pfleger" (the "g" in Pfleger), and@cmatched any member whose name or pubkey contained "c" anywhere.includes()filter inuseMentions.tswithscoreLabel(), which matches word-boundary prefixes only (no arbitrary mid-word substrings) — standard mention UX matching Slack/Discord/GitHub behavioras numbercast