Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
73252b5
feat(recording): report what a stopping Windows Studio recording is d…
richiemcilroy Nov 29, 2026
84ff994
feat(recording): tell a stalled late Studio stop from a slow one
richiemcilroy Nov 29, 2026
29e6c9d
fix(cli): stop waiting for a late Studio stop that shows no progress
richiemcilroy Nov 29, 2026
e2d1f7e
fix(desktop): hand the app back when a late Studio stop shows no prog…
richiemcilroy Nov 29, 2026
f29a1b6
feat(desktop): say when a late Studio save stopped making progress
richiemcilroy Nov 29, 2026
4368573
feat(recording): count a Windows Studio audio muxer's finish as a sto…
richiemcilroy Nov 29, 2026
ea33083
fix(cli): drop a comment that restates the stall check
richiemcilroy Nov 29, 2026
6126937
fix(desktop): drop a comment that restates the stall check
richiemcilroy Nov 29, 2026
0cec5f6
feat(recording): log when a late Studio stop is given up for showing …
richiemcilroy Nov 29, 2026
8f73c95
feat(recording): count audio muxed after a Studio stop began as progress
richiemcilroy Nov 29, 2026
0c5b928
feat(enc-ffmpeg): mark a segment write that has not returned on Windows
richiemcilroy Nov 29, 2026
04c8cb0
feat(recording): count a segment write in flight as progress of a lat…
richiemcilroy Nov 29, 2026
598ffde
fix(recording): give a late Studio stop five seconds without progress
richiemcilroy Nov 29, 2026
1d42363
fix(recording): count an audio write that has not returned as waiting…
richiemcilroy Nov 29, 2026
eff66f8
feat(recording): count a disk space query that has not returned as wa…
richiemcilroy Nov 29, 2026
1bee903
fix(recording): never judge a late stop whose muxers report no progre…
richiemcilroy Nov 29, 2026
8f1b630
fix(desktop): keep the stalled save notice true when the save still c…
richiemcilroy Nov 29, 2026
6c26416
ci: fall back to the Azure Ubuntu mirror in the Linux desktop harness
richiemcilroy Nov 29, 2026
d03b8f7
Merge remote-tracking branch 'origin/main' into fix/late-stop-progres…
richiemcilroy Nov 29, 2026
c06f2a6
ci: retry the libva body read from the Azure mirror too
richiemcilroy Nov 29, 2026
9bcfdc3
Merge #4649 into train 19
richiemcilroy Nov 29, 2026
da81aed
Merge #4638 into train 19
richiemcilroy Nov 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/linux-desktop-reliability.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linux desktop reliability

Check failure on line 1 in .github/workflows/linux-desktop-reliability.yml

View workflow job for this annotation

GitHub Actions / Lint (Biome)

format

File content differs from formatting output

# The built GPUI app on real Linux desktops: Ubuntu 26.04 with GNOME 50 and
# Arch with Hyprland, each with its real portals and tray host, in systemd
Expand Down Expand Up @@ -632,6 +632,17 @@
curl --fail --location --retry 3 -o "$RUNNER_TEMP/Cap.AppImage" "$CAP_APPIMAGE_URL"
echo "$CAP_APPIMAGE_SHA256 $RUNNER_TEMP/Cap.AppImage" | sha256sum --check

- name: apt-install.sh falls back when the Ubuntu archive is unreachable
run: |
log="$RUNNER_TEMP/apt-install-self-test.log"
status=0
docker run --rm --add-host archive.ubuntu.com:127.0.0.1 --add-host security.ubuntu.com:127.0.0.1 \
-v "$PWD/scripts/linux-desktop-harness/apt-install.sh":/apt-install.sh:ro ubuntu:24.04 \
sh -c 'sh /apt-install.sh -qq hello >/dev/null && hello' 2>"$log" || status=$?
cat "$log"
[ "$status" = 0 ]
grep -q "falling back to http://azure.archive.ubuntu.com/ubuntu" "$log"

- name: Connect a capture stream in NixOS appimage-run
timeout-minutes: 30
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/windows-recording-encoder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- "crates/recording/src/output_pipeline/win_fragmented_m4s.rs"
- "crates/recording/src/output_pipeline/core.rs"
- "crates/recording/src/studio_recording.rs"
- "crates/recording/src/stop_progress.rs"
- "crates/recording/src/recovery.rs"
- "Cargo.lock"
- ".github/workflows/windows-recording-encoder.yml"
Expand All @@ -28,6 +29,7 @@ on:
- "crates/recording/src/output_pipeline/win_fragmented_m4s.rs"
- "crates/recording/src/output_pipeline/core.rs"
- "crates/recording/src/studio_recording.rs"
- "crates/recording/src/stop_progress.rs"
- "crates/recording/src/recovery.rs"
- "Cargo.lock"
- ".github/workflows/windows-recording-encoder.yml"
Expand Down
25 changes: 18 additions & 7 deletions apps/cli/src/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,27 +1141,38 @@ async fn wait_for_studio_finish(
"Recording is still finishing; waiting up to {}s for it to save: {path}",
STUDIO_FINISH_WAIT.as_secs()
);
match tokio::time::timeout(STUDIO_FINISH_WAIT, finishing.wait()).await {
Ok(outcome) => {
let waiting = std::time::Instant::now();
let finished = tokio::select! {
biased;
finished = tokio::time::timeout(STUDIO_FINISH_WAIT, finishing.wait()) => finished.ok(),
() = finishing.stalled() => None,
};
match finished {
Some(outcome) => {
if outcome.result.is_ok() {
eprintln!("Recording finished saving: {path}");
}
outcome
}
Err(_) => {
None => {
STUDIO_STILL_FINISHING.store(true, std::sync::atomic::Ordering::SeqCst);
studio_recording::StudioStopOutcome {
capture_stopped: false,
result: Err(format!(
"Recording is still finishing after {}s. Nothing was discarded; it will be recovered when it is next exported (cap export \"{path}\") or opened in Cap",
STUDIO_FINISH_WAIT.as_secs()
)),
result: Err(still_finishing_message(waiting.elapsed(), &path)),
finishing: None,
}
}
}
}

#[cfg(windows)]
fn still_finishing_message(waited: Duration, path: &str) -> String {
format!(
"Recording is still finishing after {}s. Nothing was discarded; it will be recovered when it is next exported (cap export \"{path}\") or opened in Cap",
waited.as_secs()
)
}

/// Ends the process after `report` once `cap record` has given up waiting
/// for Studio tracks still finishing. A writer still blocked in the OS keeps
/// both the runtime and the normal process exit waiting on it, so the process
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,8 @@ title = "Aufnahmemodus wählen"

[dialog.saving]
in_background = "Ihre Aufnahme wird noch gespeichert und erscheint in Ihrer Bibliothek, sobald sie fertig ist. Sie können jetzt eine neue Aufnahme starten."
stalled = "Beim Speichern Ihrer Aufnahme ging es nicht mehr voran. Es wurde nichts gelöscht. Falls sie nicht in Ihrer Bibliothek erscheint, bietet Cap beim nächsten Start an, sie wiederherzustellen. Sie können jetzt eine neue Aufnahme starten."
stalled_title = "Noch nicht gespeichert"
title = "Wird noch gespeichert"

[dialog.storage]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,8 @@ title = "Choose Recording Mode"

[dialog.saving]
in_background = "Your recording is still saving and will appear in your library when it is done. You can start a new recording now."
stalled = "Your recording stopped making progress while it was saving. Nothing was deleted. If it does not appear in your library, Cap will offer to recover it the next time it starts. You can start a new recording now."
stalled_title = "Not saved yet"
title = "Still saving"

[dialog.storage]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,8 @@ title = "Elegir modo de grabación"

[dialog.saving]
in_background = "Tu grabación todavía se está guardando y aparecerá en tu biblioteca cuando termine. Ya puedes iniciar una nueva grabación."
stalled = "Tu grabación dejó de avanzar mientras se guardaba. No se ha borrado nada. Si no aparece en tu biblioteca, Cap te ofrecerá recuperarla la próxima vez que se inicie. Ya puedes iniciar una nueva grabación."
stalled_title = "Aún no se ha guardado"
title = "Todavía se está guardando"

[dialog.storage]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,8 @@ title = "Choisir le mode d'enregistrement"

[dialog.saving]
in_background = "Votre enregistrement est encore en cours de sauvegarde et apparaîtra dans votre bibliothèque une fois terminé. Vous pouvez lancer un nouvel enregistrement dès maintenant."
stalled = "La sauvegarde de votre enregistrement a cessé de progresser. Rien n'a été supprimé. S'il n'apparaît pas dans votre bibliothèque, Cap vous proposera de le récupérer à son prochain démarrage. Vous pouvez lancer un nouvel enregistrement dès maintenant."
stalled_title = "Pas encore sauvegardé"
title = "Sauvegarde en cours"

[dialog.storage]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/hi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,8 @@ title = "रिकॉर्डिंग मोड चुनें"

[dialog.saving]
in_background = "आपकी रिकॉर्डिंग अभी सहेजी जा रही है और पूरी होने पर आपकी लाइब्रेरी में दिखेगी। आप अभी नई रिकॉर्डिंग शुरू कर सकते हैं।"
stalled = "सहेजते समय आपकी रिकॉर्डिंग का आगे बढ़ना रुक गया। कुछ भी हटाया नहीं गया है। अगर यह आपकी लाइब्रेरी में नहीं दिखती, तो Cap अगली बार शुरू होने पर इसे रिकवर करने का विकल्प देगा। आप अभी नई रिकॉर्डिंग शुरू कर सकते हैं।"
stalled_title = "अभी तक सहेजा नहीं गया"
title = "अभी सहेजा जा रहा है"

[dialog.storage]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/ja.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,8 @@ title = "録画モードを選択"

[dialog.saving]
in_background = "録画はまだ保存中です。完了するとライブラリに表示されます。新しい録画をすぐに開始できます。"
stalled = "録画の保存が途中で進まなくなりました。削除されたものはありません。ライブラリに表示されない場合は、次回 Cap を起動したときに復元できます。新しい録画をすぐに開始できます。"
stalled_title = "まだ保存されていません"
title = "保存中です"

[dialog.storage]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/zh-CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,8 @@ title = "选择录制模式"

[dialog.saving]
in_background = "你的录制仍在保存,完成后会显示在你的资料库中。你现在可以开始新的录制。"
stalled = "你的录制在保存时停止了进展。没有删除任何内容。如果它没有出现在你的资料库中,下次启动 Cap 时会提示你恢复它。你现在可以开始新的录制。"
stalled_title = "尚未保存"
title = "仍在保存"

[dialog.storage]
Expand Down
5 changes: 5 additions & 0 deletions apps/desktop-gpui/src/i18n/dialogs_surface_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ fn dialog_surfaces_match_the_literals_they_replaced() {
tr::dialog::saving::in_background(),
"Your recording is still saving and will appear in your library when it is done. You can start a new recording now.",
),
(
tr::dialog::saving::stalled(),
"Your recording stopped making progress while it was saving. Nothing was deleted. If it does not appear in your library, Cap will offer to recover it the next time it starts. You can start a new recording now.",
),
(tr::dialog::saving::stalled_title(), "Not saved yet"),
(tr::dialog::saving::title(), "Still saving"),
(
tr::dialog::storage::stopped_kept(),
Expand Down
18 changes: 12 additions & 6 deletions apps/desktop-gpui/src/main_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,17 @@ impl MainWindow {
debug_assert!(!still_saving);
#[cfg(windows)]
if still_saving {
let (title, message) = if session.read(cx).recording_save_stalled {
(
tr::dialog::saving::stalled_title(),
tr::dialog::saving::stalled(),
)
} else {
(
tr::dialog::saving::title(),
tr::dialog::saving::in_background(),
)
};
// Shown in the window: a native dialog can stall the
// window while the earlier recording is still being written.
let main = cx.global::<app_windows::AppWindows>().main;
Expand All @@ -1250,12 +1261,7 @@ impl MainWindow {
app_windows::show_main_window(cx);
cx.activate(true);
main.update(cx, |_, window, cx| {
crate::editor_modal::informational_alert(
&tr::dialog::saving::title(),
&tr::dialog::saving::in_background(),
window,
cx,
)
crate::editor_modal::informational_alert(title, message, window, cx)
})
});
if let Ok(response) = response {
Expand Down
40 changes: 33 additions & 7 deletions apps/desktop-gpui/src/recording.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,17 +669,35 @@ impl std::fmt::Display for StudioStillSaving {
#[cfg(windows)]
impl std::error::Error for StudioStillSaving {}

/// Stop handed the app back because the recording stopped making progress
/// while saving, so it is not expected to finish.
#[cfg(windows)]
#[derive(Debug)]
pub(crate) struct StudioSaveStalled;

#[cfg(windows)]
impl std::fmt::Display for StudioSaveStalled {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("The recording stopped making progress while saving")
}
}

#[cfg(windows)]
impl std::error::Error for StudioSaveStalled {}

#[cfg(windows)]
async fn wait_for_studio_finish(
outcome: studio_recording::StudioStopOutcome,
) -> Result<studio_recording::StudioStopOutcome, studio_recording::StudioFinishing> {
let Some(finishing) = outcome.finishing.clone() else {
return Ok(outcome);
};
match tokio::time::timeout(STUDIO_FINISH_WAIT, finishing.wait()).await {
Ok(outcome) => Ok(outcome),
Err(_) => Err(finishing),
}
let finished = tokio::select! {
biased;
finished = tokio::time::timeout(STUDIO_FINISH_WAIT, finishing.wait()) => finished.ok(),
() = finishing.stalled() => None,
};
finished.ok_or(finishing)
}

/// Keeps waiting for a failed Studio stop the app stopped waiting for and
Expand Down Expand Up @@ -718,6 +736,7 @@ async fn finish_late_studio_stop(
in_progress: Arc<crate::library::RecordingInProgress>,
) -> (bool, anyhow::Result<PathBuf>) {
let path = finishing.project_path().to_path_buf();
let tracks = finishing.clone();
let mut save = tokio::spawn(async move {
let _in_progress = in_progress;
let _finishing = finishing.clone();
Expand All @@ -733,7 +752,14 @@ async fn finish_late_studio_stop(
)
.await
});
match tokio::time::timeout(STUDIO_FINISH_WAIT, &mut save).await {
let saved = tokio::select! {
biased;
saved = tokio::time::timeout(STUDIO_FINISH_WAIT, &mut save) => {
saved.map_err(|_| anyhow::Error::new(StudioStillSaving))
}
() = tracks.stalled() => Err(anyhow::Error::new(StudioSaveStalled)),
};
match saved {
Ok(joined) => joined.unwrap_or_else(|error| {
(
true,
Expand All @@ -742,7 +768,7 @@ async fn finish_late_studio_stop(
)),
)
}),
Err(_) => {
Err(handed_back) => {
tracing::warn!(path = %path.display(), "Studio recording is still saving; finishing it in the background");
drop(tokio::spawn(async move {
match save.await {
Expand All @@ -759,7 +785,7 @@ async fn finish_late_studio_stop(
}
refresh_library_after_background_save().await;
}));
(true, Err(anyhow::Error::new(StudioStillSaving)))
(true, Err(handed_back))
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions apps/desktop-gpui/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ pub struct RecordingSession {
pub capture_source_lost: bool,
/// Stop handed the app back while the last recording was still saving.
pub recording_still_saving: bool,
/// That recording stopped making progress, so it is not expected to
/// finish saving in this session.
#[cfg(windows)]
pub recording_save_stalled: bool,
stopped_for_low_storage: bool,
stopped_elapsed: Option<Duration>,
/// The config of the live (or last) recording, kept for restart.
Expand Down Expand Up @@ -534,6 +538,8 @@ impl RecordingSession {
storage_notice: None,
capture_source_lost: false,
recording_still_saving: false,
#[cfg(windows)]
recording_save_stalled: false,
stopped_for_low_storage: false,
stopped_elapsed: None,
last_config: None,
Expand Down Expand Up @@ -845,6 +851,10 @@ impl RecordingSession {
self.storage_notice = None;
self.capture_source_lost = false;
self.recording_still_saving = false;
#[cfg(windows)]
{
self.recording_save_stalled = false;
}
self.stopped_for_low_storage = false;
self.stopped_elapsed = None;
self.last_config = Some(config.clone());
Expand Down Expand Up @@ -1715,6 +1725,18 @@ impl RecordingSession {
tracing::warn!("Studio recording is still saving; the app is free for a new recording");
this.capture_source_lost = false;
this.recording_still_saving = true;
this.recording_save_stalled = false;
}
#[cfg(windows)]
Ok(Err(error))
if error
.chain()
.any(|cause| cause.is::<crate::recording::StudioSaveStalled>()) =>
{
tracing::warn!("Studio recording stopped making progress while saving; the app is free for a new recording");
this.capture_source_lost = false;
this.recording_still_saving = true;
this.recording_save_stalled = true;
}
Ok(Err(error)) => {
tracing::error!("recording failed to stop cleanly: {error:#}");
Expand Down
2 changes: 2 additions & 0 deletions crates/enc-ffmpeg/src/mux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ pub mod segmented_audio;
pub mod segmented_stream;
pub(crate) mod write_behind;

#[cfg(windows)]
pub use write_behind::StorageCall;
pub use write_behind::StorageStalled;
Loading
Loading