Repository navigation
fix(desktop-gpui): finish uploading crashed Instant recordings and clean up the ones that captured nothing - #3106
Merged
Conversation
…at crashed before capturing anything
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
Author
|
hey @greptileai, please re-review the PR |
… crash saved, on any encoder
…coverable crash is never cleaned up
Member
Author
|
hey @greptileai, please re-review the PR |
richiemcilroy
marked this pull request as ready for review
October 24, 2026 15:04
… tracks leave media out
Member
Author
|
hey @greptileai, please re-review the PR |
richiemcilroy
changed the base branch from
fix/gpui-instant-start-cleanup
to
main
October 24, 2026 19:27
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the app crashes or is force-quit during an Instant recording, the next launch can leave the share link broken for good:
output.mp4locally, but the upload can never finish: the crash left each track'smanifest.jsonunfinished (is_complete: false, plus an entry for the segment being written), and the upload resume rightly accepts only finished manifests. The queue retries, then shows "Upload needs attention", and the cloud copy stays empty.Builds on #3089 (the cleanup journal for starts that never began).
flowchart TD C[Crash during an Instant recording] --> M{Media saved locally?} M -- yes --> R[Recover] R --> O[Rebuild output.mp4, as before] O --> S["Seal each track: keep the verified run of segments,<br/>set the unfinished tail aside as .unsealed, mark complete"] S --> Q[Upload queue resumes with the existing strict checks] Q --> V[Same video id verified on the server] M -- no --> A{"Lock free, saved before this launch<br/>and over 10 min ago, still in progress?"} A -- yes --> J[Journal as interrupted] J --> D[Sweep: usual account and local checks, then delete] D --> F[Mark the local recording failed] A -- no --> K[Leave it alone]Recovered recordings now upload
seal_interrupted_track(crates/recording/src/upload_resume.rs:342) keeps the run of segments fromsegment_001that every checkcollect_trackmakes still accepts (complete, sized, matching bytes, complete fragment tail). It renames the unfinished tail and any other unlisted media to<name>.unsealedwithout deleting them, then writes the manifest complete. Sealing a finished manifest changes nothing.output.mp4, before marking the recording complete, so the queue never sees an unsealed recording (apps/desktop-gpui/src/recording.rs:1454). If sealing fails, recovery still succeeds locally and the upload fails as it did before.output.mp4. Whenever sealing sets any media aside, or fails, the recording is markedpreserve_local, so it stays on disk after its upload verifies even with delete-after-upload on, and the complete local copy is never deleted.Recordings that crashed before capturing anything are cleaned up
adopt_crashed_at(apps/desktop-gpui/src/upload/instant_cleanup.rs:540) runs before each sweep. It journals a recording only when all of these hold:instant-upload.json, so the sweep's account check still applies, followed by its usual local checks and the recheck right before the delete.mark_crashed_recording_failed(instant_cleanup.rs:625) marks the local recording failed ("Cap closed before this recording captured anything.") and its upload cancelled, under the upload lock, and only if it still claims the video and still holds no media. Nothing local is deleted.Contract between the app and the server
finished_segment_manifests_match_the_server_contract_fixtures(apps/desktop-gpui/src/upload.rs:2756) checks the finished segment manifest this app uploads againstapps/web/__tests__/fixtures/desktop-segments/, anddesktop-segments-manifest-contract.test.tsruns the server's finalization parser and recovery decoder on the same files. A format change on either side fails one of the two, and the web test runs in Recording Reliability.Harness hook
CAP_GPUI_AUTO_RECOVER=1presses Recover on the recovery toast (apps/desktop-gpui/src/main_window.rs:1682), the same way the otherCAP_GPUI_AUTO_*hooks drive the app, because unprivileged synthetic clicks are dropped.

Confidence Score: 5/5
The PR appears safe to merge; no new blocking issues were found.Summary
This PR seals recovered Instant recordings for upload and cleans up interrupted recordings that captured no media.
Reviews (4) · Last reviewed commit: "fix(desktop-gpui): keep a recovered reco..." · Reviewed by Greptile