feat(pull-requests): link a PR to its thread from the PR action menu - #8488
feat(pull-requests): link a PR to its thread from the PR action menu#8488mfattakhov wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
There was a problem hiding this comment.
Two findings on the new thread link/unlink menu items in PullRequestDetailPanel: the capability gate that this PR adds to state/entities.ts is never applied, and the "already linked" test uses strict URL equality instead of the shared change-request URL match used by the other link surface. Details inline.
Posted via Macroscope — UI Consistency
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This adds a new production Link/Unlink workflow that persists thread metadata and changes how linked threads are represented and settled when the PR changes state. The implementation is localized and reuses existing infrastructure, but the new capability and lifecycle impact exceed a routine UI-only change. You can add or adjust custom eligibility rules. Learn more. |
3f5b329 to
2c0f115
Compare
|
Both findings were real and are fixed in Capability gate. The link/unlink items now render only when the thread's environment reports Match too strict. |
2c0f115 to
efde976
Compare
|
Two more findings from the second pass, both fixed in
The "Link menu skips capability gate" comment re-anchored onto the new commit but its cited locations still point at |
efde976 to
0aea50a
Compare
|
All bot checks are green on this branch. The remaining approvability note was about coverage, so |
0aea50a to
f836754
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f836754b596fa9e03a84166b830dfbee27f88d7a. Configure here.
A thread could already be linked to a pull request, but only from the thread side. Standing in the PR detail panel — the place you land from the PR list or from a review notification — there was no way to say "this PR belongs to that thread", and after unlinking there was no way back at all. Add link and unlink entries to the PR action menu, driven by the open thread rather than the handoff attach target. Gating on the attach target would strand the reader: once they unlink, the thread stops matching the PR by branch, the panel falls back to page context, and the way back would vanish with it.
|
Fixed in |
f836754 to
aec1a54
Compare
|
Superseded by #10839, which landed link/unlink in the PR More menu (and multi-PR linking). Closing this earlier single-link menu attempt as superseded. |

A thread can be linked to a pull request, but only from the thread side. Standing in the PR detail panel — the place you land from the PR list, from the sidebar PR row, or from a review notification — there is no way to say "this PR belongs to that thread". After unlinking there is no way back at all, because the panel's link affordance was gated on the handoff attach target: once you unlink, the thread stops matching the PR by branch, the panel falls back to page context, and the entry point disappears with it.
This adds link and unlink entries to the PR action menu, driven by the open thread rather than by the attach target, so the entry stays put across link/unlink cycles. It reuses
thread.meta.updatethrough a smalluseThreadPullRequestLinkActionshook — no new command, no contract change.Why it is worth having: any workflow where the branch a thread worked on is not the branch the PR ends up on — stacked branches, GitButler virtual branches, squash-and-rename flows — makes branch matching miss, so the thread and its PR drift apart. Linking from the PR side is the one place the association is obvious, and it is also what makes the thread settle when the PR merges. Today the only fix is to go find the thread, and a single accidental unlink removes the affordance entirely, which is a one-way door.
Model: Claude Opus 5 (1M context), harness: Claude Code.
Note
Low Risk
UI-only, capability-gated metadata updates through an existing command; no contract or auth changes.
Overview
Adds link / unlink pull request actions to the PR detail panel’s overflow menu when a real thread is open beside the panel and the server advertises
threadPullRequestLinking.Linking keys off the open thread (
composerDraftTarget), not the handoff attach target, so the menu stays available after unlink when branch-based matching would drop the panel back to page context.A new
useThreadPullRequestLinkActionshook is the dedicated path to set or clearlinkedPullRequestviathread.meta.update. The panel serializes in-flight link/unlink with pending state (stable labels, disabled item), gates on server capability, and shows success/error toasts (suppressing errors for interrupted commands).isThreadLinkedToPullRequestinpullRequestDetail.logicdecides Link vs Unlink usingmatchesLinkedPullRequestUrlplus an exact URL/number fallback for hosts the parser cannot match; unit tests cover subpages, wrong PR numbers, and self-hosted URLs.Reviewed by Cursor Bugbot for commit aec1a54. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add link/unlink thread actions to
PullRequestDetailPanelmenuthreadPullRequestLinkingcapabilityisThreadLinkedToPullRequestin pullRequestDetail.logic.ts to detect the linked state via tolerant URL matching, with strict-equality fallback for unparseable hostsuseThreadPullRequestLinkActionshook in useThreadPullRequestLink.ts which updateslinkedPullRequestin thread metadata throughupdateMetadata, suppressing error toasts for interrupted commands and blocking concurrent operations with pending statethreadPullRequestLinkingserver config is enabled; existing panels without a concrete thread context show no new itemsMacroscope summarized aec1a54.