mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-12 23:01:21 +00:00
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
This commit is contained in:
parent
a6e16e80d9
commit
1342a1e67c
1 changed files with 29 additions and 6 deletions
|
|
@ -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 (
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex gap-2">
|
||||
<span className="codicon codicon-git-commit text-blue-400" />
|
||||
<span className="font-bold">
|
||||
{metadata.isFirst ? t("chat:checkpoint.initial") : t("chat:checkpoint.regular")}
|
||||
{fallbackMetadata.isFirst ? t("chat:checkpoint.initial") : t("chat:checkpoint.regular")}
|
||||
</span>
|
||||
{isCurrent && <span className="text-muted text-sm">{t("chat:checkpoint.current")}</span>}
|
||||
{!metadata && (
|
||||
<span className="text-muted text-xs italic">
|
||||
{t("chat:checkpoint.metadataUnavailable", "metadata unavailable")}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<CheckpointMenu {...props} checkpoint={metadata} />
|
||||
<CheckpointMenu {...props} checkpoint={fallbackMetadata} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue