feat(web): pin turn diff baselines - #10150
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00f8001de0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <DropdownMenuSubTrigger>Pin baseline</DropdownMenuSubTrigger> | ||
| <DropdownMenuSubContent className="w-64"> | ||
| <DropdownMenuItem | ||
| disabled={!latestTurn} |
There was a problem hiding this comment.
Disable Turn 0 when the baseline ref is absent
When Git is initialized during a running turn, CheckpointReactor intentionally records the completion checkpoint without creating the missing turn-0 baseline (CheckpointReactor.ts:240-274; its test confirms the ref remains absent at lines 1285-1287). This item is nevertheless enabled whenever any checkpoint summary exists; selecting it calls the full-thread diff, which always uses checkpointRefForThreadTurn(threadId, 0) with fallback disabled (CheckpointDiffQuery.ts:257-263), so this advertised comparison returns an error instead of a diff. Gate the option on actual turn-0 baseline availability or make the API handle the missing initial snapshot.
Useful? React with 👍 / 👎.
| (summary) => summary.turnId === baselineTurnId, | ||
| ); | ||
| const baselineTurnCount = | ||
| baselineTurnId === THREAD_START_DIFF_BASELINE ? 0 : baselineTurn?.checkpointTurnCount; |
There was a problem hiding this comment.
🟡 Medium components/DiffPanel.tsx:220
Pinned comparisons produce the wrong result for imported summaries without a stored checkpointTurnCount: baselineTurnCount becomes undefined, so getCheckpointDiffRange falls back to the preceding-turn diff and the label/cache omit the pinned baseline. The Turn menu also enables older endpoints with an inferred count because undefined < baselineTurnCount is false, and selecting one then yields no patch. Use inferredCheckpointTurnCountByTurnId[turnId] as the fallback both when computing baselineTurnCount and when disabling menu entries.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/DiffPanel.tsx around line 220:
Pinned comparisons produce the wrong result for imported summaries without a stored `checkpointTurnCount`: `baselineTurnCount` becomes `undefined`, so `getCheckpointDiffRange` falls back to the preceding-turn diff and the label/cache omit the pinned baseline. The Turn menu also enables older endpoints with an inferred count because `undefined < baselineTurnCount` is false, and selecting one then yields no patch. Use `inferredCheckpointTurnCountByTurnId[turnId]` as the fallback both when computing `baselineTurnCount` and when disabling menu entries.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a persisted, user-facing baseline-comparison workflow across the web diff UI, selection store, and proactive diff opening, rather than a small mechanical change. Unresolved findings cover unavailable Turn 0 baselines and imported summaries, so the behavior warrants human review. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
What Changed
Add a pinned baseline to the web/desktop diff scope menu, using the server's existing checkpoint-range API.
Pins are stored per client, thread, and environment. Comparison caches and review state distinguish both endpoints. Includes focused store/range tests and a short user-guide section.
Why
Work often spans an implementation turn and a small follow-up correction. Reviewing those turns separately makes it harder to see the combined result. Pinning a saved baseline lets users review the net changes across that chunk of work.
Scope is limited to web and the shared desktop UI. No server, contract, mobile, or development-infrastructure changes. Imported CLI sessions can only compare snapshots captured by T3; Turn 0 does not reconstruct earlier CLI history.
UI Changes
Pinned comparison labels
Follow latest:
Turn 18 → Latest turnkeeps Turn 18 as the baseline while the endpoint advances with completed turns. The menu below shows numbered endpoints and the new No changes labels.Fixed endpoint: choosing Turn N changes the label to
Turn 18 → Turn Nand keeps both endpoints fixed. This example usesTurn 14 → Turn 16to show a range with code changes.Validation
diffPanelStore.test.tsandChatView.logic.test.ts.Checklist
Implemented with GPT-6-Astra using Codex CLI in T3 Code.
Note
Add pinned baseline support to diff panel turn comparisons
DiffBaselineandDiffPanelSelectiontypes,pinBaselineandselectLatestTurnactions, and agetCheckpointDiffRangehelper that returns null for unavailable or reversed endpointsreconcileTurnSelectionin diffPanelStore.ts now clears an unavailable pinned baseline and falls back to branch scope when the available turn list is empty; previously the selection stayed on the removed turnMacroscope summarized e2d94ea.