cmux NEXT: bare PR refs in agent replies link to the PR with its hover card
Merged
TE
17d ago+386+386+012345678901234567890123456789-8-8-0123456789
In progress: stacked on #22743 (it targets cmux/pr-hover-card until that merges, then feat-cmux-next). Review and merge after #22743 lands.
Stacked on #22743 (cmux/pr-hover-card), which adds the pull request hover card.
Summary
- A bare pull request reference in an agent reply (
#22777,(#22664),owner/repo#123) now links togithub.com/{repo}/pull/N, so its chip opens the pull request hover card. If the number is an issue, GitHub redirects to it, and the card showsowner/repo#N. - The repository comes from the chat folder's GitHub remote, as before. When the folder has no remote (remote and cloud chats, folders without one), each row uses the repository the transcript mentioned most recently up to that row (an
owner/repo#Nreference or a github.com URL in a prompt or reply). If there is none, it uses the repository of the header's pull request. Mentions inside code don't count. Each row's text is scanned once per change, not once per render. - Matcher fixes:
#0, leading zeros (#012) and HTML entities ({) no longer link. - Code spans and fenced blocks never link; a test now pins this.
- The markdown file editor keeps its
/issues/Nlinks. The URL kind is a new parameter whose default isissues.
Testing
timeout 150 bun test src/githubReferences.test.ts: table-driven matcher cases,mentionedRepositoryandlatestMentionedRepository. Red at 67b8ed7 (11 fail, 17 pass); green at f1480fb (28 pass).timeout 150 bun test test/bare-pr-refs.test.tsx: a rendered bare#634gets a chip linking to/pull/634whose hover opens the PR card; a code span or fence produces no chip; the fallback repository from the transcript; and the header fallback plus per-row cache. Red at 67b8ed7 (4 fail); green at f1480fb (4 pass).test/pr-hover-card.test.tsxandchips/githubRef.test.tsstill pass.vp checkis clean.test/gallery-coverage.test.tsfails onpages/apps/CloudFeature.tsx#CloudFeature. That failure comes from the base branch (#22772), not this PR.- I didn't dogfood this in a tagged build.
Changelog
- Added: Bare pull request references like
#123in agent replies link to the pull request and show its hover card, using the repository the chat last mentioned when the folder has no GitHub remote.
🤖 Generated with Claude Code
Agent session: cosmic-gray
Summary by cubic
Bare pull request references (#123, owner/repo#123) in agent replies now link to github.com/{repo}/pull/N instead of /issues/N, so their chips open the pull request hover card (issue numbers redirect there too).
Repository fallback
- Without the chat folder's GitHub remote, each row uses the repository the transcript mentioned most recently up to that row, else the header pull request's; each row's text is scanned once per change.
- Mentions inside code spans and fenced blocks never count; github.com's own pages (
login/device,settings/tokens) don't count either.
Matcher fixes
#0, leading zeros (#012), HTML entities ({), and numbers longer than ten digits no longer link.- The markdown file editor keeps its
/issues/Nlinks via a new link-kind parameter.