- 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.
Unified · Split
| @@ -320,7 +320,7 @@ export class ProviderManager extends EventEmitter<ProviderManagerEvents> { · 319 unmodified lines | |||
| 320 | ); | 320 | ); |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | if (checkpointCwd && input.turnCount > 0) { | 323 | if (input.turnCount > 0) { |
| 324 | const hasCheckpoint = await this.filesystemCheckpointStore.hasCheckpoint({ | 324 | const hasCheckpoint = await this.filesystemCheckpointStore.hasCheckpoint({ |
| 325 | cwd: checkpointCwd, | 325 | cwd: checkpointCwd, |
| 326 | threadId: beforeSnapshot.threadId, | 326 | threadId: beforeSnapshot.threadId, |
| @@ -241,29 +241,8 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) { · 240 unmodified lines | |||
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | // Fallback when a conversation checkpoint diff isn't available yet: | 243 | // Fallback when a conversation checkpoint diff isn't available yet: |
| 244 | // keep one patch per file path (latest change wins) so files aren't duplicated. | 244 | // show each turn's diff (oldest first) via patchForSummary, which prefers |
| 245 | const latestPatchByPath = new Map<string, string>(); | 245 | // cached checkpoint diffs when available. |
| 246 | for (const summary of turnDiffSummaries) { | ||
| 247 | for (const file of summary.files) { | ||
| 248 | if (latestPatchByPath.has(file.path)) { | ||
| 249 | continue; | ||
| 250 | } | ||
| 251 | const patch = file.diff?.trim(); | ||
| 252 | if (!patch) { | ||
| 253 | continue; | ||
| 254 | } | ||
| 255 | latestPatchByPath.set(file.path, patch); | ||
| 256 | } | ||
| 257 | } | ||
| 258 | if (latestPatchByPath.size > 0) { | ||
| 259 | return Array.from(latestPatchByPath.entries()) | ||
| 260 | .toSorted(([leftPath], [rightPath]) => | ||
| 261 | leftPath.localeCompare(rightPath, undefined, { numeric: true, sensitivity: "base" }), | ||
| 262 | ) | ||
| 263 | .map(([, patch]) => patch) | ||
| 264 | .join("\n\n"); | ||
| 265 | } | ||
| 266 | |||
| 267 | const patches = turnDiffSummaries | 246 | const patches = turnDiffSummaries |
| 268 | .toReversed() | 247 | .toReversed() |
| 269 | .map((summary) => patchForSummary(summary)?.trim()) | 248 | .map((summary) => patchForSummary(summary)?.trim()) |