t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Linked pull request shows closed in the sidebar and header while its panel shows it open

Open roprgm opened this issue 1 month ago • 2 comments

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/server

Steps to reproduce

  1. Link a pull request to a thread and close it. The sidebar row and the thread header show it as closed.
  2. Reopen the pull request on the host.
  3. Open the thread's pull request panel.

Expected behavior

Once the app has read the new state, every surface shows it. Refreshing linked pull requests on an interval is fine, but the app should not show two states for the same pull request at once.

Actual behavior

The panel shows the pull request as open, while the sidebar row and the thread header keep showing it as closed, for up to 15 minutes. The thread list suggests the work is closed when it is not.

The panel reads the host directly (pullRequestsDetail → PullRequestService.detail). The sidebar and header read the linked pull request snapshot, which only PullRequestSyncReactor writes, and a closed link is re-read every 15 minutes (isDue, SLOW_SYNC_INTERVAL_MS). The panel's fresh read never reaches the snapshot.

Notes for a fix:

  • Calling requestSync from the detail handler helps the common case but leaves gaps: it needs a second host read that can fail, a sweep already in flight can still persist an older state afterwards, and a detail read served from held data while it refreshes in the background never reports the fresh state.
  • Recording the state where PullRequestService accepts a fresh read, and persisting it to the linked snapshot without another host read (ordered against in-flight sweeps), would cover those cases.

Related: #15744 (agents cannot watch a recently reopened pull request, from the same stale closed snapshot).

Impact

Minor bug or occasional failure

Version or commit

Desktop nightly; code references from main @ b4381985db

Environment

macOS 27, desktop app

Screenshots

Sidebar row and header chip show #88 closed while the panel shows it open:

Sidebar and header show the pull request closed while the panel shows it open

roprgm avatar Oct 04 '26 22:10 roprgm

[!NOTE] Grok responding on behalf of Julius.

Fixed by #16761, which just merged. A pull request detail read (the panel) that sees a PR for the first time or in a new state (opened, closed, merged) now announces it, and the sync reactor syncs that thread link right away instead of waiting for the next sweep, so the sidebar row and header catch up with the panel. Readings are ordered by updatedAt/observedAt, so a stale cached read can't flip a link back.

Closing this out. If you still see the sidebar/header disagree with the panel on a current nightly, comment and we'll reopen.

juliusmarminge avatar Oct 07 '26 08:10 juliusmarminge

Still seeing this on 0.1.6 (Beta desktop), in a slightly different setup: the thread was settled and the PR is on Azure DevOps.

What happened

  1. A thread had two linked Azure DevOps PRs, PR 1918 and PR 1920. PR 1918 was merged earlier and shows as merged everywhere.
  2. I merged PR 1920 myself in the Azure DevOps web UI and told the agent. The thread settled about 20 seconds later.
  3. The thread details panel shows PR 1920 as merged. The sidebar row's hover card shows it as open.
  4. An hour later the sidebar still says open. The stored link snapshot is state: "open", last synced about 45 minutes before the merge, so it never caught up.

Expected Once the panel has read the PR as merged, the sidebar shows merged too. I know settled threads stop refreshing (per the source-control docs), and that's fine. But here the app already has the fresh state and still shows two different answers. It's also easy to hit: merge on the host, then settle right away.

Environment: T3 Code desktop 0.1.6 (Beta), macOS 26, local server, Azure DevOps, Claude (Opus 5.5).

Hint, in case it helps: the periodic sweep treats a PR as not due once every thread linking it is settled (isDue in PullRequestSyncReactor.ts). So a merge that lands between the last 5-minute read and the settle is missed. I'd have expected the panel-read path from #16761 to cover that, but it didn't here, and I couldn't tell why from my logs.

Drafted with Opus 5.5 (Claude Code) on behalf of @lingolooper-simon.

lingolooper-simon avatar Nov 02 '26 09:11 lingolooper-simon