diff --git a/apps/server/src/routes/worktree/routes/list.ts b/apps/server/src/routes/worktree/routes/list.ts index e82e5c14..f0d9c030 100644 --- a/apps/server/src/routes/worktree/routes/list.ts +++ b/apps/server/src/routes/worktree/routes/list.ts @@ -368,6 +368,13 @@ export function createListHandler() { : new Map(); for (const worktree of worktrees) { + // Skip PR assignment for the main worktree - it's not meaningful to show + // PRs on the main branch tab, and can be confusing if someone created + // a PR from main to another branch + if (worktree.isMain) { + continue; + } + const metadata = allMetadata.get(worktree.branch); const githubPR = githubPRs.get(worktree.branch); @@ -387,8 +394,8 @@ export function createListHandler() { ); }); } - } else if (metadata?.pr) { - // Fall back to stored metadata (for PRs not in recent GitHub response) + } else if (metadata?.pr && metadata.pr.state === 'OPEN') { + // Fall back to stored metadata only if the PR is still OPEN worktree.pr = metadata.pr; } }