Skip to content

fix(web): keep linked PR handoffs in current thread - #9079

Closed
t3-code[bot] wants to merge 2 commits into
mainfrom
fix/pr-handoffs-current-thread
Closed

t3-code[bot] wants to merge 2 commits into
mainfrom
fix/pr-handoffs-current-thread

Conversation

@t3-code

@t3-code t3-code Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

summary

  • treat an explicitly linked pull request as the thread's own even when its persisted project id differs from the currently open PR surface
  • keep repository and PR number matching strict, so an unrelated PR or a second inferred checkout still opens a separate thread
  • restore the shared current-composer path used by every PR agent handoff: fix check, fix finding(s), resolve conflicts, ask, explain, and selected diff requests

verification

  • 296 pull request component tests passed
  • web typecheck passed
  • targeted lint and formatting passed
  • regression test proves every handoff retains the current composer after a linked project-id mismatch

request provenance


Note

Medium Risk
Changes ownership rules for PR panel context and composer routing; scoped to explicit links with strict repo/number checks, with regression tests added.

Overview
Fixes PR panel thread vs page context when a thread has an explicit persisted PR link but the live project id no longer matches the open right-panel surface (e.g. project recreated or remapped).

Adds pullRequestOwnershipCandidate to prefer the linked identity while inferred detail is missing, and extends isThreadOwnPullRequest with explicitlyLinked: match still requires the same repository and number, but project id is only required for inferred ownership—not for an explicit link.

ChatView wires the detail panel through that helper (inferred repo now uses activeProjectRepository). When ownership resolves to thread, agent handoffs keep the current composer target and in-thread labels instead of opening a separate thread.

Reviewed by Cursor Bugbot for commit c5a4bf4. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix linked PR handoffs to stay in current thread across project changes

  • Adds pullRequestOwnershipCandidate to choose between a persisted linked PR identity and an inferred one, tagging the result with explicitlyLinked
  • Updates isThreadOwnPullRequest to accept explicitlyLinked and return true when repository and number match, even if projectId differs from the panel surface
  • ChatViewContent now feeds both linked and inferred sources into ownership resolution via pullRequestOwnershipCandidate, so PullRequestDetailPanel.context evaluates to 'thread' when an explicit link exists
  • Risk: isThreadOwnPullRequest no longer requires projectId match for explicitly linked threads; callers that assumed a matching projectId always accompanies ownership may see different results in pullRequestDetail.logic.ts

Macroscope summarized c5a4bf4.

Co-authored-by: Bilal Bakr <62337003+Bil0000@users.noreply.github.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.2 KiB 13.3 KiB +65 B (+0.5%) 15.1 KiB
Codex Thread snapshot wire 6.9 KiB 6.9 KiB +6 B (+0.1%) 7.3 KiB
Codex Live turn WebSocket wire 6.3 KiB 6.4 KiB +59 B (+0.9%) 7.8 KiB
Codex Live turn WebSocket decoded 55.5 KiB 55.6 KiB +88 B (+0.2%) 66.4 KiB
Codex Live turn messages 8 10 +2 (+25.0%) 21
Claude Total thread wire 13.5 KiB 13.5 KiB −9 B (−0.1%) 15.1 KiB
Claude Thread snapshot wire 6.9 KiB 6.9 KiB −7 B (−0.1%) 7.3 KiB
Claude Live turn WebSocket wire 6.6 KiB 6.6 KiB −2 B (−0.0%) 7.8 KiB
Claude Live turn WebSocket decoded 57.8 KiB 57.8 KiB 0 B (0.0%) 66.4 KiB
Claude Live turn messages 10 10 0 (0.0%) 21

Baseline: 2d156a8 · PR result: c5a4bf4 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 109.4 KiB
  • Claude decoded thread snapshot: 110.1 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 93780c5. Configure here.

Comment thread apps/web/src/components/ChatView.tsx Outdated
Co-authored-by: Bilal Bakr <62337003+Bil0000@users.noreply.github.com>
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Sep 1, 2026
Comment thread apps/web/src/components/ChatView.tsx
@macroscopeapp

macroscopeapp Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at c5a4bf4

Macroscope's review found this PR approvable — This is a focused web bug fix that preserves strict repository and PR-number matching while keeping explicitly linked PR handoffs in the current thread after project changes. The affected routing logic is small and covered by targeted regression tests, with no schema, infrastructure, security, billing, or default-setting changes.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge

Copy link
Copy Markdown
Member

Closing as superseded by #12320, which is now merged and keeps PR panel actions (fix checks, findings, resolve conflicts, ask/explain, selected-code notes) in the current thread via full link-list context.

@juliusmarminge

Copy link
Copy Markdown
Member

Closing as superseded by #12320.

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant