Skip to content

[Bug]: Timeline Open diff shows the wrong turn for edits from running, failed, or forked turns #15843

Description

@nekohasekai

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. In any thread, send a prompt that makes the agent edit a file and keep working for a while.
  2. While the turn is still running, expand one of its file-edit rows in the timeline (the row shows the file path and an Open diff button) and click Open diff.

The same button also misbehaves after the turn ends, if the turn failed, and on inherited edits in a forked thread (see below).

Expected behavior

Open diff opens a diff that contains the edit I clicked, or the button is not offered when there is nothing to show yet.

Actual behavior

The Diff panel opens on a turn that does not contain the edit:

Where the edit is What the Diff panel shows
A running turn, first turn of the thread "Latest turn" with No completed turns yet.
A running turn, after earlier turns completed "Latest turn" with the previous turn's diff
A turn that ended as failed "Latest turn" with the previous turn's diff, permanently
An inherited edit in a forked thread No completed turns yet., or the fork's own latest turn once it has one

The panel never says that it picked a different turn. In the recording, the failed turn wrote Entry 6, and Open diff on that edit shows turn 2's diff with Entry 4 and Entry 5 and no Entry 6.

During a running turn the selection also does not stay: at the next thread update the panel switches itself to Changes. That reset is #15352 (open fixes: #15382, #15671). On my install Changes is then empty too, because my projects live outside the server's startup directory (#4022, fix in #15014). So while a turn runs, the Diff panel shows no diff for the edit in any of its states.

Not affected: the Open diff on a completed turn's "N changed files" card, which only appears when the turn has a checkpoint. The mobile app has no per-edit Open diff.

Cause

  • V2ItemInspector renders Open diff for every file_change item with a runId and calls onOpenTurnDiff(runId, fileName) (V2ItemInspector.tsx#L237).
  • The Diff panel only knows turns that have a checkpoint (deriveThreadCheckpointSummaries). When the selected run has none, it falls back to the newest checkpoint and labels it "Latest turn", or shows "No completed turns yet." when the thread has no checkpoint (DiffPanel.tsx#L223-L227, #L980-L983). reconcileTurnSelection also rewrites the stored selection to that newest run (diffPanelStore.ts#L89).
  • A run gets a checkpoint only when it ends as completed, interrupted or cancelled (RunExecutionService.ts#L664-L671). A running run has none yet and a failed run never gets one. A fork's projection only loads its own checkpoints (ProjectionStore.ts#L3015-L3019), while inherited items keep the source thread's runId.

file_change items come from every provider adapter, so this is not provider-specific. I did not look into which fix is best. Hiding the button when the item's run has no checkpoint in this thread would stop the wrong diffs. Opening something that contains the edit would keep the button useful while a turn runs: for example the item's own patch, which ACP and Codex items carry in diffStr, or Uncommitted for that file.

Impact

Major degradation or frequent failure

It happens on every click while a turn is running, which is when I most want to look at an edit.

Version or commit

Reproduced on main @ 4ee6bfd. First seen on Nightly 0.0.46-nightly.20261004.2644 (macOS desktop).

Environment

Reproduced: web client against an isolated dev server, with a scripted fake agent (no model calls) that speaks Grok's ACP protocol, writes src/notes.md and reports each write as an edit tool call. Seen: macOS 27.0.1 desktop app, Claude Opus 5.5 thread running for about 30 minutes.

Screenshots, recordings, or supporting files

All project and thread data is synthetic. The yellow captions and the yellow outline on the clicked button were added to the page by the recording script and do not change the app.

open-diff-wrong-turn.mp4
Running turn 1: Open diff on the edit that wrote Entry 1 shows "No completed turns yet." 1-running-first-turn.png
Running turn 2: Open diff on the edit that wrote Entry 4 shows turn 1's diff (+3) as "Latest turn" 2-running-later-turn.png
Failed turn 3: Open diff on the edit that wrote Entry 6 shows turn 2's diff 3-failed-turn.png
Fork: Open diff on an inherited edit shows "No completed turns yet." 4-fork-inherited.png
For comparison, an edit from completed turn 1 opens Turn 1 correctly 5-completed-turn-control.png

Workaround

Wait until the turn completes and use the Open diff on its "changed files" card. While a turn runs, choose Uncommitted in the Diff panel, which works only for projects inside the server's startup directory or a T3 worktree until #4022 is fixed.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions