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.
GitManager.preparePullRequestThreadresolves and returns the pull request. It only usesthreadIdfor the setup script and never dispatches a link. Creating a pull request from a thread does link it, vialinkCreatedPullRequest, because that thread already exists.- Every checkout caller keeps only
branchandworktreePathand drops the resolved pull request. That includesPullRequestThreadDialogwithhandlePreparedPullRequestThread,PullRequestDetailPanel, andusePullRequestHandoffs. Several of these pass the id of a draft. Drafts are client state, andthread.pull-request.linkloads an existing server thread, so linking at prepare time would have nothing to attach to.PersistedDraftThreadStatehas no pull request field. - Once the draft becomes a thread,
ThreadPullRequestServicecan store a discoveredbranchPullRequest, and badges fall back to it (useLinkedThreadPullRequest). The linked list, the pull-requests panel, snapshot sync, stack siblings, and watch all read links, though, so they stay empty until someone links manually. - Ask and Explain don't check out and don't link either. Mobile has no checkout-from-pull-request path.
Likely fix area
- One option is to store the resolved pull request on the draft that receives the checkout. Then dispatch
thread.pull-request.linkwhen that draft becomes a server thread. All three web callers already haveresult.pullRequest. - Today's link sources are
manual,created,agent,stack, andstack-dismissed. A checkout link might want its own source.
A maintainer will decide on the fix direction.