Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: show permission recovery during headless startup (#5248)

Ezra Ellette1ae24300e548
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/headless.rs b/apps/screenpipe-app-tauri/src-tauri/src/headless.rs
index caa94c8db..a571a31b8 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/headless.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/headless.rs
@@ -26,6 +26,10 @@ pub fn is_dormant() -> bool {
UI_DORMANT.load(Ordering::SeqCst)
}
+pub fn should_suppress_window(dormant: bool, is_permission_recovery: bool) -> bool {
+ dormant && !is_permission_recovery
+}
+
/// Sync dormant/record-only state to an enterprise hidden-UI policy that flipped
/// mid-session. The enterprise enforcement path hides (not destroys) windows, so
/// this only flips the flags that gate pipe suppression and tray wake — without
@@ -194,7 +198,7 @@ pub fn wake_from_tray(app: &AppHandle) {
#[cfg(test)]
mod tests {
- use super::{should_start_dormant, should_suppress_pipe_runs};
+ use super::{should_start_dormant, should_suppress_pipe_runs, should_suppress_window};
#[test]
fn headless_startup_never_blocks_incomplete_onboarding() {
@@ -209,4 +213,11 @@ mod tests {
assert!(!should_suppress_pipe_runs(true, false));
assert!(!should_suppress_pipe_runs(false, true));
}
+
+ #[test]
+ fn dormant_ui_still_allows_permission_recovery() {
+ assert!(should_suppress_window(true, false));
+ assert!(!should_suppress_window(true, true));
+ assert!(!should_suppress_window(false, false));
+ }
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs b/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs
index f995c34f5..c2e98b8e5 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs
@@ -445,8 +445,14 @@ impl ShowRewindWindow {
)));
}
- if crate::headless::is_dormant() {
- info!("headless: suppressed '{}' window while UI is dormant", id.label());
+ if crate::headless::should_suppress_window(
+ crate::headless::is_dormant(),
+ id == RewindWindowId::PermissionRecovery,
+ ) {
+ info!(
+ "headless: suppressed '{}' window while UI is dormant",
+ id.label()
+ );
return Err(tauri::Error::Anyhow(anyhow::anyhow!(
"window suppressed while headless UI is dormant: {}",
id.label()