Skip to content

Add a recovery path for autosaved documents that don't open successfully#4157

Open
Keavon wants to merge 3 commits into
masterfrom
autosave-recovery
Open

Add a recovery path for autosaved documents that don't open successfully#4157
Keavon wants to merge 3 commits into
masterfrom
autosave-recovery

Conversation

@Keavon
Copy link
Copy Markdown
Member

@Keavon Keavon commented May 17, 2026

image

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a recovery mechanism for autosaved documents that fail to deserialize during startup. It adds new dialogs for reporting these failures and allows users to download the raw serialized content—either as a ZIP file on the web or as individual files within a folder on desktop. The implementation includes eager loading of all autosaves to detect issues early and updates to the persistence layer to prevent failed documents from being garbage collected. Review feedback highlights a potential directory traversal vulnerability when using document names as filenames and suggests providing fallback names for untitled documents in the failure list to improve clarity.

Comment thread editor/src/messages/portfolio/portfolio_message_handler.rs Outdated
Comment thread editor/src/messages/portfolio/portfolio_message_handler.rs Outdated
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 14 files

Confidence score: 2/5

  • There is a high-confidence, high-severity path-handling risk in desktop/wrapper/src/messages.rs: recovered document names are transported as raw Strings, so crafted names could escape the chosen recovery directory when later joined into paths.
  • A related issue in editor/src/messages/portfolio/portfolio_message_handler.rs also passes unsanitized names into ZIP/folder outputs, so path separators or reserved characters can produce unsafe or invalid filenames for users.
  • The empty-name rendering bug in editor/src/messages/portfolio/portfolio_message_handler.rs is low severity (UI clarity), but it reinforces that filename normalization is currently incomplete across the recovery flow.
  • Pay close attention to desktop/wrapper/src/messages.rs and editor/src/messages/portfolio/portfolio_message_handler.rs - recovery filename sanitization is needed to prevent path traversal/invalid output and improve reliability.

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Re-trigger cubic

Comment thread desktop/wrapper/src/messages.rs
Comment thread editor/src/messages/portfolio/portfolio_message_handler.rs Outdated
Comment thread editor/src/messages/portfolio/portfolio_message_handler.rs Outdated
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread editor/src/messages/portfolio/portfolio_message_handler.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant