From 1342a1e67cc7eef6e55d9c53f7715909c31414f3 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 18 Jul 2025 15:53:12 +0000 Subject: [PATCH] fix: ensure checkpoints appear in chat even with invalid metadata - Modified CheckpointSaved component to show fallback display when checkpoint metadata is missing or invalid - Added console warnings to help debug checkpoint metadata issues - Prevents checkpoints from being completely hidden due to schema validation failures - Fixes issue #5899 where users reported not seeing checkpoints despite having them enabled The component now: - Shows a fallback checkpoint display with default metadata when validation fails - Logs warnings to console for debugging purposes - Displays "metadata unavailable" indicator when using fallback data - Ensures CheckpointMenu still functions with fallback metadata --- .../chat/checkpoints/CheckpointSaved.tsx | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/webview-ui/src/components/chat/checkpoints/CheckpointSaved.tsx b/webview-ui/src/components/chat/checkpoints/CheckpointSaved.tsx index 8daf0a3089e..d7393d9d70a 100644 --- a/webview-ui/src/components/chat/checkpoints/CheckpointSaved.tsx +++ b/webview-ui/src/components/chat/checkpoints/CheckpointSaved.tsx @@ -17,32 +17,55 @@ export const CheckpointSaved = ({ checkpoint, ...props }: CheckpointSavedProps) const metadata = useMemo(() => { if (!checkpoint) { + console.warn("[CheckpointSaved] No checkpoint metadata provided", { ts: props.ts, commitHash: props.commitHash }) return undefined } const result = checkpointSchema.safeParse(checkpoint) if (!result.success) { + console.warn("[CheckpointSaved] Invalid checkpoint metadata", { + checkpoint, + errors: result.error.errors, + ts: props.ts, + commitHash: props.commitHash + }) return undefined } return result.data - }, [checkpoint]) + }, [checkpoint, props.ts, props.commitHash]) - if (!metadata) { - return null - } + // Always show the checkpoint, even if metadata is invalid + // This ensures users can see that checkpoints are being created + const fallbackMetadata = useMemo(() => { + if (metadata) { + return metadata + } + + // Create fallback metadata when the original is invalid + return { + isFirst: false, // Default to regular checkpoint + from: "", // Empty string as fallback + to: props.commitHash, // Use the commit hash we have + } + }, [metadata, props.commitHash]) return (
- {metadata.isFirst ? t("chat:checkpoint.initial") : t("chat:checkpoint.regular")} + {fallbackMetadata.isFirst ? t("chat:checkpoint.initial") : t("chat:checkpoint.regular")} {isCurrent && {t("chat:checkpoint.current")}} + {!metadata && ( + + {t("chat:checkpoint.metadataUnavailable", "metadata unavailable")} + + )}
- +
) }