PR #9657 review: refresh past PRs in a workspace's PR history

PR #9657 · Review workspace · author harshithmullapudi · reviewed at 7040e88f

Summary

The Workspace activity panel lists every PR a workspace was ever linked to, but the host-service only refreshed the PR on the workspace's current upstream head, so a PR left behind (earlier stack layer or branch) kept its old state forever (SUPER-3429, #1512 shown open after close). The PR adds refreshPastPullRequests, which refetches still-open/draft/queued history PRs by number during each project refresh, using the existing TTL cache, availability gate and gh→Octokit fallback. The PR pane's Refresh button now also calls pullRequests.refreshByWorkspaces and invalidates historyByWorkspaces.

Verdict

Minor issues: the fix is correctly placed, bounded and well tested; the remaining points are edge cases and polish, none blocking.

Findings

  1. packages/host-service/src/runtime/pull-requests/pull-requests.ts:1642: a dequeued history PR stays "queued" and is polled indefinitely. The by-number path passes the stored queued state as isInMergeQueue, and REST pulls/{n} has no merge-queue field. A history PR that is removed from the merge queue but stays open keeps showing "queued" and stays in the poll set until it closes. Fix: when the stored state is queued and GitHub says open, call getCachedPullRequestDetails (it already returns isInMergeQueue), or fall back to open instead of carrying queued forward.
  2. packages/host-service/src/runtime/pull-requests/pull-requests.ts:1000: number lookups run after the head lookups, not beside them. Every awaited refreshByWorkspaces (merge flow, stack switch in useOpenStackLayer, and now the Refresh button) waits for one more GitHub round trip when a workspace has open history PRs. Fix (optional): exclude each workspace's current pullRequestId (instead of the head-lookup results) and run both lookups in one Promise.all. The rare duplicate fetch is cheap and cached.
  3. apps/desktop/.../PullRequestPane/PullRequestPane.tsx:76: the Refresh spinner does not cover the new sync. isRefreshing only tracks the detail invalidation, so the button stops spinning before the host sync (with bypassCache) finishes and the activity row updates. A sync failure is only logged with console.warn. Fix: pass isRefreshing || syncWorkspacePullRequests.isPending.

Evidence

Host-service (the actual fix): unit/regression tests

Desktop (Refresh button in the PR pane)

Questions for the author

Test / CI notes