Skip to content

fix(web): PR code tab no longer reloads when turns finish or the PR updates - #14539

Open
Gigioxx wants to merge 3 commits into
pingdotgg:mainfrom
Gigioxx:fix/pr-code-tab-background-refresh
Open

Gigioxx wants to merge 3 commits into
pingdotgg:mainfrom
Gigioxx:fix/pr-code-tab-background-refresh

Conversation

@Gigioxx

@Gigioxx Gigioxx commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Problem

Fixes #14483. Replaces #14513, which was closed for incomplete UI verification; this adds multi-page recordings and fixes the CodeRabbit finding there. The PR panel's Code tab threw away every loaded diff page and showed "Loading pull request diff..." whenever a turn finished anywhere in the environment, or when the pull request's updatedAt moved (comments, reviews, pushes). Both background signals reused the Refresh button's token. A reader lost the diff and their scroll position mid-review even when nothing in it changed.

Change

The Code tab now takes two tokens:

  • refreshToken: the Refresh button only. Same hard reset as before.
  • backgroundRefreshToken: finished turns plus new updatedAt revisions. Every loaded page stays on screen. The tab re-reads them in order from the first page, and only accepts answers fetched after the refresh began, so a cached page cannot vouch for itself. An unchanged page moves the walk to the next one. A changed page replaces itself and drops the pages after it, since their cursors pointed into the old diff. Loading the next page waits until the walk catches up.

The slice reconcile step moved into reconcileDiffSlices in pullRequestDiff.logic.ts so it can be tested on its own.

This supersedes the turn-only part of #13835 and also covers the updatedAt path described in the triage.

Verification

Isolated Playwright browser against a worktree dev server with fresh .t3 state. A second tab sent a one-line prompt in an unrelated thread, so a turn completed in the same environment while the Code tab was open.

Multi-page: #14215, 476 files across 5 diff pages, all loaded, scrolled near the bottom.

Files in Code tab Diff scroll position Loading state
Before (main) 476 to 100+ 13732 to 0 pages dropped
After 476 throughout 13732 throughout never shown
Before, after the turn After, after the turn
before after

A temporary console trace (removed before commit) confirmed the walk in the after run. Each of pages 1 through 5 first saw its cached answer, refreshed it, then advanced once the fresh answer matched.

Single page: #14497. Before, the diff unmounted to the loading skeleton with "0 files". After, it stayed mounted with no loading state, across repeated turns.

Before After
before after

Tests and checks:

  • vp test run apps/web/src/components/pullRequest/pullRequestDiff.logic.test.ts: 17 passed. The new cases cover appending a page, walking forward through unchanged pages, and replacing a changed later page while dropping the pages after it.
  • Web typecheck is clean. Lint shows no new warnings in the changed files.
  • A Codex review of the branch found no actionable issues.

Not checked live:

  • The updatedAt path. It needs a pull request that changes while open, and it uses the same token as the turn path.
  • A later page whose content actually changes.

Unrelated, seen on main too: the first diff read sometimes fails with a 503 when an earlier request is aborted (499) while a shared fetch is in flight. Reloading recovers.

Made with Claude Opus 5.5 in Claude Code (via T3 Code).

@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.

Next included review available in 15 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: c1bb5895-c398-4904-a89e-467f6041aaed

📥 Commits

Reviewing files that changed from the base of the PR and between c57a04b and 699de7d.

📒 Files selected for processing (4)
  • apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
  • apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
  • apps/web/src/components/pullRequest/pullRequestDiff.logic.test.ts
  • apps/web/src/components/pullRequest/pullRequestDiff.logic.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Oct 1, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 1, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 699de7d

Macroscope's review found this PR approvable — This is a localized, tested fix to preserve loaded pull-request diff pages during background updates while retaining the existing manual refresh reset. Its runtime impact is confined to the PR Code tab, with no schema, infrastructure, security, billing, or configuration-sensitive changes.

Notes:

  • Diff unchanged. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 2, 2026 — with ChatGPT Codex Connector
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 2, 2026 05:38

Dismissing prior approval to re-evaluate 699de7d

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: PR pane code tab periodically auto hard refreshes, making it difficult to review diffs

2 participants