Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

fix(sessions): highlight every skill chip in submitted prompts - #3271

Closed
adboio wants to merge 2 commits into
mainfrom
posthog-code/highlight-all-skill-chips
Closed

fix(sessions): highlight every skill chip in submitted prompts#3271
adboio wants to merge 2 commits into
mainfrom
posthog-code/highlight-all-skill-chips

Conversation

@adboio

@adboio adboio commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Problem

Reported in Slack: once a prompt is submitted, only the first skill in the prompt keeps its chip highlight — later skills render as plain text. In the input box, all of them are highlighted. This is a purely cosmetic inconsistency in how a submitted user message is rendered in the thread.

Changes

Submitted prompts flatten their <skill … /> tags to plain /name text before the thread renders them, but the rendered-message chip parser (parseFileMentions.tsx) only matched a slash command anchored to the very start of the string (a non-global regex used with a single .match()). Any second-or-later /skill fell through to plain markdown.

The parser now scans for every slash command with a global, non-anchored regex and merges those matches with the existing mention-tag matches (files, folders, GitHub refs, error context), sorted by position, so each chip renders regardless of order.

How did you test this?

Added parseFileMentions.test.tsx covering multiple slash commands, non-leading commands, mid-word slashes (not matched), and slash commands interleaved with file mentions. Ran:

  • vitest run parseFileMentions — 6 passed
  • vitest run UserMessage — 5 passed (existing suite still green)
  • biome lint on the changed files — clean

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog from a Slack thread

Submitted prompts flatten their <skill /> tags to plain /name text before the
thread renders them, but the rendered-message chip parser only matched a slash
command anchored to the very start of the string (a non-global `/^\/.../ ` used
with a single `.match()`). Any second or later /skill fell through to plain text,
so only the first skill in a multi-skill prompt got a chip — even though the live
input box highlights them all.

Scan for every slash command with a global, non-anchored regex and merge those
matches with the existing mention-tag matches (sorted by position) so each
/skill, file, folder, and GitHub ref renders its chip regardless of order.

Generated-By: PostHog Code
Task-Id: 26ac46b1-6c16-4112-ae2a-ddc60b56f1c0
@trunk-io

trunk-io Bot commented Jul 8, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 29ac074.

The quality check runs `biome ci`, which includes formatting. Collapse the
multi-line import in the new test to a single line so formatting passes.

Generated-By: PostHog Code
Task-Id: 26ac46b1-6c16-4112-ae2a-ddc60b56f1c0
@charlesvien charlesvien added the stale No recent changes to PR label Jul 22, 2026
@charlesvien

Copy link
Copy Markdown
Member

Closing stale PRs ahead of Friday's monorepo migration. If this is a mistake, rebase and reopen for review.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

stale No recent changes to PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants