Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat: link pull requests to threads #8160

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 7 commits intomain fromrefs/pull/8160/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

PR links in chat could not be attached to their thread, so the sidebar missed them and merged PRs did not settle the thread.

Right-click a PR link and choose "Link to thread." The link appears in the sidebar, syncs across devices, and settles the thread when the PR merges. The same menu can remove the link.

Verified with 557 focused tests and type checks across contracts, client runtime, server, web, and mobile.

Built with GPT-5.6 Sol in the Codex harness.


Note

Medium Risk Adds persisted thread metadata, a DB migration, and changes how sidebar/chat resolve PR state and settlement; incorrect identity or reload handling could mis-settle threads or flash PR status.

Overview Threads can now persist a linked pull request via thread.meta.update, with a new threadPullRequestLinking server capability, projection column/migration 042, and shell/event plumbing end-to-end.

On web/desktop, right-clicking a PR URL in chat adds Link to thread / Unlink from thread, which updates thread metadata when the server supports linking. Sidebars and chat status stop relying only on local git for linked threads: they load live PR detail (with snapshot identity checks) so merge/close still drives auto-settle and indicators even when checkout/branch does not match.

Mobile thread list v2 mirrors that model—change-request cache entries carry a linked PR key, stale settlement is ignored after relink, and useThreadPr prefers linked PR detail over branch git status.

User docs note that linked PRs show in the sidebar and can settle on merge when auto-settle is enabled.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 5284bbd90d3e835fa5dcf75ebcd5314ab95f0fa3. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

  • Adds ThreadLinkedPullRequest schema and thread.meta.update support, along with migration 42 to persist linked_pull_request_json on ProjectionThreads.ts.
  • Server environment reports threadPullRequestLinking: true and propagates linked PR data through projection pipelines.
  • Web and mobile hooks like useLinkedThreadPullRequest fetch live PR details for linked threads, bypassing local git status inference.
  • Adds context menu actions in ChatMarkdown.tsx to link or unlink PR URLs to the current thread.
  • Risk: buildThreadListV2Items in threadListV2.ts ignores cached change request state if its linkedPullRequestKey does not match the current thread's linked PR, which prevents incorrect auto-settlement after relinking.
Macroscope summarized 5284bbd.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 81a60287-bca5-40a4-8091-1f7a998a9f43

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.3 KiB13.2 KiB−100 B (−0.7%)15.1 KiB✅
      CodexThread snapshot wire6.9 KiB6.9 KiB−3 B (−0.0%)7.3 KiB✅
      CodexLive turn WebSocket wire6.5 KiB6.4 KiB−97 B (−1.5%)7.8 KiB✅
      CodexLive turn WebSocket decoded55.6 KiB55.5 KiB−88 B (−0.2%)66.4 KiB✅
      CodexLive turn messages119−2 (−18.2%)21✅
      ClaudeTotal thread wire13.3 KiB13.4 KiB+25 B (+0.2%)15.1 KiB✅
      ClaudeThread snapshot wire6.9 KiB6.9 KiB−5 B (−0.1%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.4 KiB6.5 KiB+30 B (+0.5%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded56.4 KiB56.4 KiB0 B (0.0%)66.4 KiB✅
      ClaudeLive turn messages11110 (0.0%)21✅

      Baseline: c034f51 · PR result: 5284bbd · 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.

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This adds a new cross-layer workflow for linking pull requests to threads, including persistent schema/event changes, periodic external status refreshes, sidebar behavior, and automatic settlement. The breadth of runtime behavior and user-facing capability warrants human review.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High

      https://github.com/pingdotgg/t3code/blob/d0713665593e99127fa67291f516f766e7286f03/apps/web/src/components/ChatView.tsx#L6578

      The linked PR is classified as context: "page" when its projectId differs from activeProject?.id, so checkout UI appears and handoff actions open a new thread instead of using this thread's composer. Use linkedThreadPullRequest?.projectId in the isThreadOwnPullRequest comparison (along with its linked repository identity).

      🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
      In file @apps/web/src/components/ChatView.tsx around line 6578:
      
      The linked PR is classified as `context: "page"` when its `projectId` differs from `activeProject?.id`, so checkout UI appears and handoff actions open a new thread instead of using this thread's composer. Use `linkedThreadPullRequest?.projectId` in the `isThreadOwnPullRequest` comparison (along with its linked repository identity).
      
      Evidence trail:
      Reviewed commit d071366. `apps/web/src/components/ChatView.tsx:1804-1809` derives `activeProject` from `activeThread.projectId`; `apps/web/src/components/ChatView.tsx:3414-3416` uses the linked PR's repository identity; `apps/web/src/components/ChatView.tsx:6578-6592` compares ownership using `activeProject?.id`. `apps/web/src/components/ChatMarkdown.tsx:1557-1569` constructs linked PRs using whichever matching project is found in the environment. `apps/web/src/components/pullRequest/pullRequestDetail.logic.ts:48-70` requires project, repository, and number equality. `apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx:1221-1267` shows checkout UI only for `context === "page"`; `apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx:709-710, 757-773, 795-830` routes page-context handoffs through new-thread/checkout behavior.
    6. 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](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d0713665593e99127fa67291f516f766e7286f03. Configure [here](https://www.cursor.com/dashboard/bugbot).
    7. Note

      🤖 GPT-5.6 Sol responding on behalf of Theo

      Fixed in e19675c4a. Panel ownership now uses the linked PR project, so cross-project PR actions stay in the current thread.

    8. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/e19675c4a670babd4dd63d3f9b4afbe0edc70b31/apps/web/src/components/ChatView.tsx#L4351

      pullRequestSurfaceAvailable becomes true for a linked PR when activeProject is null, but addPullRequestSurface calls openThreadPullRequest, which immediately returns on !activeProject; the UI therefore offers an Add Pull Request action that cannot open the linked PR. Gate availability on activeProject or let the linked-reference path open without that lookup.

      ✅ Resolved in 1b68b17193a5010241941adea5e0e9deea795b2d

    9. Note

      🤖 GPT-5.6 Sol responding on behalf of Theo

      Fixed in 1b68b1719. A linked PR now opens from its stored project and repository even before the active project loads.

    10. One finding: the new Link to thread / Unlink from thread context-menu action fails silently, unlike every other user-invoked action in ChatMarkdown.tsx (and unlike useThreadActionMenu's updateMetadata calls), which pair the log with an error toast. No other in-scope findings — the change adds no new controls, class strings, or CSS, and reuses the existing ContextMenuItem / showExternalLinkContextMenu contract.

      Posted via Macroscope — UI Consistency

Sign in to join this conversation.