Repository navigation
fix(recording): reopen NeedsRemux Studio projects and make recovery publication transactional - #4242
Open
richiemcilroy wants to merge 10 commits into
Open
richiemcilroy wants to merge 10 commits into
richiemcilroy wants to merge 10 commits into
Conversation
…re stranded originals
…t recovering them
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
…s at a real frame size
…Windows accepts it
richiemcilroy
marked this pull request as ready for review
November 14, 2026 07:16
|
Sandchest reviewed Sandchest reviews every change for vulnerabilities an attacker could use · 9 credits · Review details |
Member
Author
|
hey @greptileai, please re-review the PR |
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.

Fixes #4135.
Since 0.6.3, opening a Studio project whose
recording-meta.jsonsaysNeedsRemux(the remux after stop never ran or never finished, typically because Cap was closed while finishing) no longer opens it the way 0.6.2 did. On Windows a failed attempt can also leave the project with its fragments moved into.recovery-<uuid>/, after which every open fails with "No video was saved" or "Failed to open video".Root cause
Two separate defects stacked up:
NeedsRemuxproject runRecoveryManager::salvagefirst (apps/desktop-gpui/src/library.rs,recover_interrupted_for_editing_in). 0.6.2 opened those projects straight from their fragments. Salvage copies the whole recording, remuxes it and swaps it in before the editor appears, so any failure blocks a project that opened fine before, and success rewrites it on disk.content/segments/segment-0/display/(now empty or missing) while the real fragments sit in.recovery-<uuid>/original-segments. Nothing ever moved them back.stateDiagram-v2 [*] --> Original Original --> SegmentsOut: rename 1 SegmentsOut --> Installed: rename 2 Installed --> ConfigInstalled: rename 3 ConfigInstalled --> Committed: rename 4 (metadata) SegmentsOut --> Original: reconcile (unchanged) Installed --> Original: reconcile (now rolls back, was kept) ConfigInstalled --> Original: reconcile (now rolls back, was kept)What changed
recover_interrupted_for_editingtakes anopens_as_ischeck (the editor's ownpreflight). ANeedsRemuxproject the editor can read opens untouched, exactly as in 0.6.2. Only one it cannot read goes through salvage.InProgress,Failedand active-recording handling is unchanged.rename_recovery_pathretries sharing and access refusals on Windows for up to 5 s, for publication, rollback and reconcile alike (same error codesRecordingMetaalready retries).restore_unpublished_originalsrepairs projects older builds already stranded: when exactly one.recovery-*backup belongs to the current metadata (byte for byte, or differing only in aFailedstatus a later scan wrote) and the project is missing any of its files, the original metadata, config and segments move back. Whatever the project held moves to<workspace>/displaced-segments; nothing is deleted. It runs under the recovery lock and before deciding how to open a recording. Each step is idempotent, so a kill mid-restore finishes on the next open.Callers checked
reconcile_recovery_publicationruns on everyRecoveryLock::acquire: library recovery scan (find_incomplete,find_incomplete_single),remux_if_neededandremux_stopped_with_preparingat stop,recover/salvage/finalize*, retirement, and the newrestore_interrupted_recovery.acquire_for_preparing_previewdoes not reconcile and is unchanged.rename_recovery_pathis used bypublish_recoveryand byrename_recovery_path_with_sourcefor every rename other than the relocatable source move.recover_interrupted_for_editinghas one caller, the ordinary editor open inapp_windows.rs.restoration_leaves_settled_and_repaired_projects_alonepins, including the backup kept for a preparing editor.Tests
crates/recording/src/recovery/needs_remux_tests.rsbuilds projects with the real segmented encoder, laid out as every release since 0.6.0 writes them (the manifest writer's fields are unchanged sincecap-v0.6.0):NeedsRemuxwith 1, 999, 1000, 1356 and 5000 fragments: manifests validate, fragments stay in index order pastsegment_999, and the remux matches a reference remux of the untouched fragments. Paths contain spaces, non-ASCII andCopy (2), and are canonical, so Windows runs them as\\?\paths.Failed, emptydisplay/left over, a second attempt's backup, read-only media; restore killed at each step; settled, hand-repaired and foreign backups left alone.apps/desktop-gpui/src/library.rs: aNeedsRemuxproject the editor can read opens with every file unchanged; one it cannot read fails salvage with nothing changed and no copy left; a stranded project is restored before the editor checks it.Existing expectations that kept a half-installed publication now expect the rollback.
Proof (Windows Server 2025, NVIDIA T4)
Projects recorded with the released 0.6.2
cap-cliand stopped the moment it wroteNeedsRemux: 29 fragments (59 s) and 1,418 fragments (51 min 39 s, past 999 like the report).NeedsRemux.recovery-*NeedsRemuxComplete, originals parked in.recovery-*)display/, originals in the backup)displaced-segmentsFailedNeedsRemux, opensA copy of the 1,418-fragment project that 0.6.3 was killed on mid-recovery also opens with this PR, media and metadata unchanged.


Confidence Score: 5/5
The PR appears safe to merge; both previous findings are fixed and no new actionable issues remain.Summary
This PR lets readable
NeedsRemuxprojects open without rewriting them and makes interrupted recovery return to the original files.Reviews (2) · Last reviewed commit: "fix(recording): refuse to restore throug..." · Reviewed by Greptile