Fix redundant truthiness check and misleading incremental diff fallback

- Remove redundant 'checkpointCwd &&' guard in revertToCheckpoint (providerManager.ts:323)
  since checkpointCwd is guaranteed truthy after the throw on lines 310-313.

- Remove latestPatchByPath deduplication fallback in DiffPanel.tsx that kept only the
  most recent turn's per-file incremental diff, which was misleading for files changed
  across multiple turns. The per-turn patchForSummary fallback (which prefers cached
  checkpoint diffs) now handles the case, showing all turns' changes.
This commit is contained in:
Cursor Agent committed 2026-02-19 04:41:38 +00:00
1 parent e29a7705f9
commit db3b9e0807
2 files changed
+3 -24

No files matched your search

+1 -1
View File
@@ -320,7 +320,7 @@ export class ProviderManager extends EventEmitter<ProviderManagerEvents> {
);
}
if (checkpointCwd && input.turnCount > 0) {
if (input.turnCount > 0) {
const hasCheckpoint = await this.filesystemCheckpointStore.hasCheckpoint({
cwd: checkpointCwd,
threadId: beforeSnapshot.threadId,
+2 -23
View File
@@ -241,29 +241,8 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
}
// Fallback when a conversation checkpoint diff isn't available yet:
// keep one patch per file path (latest change wins) so files aren't duplicated.
const latestPatchByPath = new Map<string, string>();
for (const summary of turnDiffSummaries) {
for (const file of summary.files) {
if (latestPatchByPath.has(file.path)) {
continue;
}
const patch = file.diff?.trim();
if (!patch) {
continue;
}
latestPatchByPath.set(file.path, patch);
}
}
if (latestPatchByPath.size > 0) {
return Array.from(latestPatchByPath.entries())
.toSorted(([leftPath], [rightPath]) =>
leftPath.localeCompare(rightPath, undefined, { numeric: true, sensitivity: "base" }),
)
.map(([, patch]) => patch)
.join("\n\n");
}
// show each turn's diff (oldest first) via patchForSummary, which prefers
// cached checkpoint diffs when available.
const patches = turnDiffSummaries
.toReversed()
.map((summary) => patchForSummary(summary)?.trim())