# \[Bug\]: Creating a thread from a pull request does not link the pull request to the thread · Issue \#15721 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/issues/15721)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: backlog

Priority: 0

## Description

[Discussion and activity](https://git.cafe/pingdotgg/t3code/issues/15721)

---

### Before submitting

- [x] I searched existing issues and did not find a duplicate.
- [x] 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 @ 4ee6bfd50e

### Environment

macOS, T3 Code desktop

### Workaround

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

