Skip to content

[Bug]: Creating a thread from a pull request does not link the pull request to the thread #15721

Description

@gertzgal

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open a thread in a GitHub-backed project.
  2. Start a thread from a pull request using any of the checkout paths, in worktree (or local) mode:
    • the pull request dialog in chat,
    • the pull request detail panel's checkout hand-off,
    • a pull request hand-off action (e.g. "fix this finding").
  3. Wait for the checkout to finish and the thread to move onto the PR branch.
  4. Open the thread's linked pull requests (thread details / PR panel).

Expected behavior

The pull request the thread was created from is linked to that thread, the same as if it had been linked through the Link pull request dialog or the link_pull_request MCP tool. Linked-PR sync, watching, and the sidebar/thread badges then treat it as the thread's pull request.

Actual behavior

The worktree is prepared and the thread is pointed at the PR branch, but no link is recorded. The PR must be linked by hand afterwards.

None of the paths that prepare a PR checkout write a link:

  • Server: GitManager.preparePullRequestThread (apps/server/src/git/GitManager.ts) uses threadId only to run the project setup script.
  • Web: after preparePullRequestThread succeeds, each caller only re-points the thread at { branch, worktreePath } and never dispatches thread.pull-request.link:
    • ChatView.tsx → handlePreparedPullRequestThread
    • pullRequest/PullRequestDetailPanel.tsx (checkout hand-off)
    • pullRequest/usePullRequestActions.ts (usePullRequestHandoffs)

Because the server method already resolves the pull request and receives the threadId, linking there would cover all three web paths plus any other caller with no client changes.

Impact

Minor bug or occasional failure

Version or commit

main @ 4ee6bfd

Environment

macOS, T3 Code desktop

Workaround

Link the pull request manually from the thread's Link pull request dialog after the checkout completes.

Activity

  1. juliusmarminge commented on Oct 4, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Triage

    Thanks for tracing all three checkout paths, @gertzgal. I didn't find another issue covering this.

    What I found

    I checked main at 4ee6bfd. Checkout prepares the branch and points a thread at it, but it never writes a thread.pull-request.link.

    Likely fix area

    • One option is to store the resolved pull request on the draft that receives the checkout. Then dispatch thread.pull-request.link when that draft becomes a server thread. All three web callers already have result.pullRequest.
    • Today's link sources are manual, created, agent, stack, and stack-dismissed. A checkout link might want its own source.

    A maintainer will decide on the fix direction.

  2. added
    bugSomething is broken or behaving incorrectly.
    via-triageFiled through npx t3 triage
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions