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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(privacy): exclude audio from AI redaction and fix queue ordering (#7768)
Louis Beaumont5ff3e496460b
diff --git a/apps/screenpipe-app-tauri/components/settings/privacy-processing-status.test.tsx b/apps/screenpipe-app-tauri/components/settings/privacy-processing-status.test.tsxindex 21454dd18..c4025178d 100644--- a/apps/screenpipe-app-tauri/components/settings/privacy-processing-status.test.tsx+++ b/apps/screenpipe-app-tauri/components/settings/privacy-processing-status.test.tsx@@ -2,7 +2,7 @@// https://screenpipe.comimport React from "react";import { afterEach, describe, expect, it, vi } from "vitest";-import { act, cleanup, render, screen, waitFor } from "@testing-library/react";+import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";import { PrivacyProcessingStatus, PrivacyStatusView, type PrivacyQueueStatus } from "./privacy-processing-status";import { localFetch } from "@/lib/api";vi.mock("@/lib/api", () => ({ localFetch: vi.fn() }));@@ -13,6 +13,21 @@ const status: PrivacyQueueStatus = { enabled:true,scope:"protected_capture_surfa] };afterEach(() => { cleanup(); vi.useRealTimers(); vi.clearAllMocks(); });describe("privacy processing status", () => {+ it("keeps queue counts visible while explanatory details are collapsed", () => {+ render(<PrivacyStatusView status={status} unavailable={false} />);+ const toggle = screen.getByRole("button", { name: "About these counts" });+ expect(toggle).toHaveAttribute("aria-expanded", "false");+ expect(screen.getByText("12")).toBeVisible();+ expect(screen.getByText("5")).toBeVisible();+ expect(screen.queryByText(/This status covers privacy processing/)).toBeNull();+ fireEvent.click(toggle);+ expect(toggle).toHaveAttribute("aria-expanded", "true");+ expect(screen.getByText(/This status covers privacy processing/)).toBeVisible();+ fireEvent.click(toggle);+ expect(toggle).toHaveAttribute("aria-expanded", "false");+ expect(screen.getByText("12")).toBeVisible();+ expect(screen.getByText("5")).toBeVisible();+ });it("shows pending text and images separately without claiming synced", () => {render(<PrivacyStatusView status={status} unavailable={false} />);expect(screen.getByRole("status").textContent).toBe("Privacy processing");diff --git a/apps/screenpipe-app-tauri/components/settings/privacy-processing-status.tsx b/apps/screenpipe-app-tauri/components/settings/privacy-processing-status.tsxindex 9485e7d26..0e5490646 100644--- a/apps/screenpipe-app-tauri/components/settings/privacy-processing-status.tsx+++ b/apps/screenpipe-app-tauri/components/settings/privacy-processing-status.tsx@@ -4,6 +4,7 @@import { useEffect, useState } from "react";import { useGT } from "gt-react";+import { ChevronDown } from "lucide-react";import { localFetch } from "@/lib/api";import { PRIVACY_STATUS_POLL_INTERVAL_MS } from "@/lib/privacy-processing";@@ -35,10 +36,17 @@ export function PrivacyStatusView({ status, unavailable }: {unavailable: boolean;}) {const ui = useGT();+ const [detailsOpen, setDetailsOpen] = useState(false);const discovering = status?.surfaces.some((s) => s.discovering);const pending = status?.surfaces.reduce((sum, s) => sum + s.pending, 0) ?? 0;- const textEnabled = status?.surfaces.some((s) => s.kind !== "image");- const imageEnabled = status?.surfaces.some((s) => s.kind === "image");+ const textSurfaces = status?.surfaces.filter((s) => s.kind !== "image") ?? [];+ const imageSurface = status?.surfaces.find((s) => s.kind === "image");+ const textEnabled = textSurfaces.length > 0;+ const imageEnabled = !!imageSurface;+ const textPending = textSurfaces.reduce((sum, s) => sum + s.pending, 0);+ const textPendingCapped = textSurfaces.some((s) => s.pending_capped || s.discovering);+ const imagePending = imageSurface?.pending ?? 0;+ const imagePendingCapped = !!imageSurface && (imageSurface.pending_capped || imageSurface.discovering);const retrying = status?.surfaces.some((s) => s.deferred > 0);const title = unavailable ? ui("Processing status unavailable"): !status ? ui("Checking privacy processing")@@ -54,18 +62,29 @@ export function PrivacyStatusView({ status, unavailable }: {: status && !status.enabled ? ui("Protection is not active in the recording engine yet. Check your recording settings if this persists."): ui("Recording continues. New data becomes available after its privacy checks finish.")}</p>- {status?.enabled && !unavailable && <details className="mt-2 text-muted-foreground">- <summary className="cursor-pointer w-fit">{ui("Processing details")}</summary>- <dl className="mt-2 grid grid-cols-2 gap-x-4 gap-y-1 max-w-sm">+ {status?.enabled && !unavailable && <div className="mt-3 border-t border-border pt-2">+ <dl className="grid max-w-sm grid-cols-[1fr_auto] gap-x-4 gap-y-1.5 text-xs text-muted-foreground"><dt>{ui("Text records waiting")}</dt>- <dd>{!textEnabled ? ui("Not enabled") : <>{status.surfaces.filter((s) => s.kind !== "image").reduce((sum, s) => sum + s.pending, 0).toLocaleString()}{status.surfaces.some((s) => s.kind !== "image" && (s.pending_capped || s.discovering)) ? "+" : ""}</>}</dd>+ <dd className="text-right font-medium tabular-nums text-foreground">{!textEnabled ? ui("Not enabled") : <>{textPending.toLocaleString()}{textPendingCapped ? "+" : ""}</>}</dd><dt>{ui("Screenshots waiting")}</dt>- <dd>{!imageEnabled ? ui("Not enabled") : <>{status.surfaces.find((s) => s.kind === "image")?.pending.toLocaleString() ?? "0"}{status.surfaces.some((s) => s.kind === "image" && (s.pending_capped || s.discovering)) ? "+" : ""}</>}</dd>+ <dd className="text-right font-medium tabular-nums text-foreground">{!imageEnabled ? ui("Not enabled") : <>{imagePending.toLocaleString()}{imagePendingCapped ? "+" : ""}</>}</dd></dl>- {discovering && <p className="mt-2">{ui("Counts may increase while existing history is checked.")}</p>}- <p className="mt-2">{ui("Text and screenshots finish separately. This status covers privacy processing, not upload completion.")}</p>- <p className="mt-1">{ui("Some live and derived-data features are unavailable with protection enabled.")}</p>- </details>}+ {discovering && <p className="mt-1.5 text-xs text-muted-foreground">{ui("Scanning existing history. Counts can increase while discovery continues.")}</p>}+ <button+ type="button"+ aria-expanded={detailsOpen}+ aria-controls="privacy-processing-details"+ onClick={() => setDetailsOpen((open) => !open)}+ className="mt-2 flex items-center gap-1.5 text-left text-xs text-muted-foreground hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground"+ >+ <span className="font-medium">{ui("About these counts")}</span>+ <ChevronDown aria-hidden="true" size={14} className={`shrink-0 transition-transform ${detailsOpen ? "rotate-180" : ""}`} />+ </button>+ {detailsOpen && <div id="privacy-processing-details" className="mt-2 space-y-1.5 text-xs text-muted-foreground">+ <p>{ui("Text and screenshots finish separately. This status covers privacy processing, not upload completion.")}</p>+ <p>{ui("Some live and derived-data features are unavailable with protection enabled.")}</p>+ </div>}+ </div>}</div>;}diff --git a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsxindex 4cbc408af..9872a0a88 100644--- a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx+++ b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx@@ -363,7 +363,7 @@ function RedactionWherePreview({<div className="h-1.5 w-full rounded bg-foreground" /><div className="h-1.5 w-4/5 rounded bg-foreground" /><div className="text-[9px] text-muted-foreground">- Typed text, transcripts & on-screen text — always hidden+ Typed text & on-screen text — always hidden</div></div></div>@@ -595,7 +595,9 @@ export function PrivacySection() {// Where the AI workers run — one switch covers both modalities.const piiBackend = (settings.piiBackend as "local" | "tinfoil" | undefined) ?? "local";const handlePiiBackendChange = (next: "local" | "tinfoil") => {- if (sharingRequiresCloud) return;+ // Sharing requires the enclave, but keep Cloud selectable so a stale or+ // partially migrated Local setting can be repaired from this screen.+ if (sharingRequiresCloud && next !== "tinfoil") return;handleSettingsChange({ piiBackend: next } as any, true);};@@ -656,7 +658,7 @@ export function PrivacySection() {};// Secrets-only scrub of coding-agent (pi) session logs at rest. Distinct- // from the screen/audio PII workers above: agents persist full sessions+ // from the screen PII workers above: agents persist full sessions// (bash output, tool args) unredacted, so credentials land in plaintext on// disk. Regex secrets-only + on-device; opt-in, default off.const redactAgentSessionSecrets = Boolean(@@ -670,7 +672,7 @@ export function PrivacySection() {};// WHICH captured columns get scrubbed (orthogonal to the categories- // above). Typed text / clipboard / transcripts / window titles /+ // above). Typed text / clipboard / window titles /// on-screen text are always redacted; these extra surfaces are opt-in.// Stored as the full list of stable column keys in `piiRedactionColumns`// (see `RedactColumns` in screenpipe-redact). The core keys are always@@ -679,7 +681,6 @@ export function PrivacySection() {"accessibility_text","accessibility_tree","window_name",- "audio_transcription","ui_text_content","ui_element_value","ui_window_title",@@ -1460,7 +1461,7 @@ export function PrivacySection() {</span><span className="text-muted-foreground">{" "}— scrub captured text (OCR, accessibility,- transcripts, typed & clipboard input)+ typed & clipboard input)</span></span></label>@@ -1488,11 +1489,16 @@ export function PrivacySection() {</div></div>)}+ <p className="mt-2 text-xs text-muted-foreground">+ Audio and meeting transcripts are excluded from AI redaction,+ including when synced. Basic pattern filtering remains available.+ </p>+{(aiPiiRemovalEnabled || sharingRequiresCloud) && (<div id="workflow-cloud-redaction" className="mt-3 ml-6 space-y-2 border-l-2 border-border pl-3"><div className="flex flex-wrap items-center gap-x-4 gap-y-1 text-xs"><span className="font-medium text-foreground">Where it runs</span>- <label className={`flex items-center gap-1.5 ${managedPiiBackend ? "cursor-not-allowed opacity-60" : "cursor-pointer"}`}>+ <label className={`flex items-center gap-1.5 ${managedPiiBackend || sharingRequiresCloud ? "cursor-not-allowed opacity-60" : "cursor-pointer"}`}><inputtype="radio"name="piiBackend"@@ -1507,14 +1513,16 @@ export function PrivacySection() {type="radio"name="piiBackend"checked={piiBackend === "tinfoil"}- disabled={!!managedPiiBackend || sharingRequiresCloud}+ disabled={!!managedPiiBackend}onChange={() => handlePiiBackendChange("tinfoil")}/><span className="text-foreground">Cloud (enclave)</span></label></div><p className="text-[11px] text-muted-foreground">- {sharingRequiresCloud && <span className="block font-medium">Required while Workflows sharing is on. Turn off sharing above to change it. Shared chats always redact all sensitive categories; the choices below apply to recordings.</span>}+ {sharingRequiresCloud && <span className="block font-medium">{piiBackend === "tinfoil"+ ? "Cloud redaction is required while Workflows sharing is on. The choices below control redaction in recordings."+ : "Workflows sharing requires Cloud (enclave), but this device is still set to Local. Choose Cloud, then apply the change."}</span>}Local stays on-device — strongest privacy, slower on weakhardware. Cloud uses screenpipe's attestedconfidential-compute enclave — fast everywhere; your device@@ -1592,7 +1600,7 @@ export function PrivacySection() {<div className="mt-2 space-y-1.5"><p className="text-[11px] text-muted-foreground">We always scan what you type, your clipboard,- transcripts, window titles, and on-screen text. Turn on+ window titles, and on-screen text. Turn onany of these extra places the same info can hide —hover a row to see what it covers.</p>diff --git a/crates/screenpipe-config/src/recording.rs b/crates/screenpipe-config/src/recording.rsindex 30e55696d..a5afc4970 100644--- a/crates/screenpipe-config/src/recording.rs+++ b/crates/screenpipe-config/src/recording.rs@@ -1103,7 +1103,6 @@ fn default_pii_redaction_columns() -> Vec<String> {"accessibility_text","accessibility_tree","window_name",- "audio_transcription","ui_text_content","ui_element_value","ui_window_title",diff --git a/crates/screenpipe-db/src/db/privacy_release.rs b/crates/screenpipe-db/src/db/privacy_release.rsindex 0bbd40907..3069a052d 100644--- a/crates/screenpipe-db/src/db/privacy_release.rs+++ b/crates/screenpipe-db/src/db/privacy_release.rs@@ -117,7 +117,12 @@ pub(crate) const SURFACES: &[Surface] = &[},];-/// Text worker scheduling follows the same registry as receipts and read gates.+/// Audio receipts track sync revisions only; transcripts never require AI redaction.+pub fn is_audio_surface(kind: &str) -> bool {+ matches!(kind, "audio" | "segments")+}++/// Scheduling includes audio receipt bookkeeping, which never invokes a detector.pub fn text_release_kinds() -> Vec<&'static str> {SURFACES.iter()@@ -454,7 +459,14 @@ impl DatabaseManager {// Candidate traversal is bounded even for malformed/future timestamps.// Young images move to a future deadline; subsequent polls advance past// them. The source lookup never scans certified capture history.- let sql = format!("WITH candidates AS MATERIALIZED (SELECT kind,id,available_at,sequence FROM _privacy_work INDEXED BY _privacy_work_due WHERE kind=? AND available_at<=unixepoch() ORDER BY available_at {order},sequence {order} LIMIT 256) SELECT CAST(s.id AS TEXT) AS source_id,r.revision,{columns} FROM candidates w CROSS JOIN _privacy_release r ON r.kind=w.kind AND r.id=w.id CROSS JOIN {} s ON s.id=w.id WHERE r.policy IS NULL{age} ORDER BY w.available_at {order},w.sequence {order} LIMIT ?", surface.table);+ // Audio no longer uses the detector that scheduled old retry deadlines.+ // Complete its revision bookkeeping without waiting for those failures.+ let due = if is_audio_surface(kind) {+ "1"+ } else {+ "available_at<=unixepoch()"+ };+ let sql = format!("WITH candidates AS MATERIALIZED (SELECT kind,id,available_at,sequence FROM _privacy_work INDEXED BY _privacy_work_due WHERE kind=? AND {due} ORDER BY available_at {order},sequence {order} LIMIT 256) SELECT CAST(s.id AS TEXT) AS source_id,r.revision,{columns} FROM candidates w CROSS JOIN _privacy_release r ON r.kind=w.kind AND r.id=w.id CROSS JOIN {} s ON s.id=w.id WHERE r.policy IS NULL{age} ORDER BY w.available_at {order},w.sequence {order} LIMIT ?", surface.table);let mut rows = sqlx::query(sqlx::AssertSqlSafe(sql.clone())).bind(kind).bind(limit.min(256))@@ -573,22 +585,27 @@ impl DatabaseManager {if complete {return Ok(());}- let ids: Vec<i64> = sqlx::query_scalar(sqlx::AssertSqlSafe(format!(- "SELECT id FROM {} WHERE id>? ORDER BY id LIMIT 128",+ let ids: Vec<(i64, bool)> = sqlx::query_as(sqlx::AssertSqlSafe(format!(+ "SELECT s.id,EXISTS(SELECT 1 FROM _privacy_work w WHERE w.kind=? AND w.id=CAST(s.id AS TEXT)) FROM {} s WHERE s.id>? ORDER BY s.id LIMIT 128",surface.table)))+ .bind(surface.kind).bind(after).fetch_all(&mut **tx.conn()).await?;- for id in &ids {+ for (id, already_queued) in &ids {sqlx::query("INSERT INTO _privacy_release(kind,id) VALUES(?,CAST(? AS TEXT)) ON CONFLICT(kind,id) DO UPDATE SET policy=NULL,attempts=0,retry_at=NULL WHERE policy IS NOT NULL AND policy!=(SELECT receipt_key FROM _privacy_policy WHERE identity=?)").bind(surface.kind).bind(id).bind(policy).execute(&mut **tx.conn()).await?;- // Also enroll pending receipts written by earlier draft versions.- sqlx::query("INSERT OR IGNORE INTO _privacy_work(kind,id,available_at) SELECT kind,id,COALESCE(retry_at,unixepoch()) FROM _privacy_release WHERE kind=? AND id=CAST(? AS TEXT) AND policy IS NULL")- .bind(surface.kind).bind(id).execute(&mut **tx.conn()).await?;+ // Discovery is old work even though enrollment happens now. Giving+ // it today's queue time lets every history page jump ahead of live+ // capture in the recent-first lane. Keep existing capture/retry+ // deadlines, and enroll newly discovered history at the old end.+ // This also recovers pending receipts from earlier draft versions.+ sqlx::query("INSERT INTO _privacy_work(kind,id,available_at) SELECT kind,id,COALESCE(retry_at,0) FROM _privacy_release WHERE kind=? AND id=CAST(? AS TEXT) AND policy IS NULL ON CONFLICT(kind,id) DO UPDATE SET available_at=excluded.available_at WHERE ?=0")+ .bind(surface.kind).bind(id).bind(already_queued).execute(&mut **tx.conn()).await?;}sqlx::query("UPDATE _privacy_discovery SET after_id=?,complete=? WHERE kind=?")- .bind(ids.last().copied().unwrap_or(after))+ .bind(ids.last().map(|(id, _)| *id).unwrap_or(after)).bind(ids.len() < 128).bind(surface.kind).execute(&mut **tx.conn())@@ -749,7 +766,10 @@ impl DatabaseManager {}let storage = self.storage.clone();let mut views = Vec::new();- for surface in SURFACES.iter().filter(|s| s.kind != "image") {+ for surface in SURFACES+ .iter()+ .filter(|s| s.kind != "image" && !is_audio_surface(s.kind))+ {let exists: bool =sqlx::query_scalar("SELECT EXISTS(SELECT 1 FROM sqlite_master WHERE name=?)").bind(surface.table)@@ -887,7 +907,6 @@ impl DatabaseManager {for (kind, table, timestamp) in [("frames", "frames", "timestamp"),("input", "ui_events", "timestamp"),- ("audio", "audio_transcriptions", "timestamp"),] {let pending: bool = sqlx::query_scalar(sqlx::AssertSqlSafe(format!("SELECT EXISTS(SELECT 1 FROM {table} s CROSS JOIN _privacy_policy p WHERE p.id=1 AND s.{timestamp}>=? AND s.{timestamp}<? AND julianday(s.{timestamp}) BETWEEN julianday(?) AND julianday(?) AND NOT EXISTS(SELECT 1 FROM _privacy_release r WHERE r.kind=? AND r.id=CAST(s.id AS TEXT) AND r.policy=CAST(p.receipt_key AS TEXT)))")))@@ -1109,7 +1128,7 @@ impl DatabaseManager {if s.kind == "image" {policy.images} else {- policy.text+ policy.text && !is_audio_surface(s.kind)}}) {let complete: bool = sqlx::query_scalar("SELECT EXISTS(SELECT 1 FROM _privacy_discovery WHERE kind=? AND policy=? AND complete=1)")diff --git a/crates/screenpipe-engine/src/cli/mod.rs b/crates/screenpipe-engine/src/cli/mod.rsindex 21cf6f438..0508276fd 100644--- a/crates/screenpipe-engine/src/cli/mod.rs+++ b/crates/screenpipe-engine/src/cli/mod.rs@@ -534,7 +534,7 @@ pub struct RecordArgs {/// Enable the async PII reconciliation worker. Runs a background/// task after capture that OVERWRITES PII in the source columns- /// of ocr_text, audio_transcriptions, frames.accessibility_text,+ /// of ocr_text, frames.accessibility_text,/// ui_events.text_content, and elements.text. Raw secrets are/// gone after the worker processes the row. Off by default —/// capture path is unaffected either way.@@ -582,7 +582,7 @@ pub struct RecordArgs {/// WHICH columns the redaction worker scrubs (comma-separated stable/// keys; orthogonal to --pii-redaction-labels which picks categories)./// Keys: accessibility_text, accessibility_tree, window_name,- /// browser_url, audio_transcription, ui_text_content, ui_element_value,+ /// browser_url, ui_text_content, ui_element_value,/// ui_window_title, ui_element_name, ui_element_description,/// ui_element_ancestors, element_text, element_properties,/// a11y_url_field. The list is exact (key present → on, absent → off);@@ -596,7 +596,7 @@ pub struct RecordArgs {#[arg(long,value_delimiter = ',',- default_value = "accessibility_text,accessibility_tree,window_name,audio_transcription,ui_text_content,ui_element_value,ui_window_title,ui_element_ancestors,element_text,element_properties"+ default_value = "accessibility_text,accessibility_tree,window_name,ui_text_content,ui_element_value,ui_window_title,ui_element_ancestors,element_text,element_properties")]pub pii_redaction_columns: Vec<String>,diff --git a/crates/screenpipe-engine/src/routes/privacy_release.rs b/crates/screenpipe-engine/src/routes/privacy_release.rsindex 434126b96..16905f7fd 100644--- a/crates/screenpipe-engine/src/routes/privacy_release.rs+++ b/crates/screenpipe-engine/src/routes/privacy_release.rs@@ -24,14 +24,12 @@ pub(crate) async fn release_middleware(return next.run(request).await;}let path = request.uri().path();- // These endpoints expose raw containers, files, live events, or unverified+ // Meeting/audio streams are exempt; /ws/events filters other content.+ // These endpoints expose raw containers, files, or unverified// derivatives. They cannot borrow a frame-text receipt as authorization.- if matches!(- path,- "/raw_sql" | "/export" | "/ws/events" | "/ws/meeting-overlay" | "/ws/meeting-status"- ) || path.starts_with("/frames/preview-media/")+ if matches!(path, "/raw_sql" | "/export")+ || path.starts_with("/frames/preview-media/")|| path.starts_with("/artifacts")- || path.starts_with("/speakers/sample/")|| path == "/data/backup"|| path == "/stream/frames"|| (request.method() == axum::http::Method::POST@@ -217,6 +215,81 @@ mod tests {let client = reqwest::Client::new();let base = format!("http://{address}");let search = format!("{base}/search?content_type=ocr&limit=10");+ // Audio is available even with a pending screen privacy backlog.+ db.execute_raw_sql_write("INSERT INTO audio_chunks(id,file_path) VALUES(1,'test.wav'); INSERT INTO audio_transcriptions(id,audio_chunk_id,offset_index,timestamp,transcription,device) VALUES(1,1,0,'2026-10-14T10:00:00Z','AUDIO_EXEMPT_SECRET','test'); INSERT INTO meeting_transcript_segments(meeting_id,provider,item_id,transcript,captured_at) VALUES(1,'test','one','AUDIO_EXEMPT_SECRET','2026-10-14T10:00:00Z')").await.unwrap();+ // The real websocket routes stay available, and the shared route+ // forwards audio without leaking screen events under protection.+ use futures::StreamExt;+ for path in ["/ws/meeting-status", "/ws/meeting-overlay"] {+ let (mut socket, _) = tokio_tungstenite::connect_async(format!("ws://{address}{path}"))+ .await+ .unwrap();+ assert!(+ tokio::time::timeout(std::time::Duration::from_secs(5), socket.next())+ .await+ .unwrap()+ .unwrap()+ .is_ok()+ );+ socket.close(None).await.unwrap();+ }+ let (mut socket, _) = tokio_tungstenite::connect_async(format!("ws://{address}/ws/events"))+ .await+ .unwrap();+ let mut tick = tokio::time::interval(std::time::Duration::from_millis(20));+ let received = tokio::time::timeout(std::time::Duration::from_secs(5), async {+ loop {+ tokio::select! {+ _ = tick.tick() => {+ let _ = screenpipe_events::send_event("ocr_result", serde_json::json!({"text":"SCREEN_MUST_STAY_PRIVATE"}));+ let _ = screenpipe_events::send_event("meeting_transcript_delta", serde_json::json!({"delta":"AUDIO_EXEMPT_SECRET"}));+ }+ message = socket.next() => {+ let message = message.unwrap().unwrap();+ if let tokio_tungstenite::tungstenite::Message::Text(text) = message {+ assert!(!text.contains("SCREEN_MUST_STAY_PRIVATE"));+ if text.contains("AUDIO_EXEMPT_SECRET") { break text; }+ }+ }+ }+ }+ }).await.unwrap();+ assert!(received.contains("AUDIO_EXEMPT_SECRET"));+ assert!(!received.contains("SCREEN_MUST_STAY_PRIVATE"));+ socket.close(None).await.unwrap();+ let audio = client+ .get(format!("{base}/search?content_type=audio&limit=10"))+ .send()+ .await+ .unwrap()+ .error_for_status()+ .unwrap()+ .text()+ .await+ .unwrap();+ assert!(audio.contains("AUDIO_EXEMPT_SECRET"));+ let transcript = client+ .get(format!("{base}/meetings/1/transcript"))+ .send()+ .await+ .unwrap()+ .error_for_status()+ .unwrap()+ .text()+ .await+ .unwrap();+ assert!(transcript.contains("AUDIO_EXEMPT_SECRET"));+ let sample = client+ .get(format!("{base}/speakers/sample/999999"))+ .send()+ .await+ .unwrap();+ assert_ne!(+ sample.status().as_u16(),+ 503,+ "audio samples must not be privacy-gated"+ );+let meeting: serde_json::Value = client.get(format!("{base}/meetings/1")).send()@@ -263,7 +336,6 @@ mod tests {"/frames/1","/frames/1/thumbnail","/frames/preview-media/1",- "/speakers/sample/1","/stream/frames","/data/backup",] {diff --git a/crates/screenpipe-engine/src/routes/websocket.rs b/crates/screenpipe-engine/src/routes/websocket.rsindex 05e80b892..2cdbd0e94 100644--- a/crates/screenpipe-engine/src/routes/websocket.rs+++ b/crates/screenpipe-engine/src/routes/websocket.rs@@ -264,6 +264,21 @@ pub(crate) struct EventsQuery {images: Option<bool>,}+// Under screen privacy protection the shared socket carries only audio events.+// Keep this explicit: unknown future events may contain raw screen content.+fn audio_event_allowed(name: &str) -> bool {+ matches!(+ name,+ "meeting_transcript_delta"+ | "meeting_transcript_final"+ | "meeting_status_changed"+ | "meeting_streaming_status_changed"+ | "meeting_streaming_session_started"+ | "meeting_streaming_session_ended"+ | "meeting_streaming_error"+ )+}+// websocket events handlerpub(crate) async fn ws_events_handler(ws: WebSocketUpgrade,@@ -272,10 +287,11 @@ pub(crate) async fn ws_events_handler(query: Query<EventsQuery>,) -> Response {let lifecycle = WebSocketLifecycle::from_extension(lifecycle);+ let audio_only = state.db.protected_reads_enabled();// Check connection limit before upgradingmatch try_acquire_ws_connection(&state.ws_connection_count) {Some(guard) => lifecycle.on_upgrade(ws, move |socket, lifecycle| {- handle_socket(socket, query, guard, lifecycle)+ handle_socket(socket, query, guard, lifecycle, audio_only)}),None => Response::builder().status(StatusCode::SERVICE_UNAVAILABLE)@@ -289,11 +305,17 @@ async fn handle_socket(query: Query<EventsQuery>,_guard: WsConnectionGuard,lifecycle: WebSocketLifecycle,+ audio_only: bool,) {let (mut sender, mut receiver) = socket.split();let incoming = lifecycle.spawn(async move {while let Some(Ok(msg)) = receiver.next().await {+ // Protected clients may consume audio, but cannot inject arbitrary+ // events into the internal bus through this socket.+ if audio_only {+ continue;+ }if let Message::Text(t) = msg {if let Ok(event) = serde_json::from_str::<ScreenpipeEvent>(&t) {let _ = send_event(&event.name, event.data);@@ -310,6 +332,7 @@ async fn handle_socket(tokio::select! {event = stream.next() => {if let Some(mut event) = event {+ if audio_only && !audio_event_allowed(&event.name) { continue; }if !query.images.unwrap_or(false) && (event.name == "ocr_result" || event.name == "ui_frame") {if let Some(data) = event.data.as_object_mut() {data.remove("image");@@ -711,6 +734,15 @@ async fn handle_metrics_socket(mod tests {use super::*;+ #[test]+ fn protected_event_stream_allows_audio_but_not_screen_content() {+ assert!(audio_event_allowed("meeting_transcript_delta"));+ assert!(audio_event_allowed("meeting_transcript_final"));+ for name in ["ocr_result", "ui_frame", "window_changed", "unknown_event"] {+ assert!(!audio_event_allowed(name), "{name}");+ }+ }+#[test]fn events_websocket_ping_interval_is_not_busy() {assert_eq!(EVENTS_WEBSOCKET_PING_INTERVAL, Duration::from_secs(15));diff --git a/crates/screenpipe-redact/src/worker/columns.rs b/crates/screenpipe-redact/src/worker/columns.rsindex 122b9d780..596696271 100644--- a/crates/screenpipe-redact/src/worker/columns.rs+++ b/crates/screenpipe-redact/src/worker/columns.rs@@ -79,6 +79,7 @@ pub struct RedactColumns {pub accessibility_tree: bool,pub window_name: bool,pub browser_url: bool,+ /// Deprecated compatibility field. Audio is always excluded from AI redaction.pub audio_transcription: bool,pub ui_text_content: bool,pub ui_element_value: bool,@@ -120,7 +121,7 @@ impl Default for RedactColumns {accessibility_tree: true,window_name: true,browser_url: false,- audio_transcription: true,+ audio_transcription: false,ui_text_content: true,ui_element_value: true,ui_window_title: true,@@ -159,7 +160,8 @@ impl RedactColumns {accessibility_tree: has(keys::ACCESSIBILITY_TREE),window_name: has(keys::WINDOW_NAME),browser_url: has(keys::BROWSER_URL),- audio_transcription: has(keys::AUDIO_TRANSCRIPTION),+ // Retain the legacy key for config compatibility, but never enable it.+ audio_transcription: false,ui_text_content: has(keys::UI_TEXT_CONTENT),ui_element_value: has(keys::UI_ELEMENT_VALUE),ui_window_title: has(keys::UI_WINDOW_TITLE),@@ -251,7 +253,8 @@ mod tests {let d = RedactColumns::default();// Clear capture surfaces — on.assert!(d.accessibility_text && d.accessibility_tree && d.window_name);- assert!(d.audio_transcription && d.ui_text_content && d.ui_element_value);+ assert!(!d.audio_transcription);+ assert!(d.ui_text_content && d.ui_element_value);assert!(d.ui_window_title && d.element_text);// Form-field values — on by default (the real PII surface, incl.// password-field values OCR never sees).@@ -270,6 +273,12 @@ mod tests {assert!(!c.accessibility_text && !c.window_name && !c.element_properties);}+ #[test]+ fn legacy_audio_key_cannot_enable_ai_redaction() {+ assert!(!RedactColumns::from_keys(&["audio_transcription"]).audio_transcription);+ assert!(!RedactColumns::default_keys().contains(&"audio_transcription"));+ }+#[test]fn unknown_keys_ignored_not_fatal() {let c = RedactColumns::from_keys(&["browser_url", "totally_bogus", ""]);diff --git a/crates/screenpipe-redact/src/worker/mod.rs b/crates/screenpipe-redact/src/worker/mod.rsindex 6240af41f..0b48ed87d 100644--- a/crates/screenpipe-redact/src/worker/mod.rs+++ b/crates/screenpipe-redact/src/worker/mod.rs@@ -531,7 +531,8 @@ impl Worker {// (the a11y value/placeholder/help_text of the control).TargetTable::Elements => self.process_elements(batch_size).await,// Single-column targets gated by the per-column config.- TargetTable::AudioTranscription if !cols.audio_transcription => Ok(0),+ // Legacy saved column lists must not re-enable AI audio redaction.+ TargetTable::AudioTranscription => Ok(0),// `Accessibility` is the fallback pass for `frames.accessibility_text`// (the primary path is propagation in process_frames_fulltext);// both honor the same toggle.diff --git a/crates/screenpipe-redact/src/worker/release.rs b/crates/screenpipe-redact/src/worker/release.rsindex a4296c878..fc28e1f02 100644--- a/crates/screenpipe-redact/src/worker/release.rs+++ b/crates/screenpipe-redact/src/worker/release.rs@@ -49,6 +49,17 @@ impl Progress {fn new(job: ReleaseJob) -> Result<Self, RedactError> {let mut fields = VecDeque::new();let mut json = BTreeMap::new();+ // Audio keeps revision receipts for sync/retry bookkeeping only. Copy+ // transcripts unchanged, without sending any field to a local or cloud+ // detector. Local transcript reads do not wait for this bookkeeping.+ if screenpipe_db::privacy_release::is_audio_surface(&job.kind) {+ return Ok(Self {+ values: job.values.clone(),+ job,+ json,+ fields,+ });+ }for (column, value) in &job.values {let Some(text) = value.as_deref().filter(|s| !s.is_empty()) else {continue;@@ -217,9 +228,11 @@ impl Worker {if db.publish_release(&progress.job, &progress.values).await? {completed += 1;let mut status = self.status.lock().await;- status.redacted_total += 1;- status.last_redacted_at = Some(chrono::Utc::now());- status.last_error = None;+ if !screenpipe_db::privacy_release::is_audio_surface(&progress.job.kind) {+ status.redacted_total += 1;+ status.last_redacted_at = Some(chrono::Utc::now());+ status.last_error = None;+ }}scheduler.progress[index] = None;}diff --git a/crates/screenpipe-redact/tests/privacy_release.rs b/crates/screenpipe-redact/tests/privacy_release.rsindex fd5ab33ba..a4e578dac 100644--- a/crates/screenpipe-redact/tests/privacy_release.rs+++ b/crates/screenpipe-redact/tests/privacy_release.rs@@ -25,6 +25,59 @@ async fn database() -> (tempfile::TempDir, Arc<DatabaseManager>) {(root, db)}+#[tokio::test]+async fn history_discovery_does_not_jump_ahead_of_new_captures() {+ let root = tempfile::tempdir().unwrap();+ let db = DatabaseManager::new(+ root.path().join("db.sqlite").to_str().unwrap(),+ Default::default(),+ )+ .await+ .unwrap();+ // History predates the policy, so discovery enrolls it after live capture.+ db.execute_raw_sql_write("WITH RECURSIVE history(id) AS (SELECT 1 UNION ALL SELECT id+1 FROM history WHERE id<512) INSERT INTO frames(id,timestamp,full_text) SELECT id,'2020-01-01','historical text' FROM history")+ .await.unwrap();+ db.configure_release(&ReleasePolicy {+ identity: "history-priority-v1".into(),+ text: true,+ images: false,+ })+ .await+ .unwrap();+ for id in [1000, 1001] {+ db.execute_raw_sql_write(&format!(+ "INSERT INTO frames(id,timestamp,full_text) VALUES({id},'2026-10-23','new capture')"+ ))+ .await+ .unwrap();+ let recent = db+ .release_pending_ordered("frames", 1, 0, false)+ .await+ .unwrap()+ .remove(0);+ assert_eq!(+ recent.id,+ id.to_string(),+ "discovering old history must not outrank a new capture"+ );+ assert!(db.publish_release(&recent, &recent.values).await.unwrap());+ let historical = db+ .release_pending_ordered("frames", 1, 0, true)+ .await+ .unwrap()+ .remove(0);+ assert!(+ historical.id.parse::<i64>().unwrap() < 1000,+ "history must also retain its processing turn"+ );+ assert!(db+ .publish_release(&historical, &historical.values)+ .await+ .unwrap());+ }+ db.close().await;+}+#[tokio::test]async fn pending_capture_is_durable_but_not_released_and_late_completion_is_not_lost() {let (_root, db) = database().await;@@ -416,6 +469,122 @@ impl screenpipe_redact::Redactor for CountingDetector {}}+#[tokio::test]+async fn audio_and_live_segments_bypass_ai_and_are_readable_before_bookkeeping() {+ check_audio_exemption(false).await;+}++#[tokio::test]+async fn hybrid_audio_and_live_segments_bypass_ai_and_are_readable_before_bookkeeping() {+ check_audio_exemption(true).await;+}++async fn check_audio_exemption(hybrid: bool) {+ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};+ let root = tempfile::tempdir().unwrap();+ let db = Arc::new(if hybrid {+ DatabaseManager::new_hybrid(root.path(), Default::default(), Default::default())+ .await+ .unwrap()+ } else {+ DatabaseManager::new(+ root.path().join("db.sqlite").to_str().unwrap(),+ Default::default(),+ )+ .await+ .unwrap()+ });+ db.configure_release(&ReleasePolicy {+ identity: "audio-exempt-v1".into(),+ text: true,+ images: false,+ })+ .await+ .unwrap();+ db.execute_raw_sql_write("INSERT INTO audio_chunks(id,file_path) VALUES(1,'test.wav'); INSERT INTO audio_transcriptions(id,audio_chunk_id,offset_index,timestamp,transcription,device) VALUES(1,1,0,'2026-10-14T10:00:00Z','Alice at [email protected]','microphone'); INSERT INTO meetings(id,meeting_start,meeting_app) VALUES(1,'2026-10-14T10:00:00Z',''); INSERT INTO meeting_transcript_segments(id,meeting_id,provider,item_id,transcript,captured_at) VALUES(1,1,'test','one','Call Alice at [email protected]','2026-10-14T10:00:00Z')").await.unwrap();+ let reader = db.protected_reads().await.unwrap();+ let audio: String =+ sqlx::query_scalar("SELECT transcription FROM audio_transcriptions WHERE id=1")+ .fetch_one(&reader.pool)+ .await+ .unwrap();+ let segment: String =+ sqlx::query_scalar("SELECT transcript FROM meeting_transcript_segments WHERE id=1")+ .fetch_one(&reader.pool)+ .await+ .unwrap();+ assert_eq!(audio, "Alice at [email protected]");+ assert_eq!(segment, "Call Alice at [email protected]");+ assert!(reader+ .activity_sources_ready(+ chrono::DateTime::parse_from_rfc3339("2026-10-14T09:00:00Z")+ .unwrap()+ .into(),+ chrono::DateTime::parse_from_rfc3339("2026-10-14T11:00:00Z")+ .unwrap()+ .into()+ )+ .await+ .unwrap());+ assert!(db+ .release_queue_status()+ .await+ .unwrap()+ .surfaces+ .iter()+ .all(|s| !screenpipe_db::privacy_release::is_audio_surface(&s.kind)));+ let old_job = db.release_pending("audio", 1).await.unwrap().remove(0);+ db.defer_release(&old_job).await.unwrap();+ let calls = Arc::new(AtomicUsize::new(0));+ let worker = screenpipe_redact::worker::Worker::new_with_writer(+ db.pool.clone(),+ db.coordinated_writer(),+ Arc::new(CountingDetector {+ calls: calls.clone(),+ fail: Arc::new(AtomicBool::new(true)),+ delay: std::time::Duration::ZERO,+ }),+ screenpipe_redact::worker::WorkerConfig {+ resource_governor: None,+ ..Default::default()+ },+ )+ .with_frame_storage(db.clone());+ for _ in 0..4 {+ worker.process_release_batch(128).await.unwrap();+ }+ assert_eq!(+ calls.load(Ordering::SeqCst),+ 0,+ "audio must never reach either AI backend"+ );+ assert!(db.release_ready("audio", "1").await.unwrap());+ assert!(db.release_ready("segments", "1").await.unwrap());+ let page = reader+ .release_export_page("audio", 0, "2020-01-01", 10)+ .await+ .unwrap();+ assert_eq!(page.rows[0]["transcription"], audio);+ db.execute_raw_sql_write("UPDATE audio_transcriptions SET transcription='Bob' WHERE id=1")+ .await+ .unwrap();+ assert!(+ !db.release_ready("audio", "1").await.unwrap(),+ "sync revisions must still revoke on edits"+ );+ let edited: String =+ sqlx::query_scalar("SELECT transcription FROM audio_transcriptions WHERE id=1")+ .fetch_one(&reader.pool)+ .await+ .unwrap();+ assert_eq!(+ edited, "Bob",+ "local reads must not wait for sync bookkeeping"+ );+ reader.close().await;+ db.close().await;+}+#[tokio::test]async fn small_slices_remain_fair_and_resumed_json_never_exposes_partial_results() {use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};diff --git a/crates/screenpipe-redact/tests/worker_integration.rs b/crates/screenpipe-redact/tests/worker_integration.rsindex cea42772c..13383d09d 100644--- a/crates/screenpipe-redact/tests/worker_integration.rs+++ b/crates/screenpipe-redact/tests/worker_integration.rs@@ -208,7 +208,7 @@ async fn seed(pool: &sqlx::SqlitePool) {}#[tokio::test]-async fn worker_redacts_all_targets() {+async fn worker_redacts_screen_targets_and_leaves_audio_unchanged() {let (pool, _temp_dir) = setup_db().await;seed(&pool).await;@@ -218,7 +218,11 @@ async fn worker_redacts_all_targets() {idle_between_batches: Duration::from_millis(1),poll_interval: Duration::from_millis(20),tables: ALL_TARGET_TABLES.to_vec(),- columns: all_columns(),+ // Even a programmatically supplied legacy setting cannot opt audio in.+ columns: RedactColumns {+ audio_transcription: true,+ ..all_columns()+ },..test_worker_config()};let worker = Worker::new(pool.clone(), redactor, cfg);@@ -231,7 +235,6 @@ async fn worker_redacts_all_targets() {WHERE full_text IS NOT NULL AND full_text_redacted_at IS NULL) + \(SELECT COUNT(*) FROM frames \WHERE accessibility_text IS NOT NULL AND accessibility_redacted_at IS NULL) + \- (SELECT COUNT(*) FROM audio_transcriptions WHERE redacted_at IS NULL) + \(SELECT COUNT(*) FROM ui_events WHERE redacted_at IS NULL) + \(SELECT COUNT(*) FROM elements \WHERE (text IS NOT NULL OR properties IS NOT NULL) AND redacted_at IS NULL)",@@ -244,11 +247,24 @@ async fn worker_redacts_all_targets() {.await;handle.abort();+ let (audio, stamp): (String, Option<i64>) =+ sqlx::query_as("SELECT transcription,redacted_at FROM audio_transcriptions")+ .fetch_one(&pool)+ .await+ .unwrap();+ assert_eq!(+ audio,+ "the api key is sk-proj-AbCdEf123456GhIjKlMnOp tomorrow"+ );+ assert!(+ stamp.is_none(),+ "the background AI worker must leave audio alone"+ );+// Every single-column seeded row should now have its source column// overwritten with the redacted version + redacted_at stamped.for target in [TargetTable::FullText,- TargetTable::AudioTranscription,TargetTable::Accessibility,// Elements is multi-column now (text + properties) — asserted// separately below, since a properties-only row has NULL text.@@ -356,11 +372,11 @@ async fn worker_redacts_all_targets() {let status = worker.status().await;assert!(status.running);- // full_text seeded on both frames → 2 writes. audio (1), accessibility+ // full_text seeded on both frames → 2 writes. accessibility// (1). elements: 2 rows processed (the text element + the properties-// only element; the NULL/NULL container is skipped). ui_events: 3 ROWS- // (keyboard, clipboard, click). 2+1+1+2+3 = 9.- assert_eq!(status.redacted_total, 9);+ // (keyboard, clipboard, click). 2+1+2+3 = 8. Audio is excluded.+ assert_eq!(status.redacted_total, 8);assert!(status.last_redacted_at.is_some());}@@ -586,19 +602,19 @@ async fn worker_writes_consistent_pseudonym_tokens() {let (pool, _temp_dir) = setup_db().await;// Rows 1 & 2 share a secret; row 3 has a different one.sqlx::query(- "INSERT INTO audio_transcriptions (transcription) VALUES ('key is sk-proj-AbCdEf123456GhIjKlMnOp today')",+ "INSERT INTO frames (accessibility_text) VALUES ('key is sk-proj-AbCdEf123456GhIjKlMnOp today')",).execute(&pool).await.unwrap();sqlx::query(- "INSERT INTO audio_transcriptions (transcription) VALUES ('reuse sk-proj-AbCdEf123456GhIjKlMnOp again')",+ "INSERT INTO frames (accessibility_text) VALUES ('reuse sk-proj-AbCdEf123456GhIjKlMnOp again')",).execute(&pool).await.unwrap();sqlx::query(- "INSERT INTO audio_transcriptions (transcription) VALUES ('other sk-proj-ZyXwVu987654TsRqPoNmLk now')",+ "INSERT INTO frames (accessibility_text) VALUES ('other sk-proj-ZyXwVu987654TsRqPoNmLk now')",).execute(&pool).await@@ -612,15 +628,15 @@ async fn worker_writes_consistent_pseudonym_tokens() {let cfg = WorkerConfig {idle_between_batches: Duration::from_millis(1),poll_interval: Duration::from_millis(20),- tables: vec![TargetTable::AudioTranscription],+ tables: vec![TargetTable::Accessibility],..test_worker_config()};let worker = Worker::new(pool.clone(), redactor, cfg);let handle = worker.clone().spawn();- wait_until("audio pseudonym watermarks", || async {+ wait_until("accessibility pseudonym watermarks", || async {sqlx::query_scalar::<_, i64>(- "SELECT COUNT(*) FROM audio_transcriptions WHERE redacted_at IS NULL",+ "SELECT COUNT(*) FROM frames WHERE accessibility_redacted_at IS NULL",).fetch_one(&pool).await@@ -630,14 +646,13 @@ async fn worker_writes_consistent_pseudonym_tokens() {.await;handle.abort();- let texts: Vec<String> =- sqlx::query("SELECT transcription FROM audio_transcriptions ORDER BY id")- .fetch_all(&pool)- .await- .unwrap()- .iter()- .map(|r| r.get::<String, _>(0))- .collect();+ let texts: Vec<String> = sqlx::query("SELECT accessibility_text FROM frames ORDER BY id")+ .fetch_all(&pool)+ .await+ .unwrap()+ .iter()+ .map(|r| r.get::<String, _>(0))+ .collect();assert_eq!(texts.len(), 3);// No raw secret survives anywhere.@@ -678,12 +693,12 @@ struct SlowBatchRedactor {delay: Duration,}-/// Gives audio deliberately slow timing while leaving element redaction fast,+/// Gives accessibility deliberately slow timing while leaving element redaction fast,/// so the worker must learn independent limits for the two tables.struct TableTimingRedactor {- audio_batch_sizes: Mutex<Vec<usize>>,+ accessibility_batch_sizes: Mutex<Vec<usize>>,element_batch_sizes: Mutex<Vec<usize>>,- audio_delay: Duration,+ accessibility_delay: Duration,}#[async_trait]@@ -723,10 +738,13 @@ impl Redactor for TableTimingRedactor {async fn redact_batch(&self, texts: &[String]) -> Result<Vec<RedactionOutput>, RedactError> {if texts.first()- .is_some_and(|text| text.starts_with("slow audio"))+ .is_some_and(|text| text.starts_with("slow accessibility")){- self.audio_batch_sizes.lock().unwrap().push(texts.len());- tokio::time::sleep(self.audio_delay).await;+ self.accessibility_batch_sizes+ .lock()+ .unwrap()+ .push(texts.len());+ tokio::time::sleep(self.accessibility_delay).await;} else if texts.first().is_some_and(|text| text.starts_with("fast element"))@@ -748,7 +766,7 @@ impl Redactor for TableTimingRedactor {async fn slow_work_slice_shrinks_the_next_database_batch() {let (pool, _temp_dir) = setup_db().await;for index in 0..10 {- sqlx::query("INSERT INTO audio_transcriptions (transcription) VALUES (?)")+ sqlx::query("INSERT INTO frames (accessibility_text) VALUES (?)").bind(format!("ordinary transcript {index}")).execute(&pool).await@@ -765,15 +783,15 @@ async fn slow_work_slice_shrinks_the_next_database_batch() {target_batch_duration: Duration::from_millis(5),idle_between_batches: Duration::from_millis(1),poll_interval: Duration::from_millis(20),- tables: vec![TargetTable::AudioTranscription],+ tables: vec![TargetTable::Accessibility],..test_worker_config()};let worker = Worker::new(pool.clone(), redactor.clone(), cfg);let handle = worker.spawn();- wait_until("adaptive audio batches", || async {+ wait_until("adaptive accessibility batches", || async {sqlx::query_scalar::<_, i64>(- "SELECT COUNT(*) FROM audio_transcriptions WHERE redacted_at IS NOT NULL",+ "SELECT COUNT(*) FROM frames WHERE accessibility_redacted_at IS NOT NULL",).fetch_one(&pool).await@@ -796,8 +814,8 @@ async fn slow_work_slice_shrinks_the_next_database_batch() {async fn table_work_slices_adapt_independently() {let (pool, _temp_dir) = setup_db().await;for index in 0..10 {- sqlx::query("INSERT INTO audio_transcriptions (transcription) VALUES (?)")- .bind(format!("slow audio {index}"))+ sqlx::query("INSERT INTO frames (accessibility_text) VALUES (?)")+ .bind(format!("slow accessibility {index}")).execute(&pool).await.unwrap();@@ -811,9 +829,9 @@ async fn table_work_slices_adapt_independently() {}let redactor = Arc::new(TableTimingRedactor {- audio_batch_sizes: Mutex::new(Vec::new()),+ accessibility_batch_sizes: Mutex::new(Vec::new()),element_batch_sizes: Mutex::new(Vec::new()),- audio_delay: Duration::from_millis(160),+ accessibility_delay: Duration::from_millis(160),});let cfg = WorkerConfig {batch_size: 8,@@ -821,15 +839,15 @@ async fn table_work_slices_adapt_independently() {target_batch_duration: Duration::from_millis(100),idle_between_batches: Duration::from_millis(1),poll_interval: Duration::from_millis(20),- tables: vec![TargetTable::AudioTranscription, TargetTable::Elements],+ tables: vec![TargetTable::Accessibility, TargetTable::Elements],..test_worker_config()};let worker = Worker::new(pool.clone(), redactor.clone(), cfg);let handle = worker.spawn();wait_until("independent table batches", || async {- let audio_done = sqlx::query_scalar::<_, i64>(- "SELECT COUNT(*) FROM audio_transcriptions WHERE redacted_at IS NOT NULL",+ let accessibility_done = sqlx::query_scalar::<_, i64>(+ "SELECT COUNT(*) FROM frames WHERE accessibility_redacted_at IS NOT NULL",).fetch_one(&pool).await@@ -840,16 +858,16 @@ async fn table_work_slices_adapt_independently() {.fetch_one(&pool).await.unwrap();- audio_done == 10 && elements_done == 20+ accessibility_done == 10 && elements_done == 20}).await;handle.abort();- let audio_batches = redactor.audio_batch_sizes.lock().unwrap().clone();+ let accessibility_batches = redactor.accessibility_batch_sizes.lock().unwrap().clone();let element_batches = redactor.element_batch_sizes.lock().unwrap().clone();- assert_eq!(audio_batches.first(), Some(&4));- assert_eq!(audio_batches.get(1), Some(&2));- assert!(audio_batches.iter().skip(2).all(|size| *size == 1));+ assert_eq!(accessibility_batches.first(), Some(&4));+ assert_eq!(accessibility_batches.get(1), Some(&2));+ assert!(accessibility_batches.iter().skip(2).all(|size| *size == 1));assert_eq!(&element_batches[..3], &[4, 4, 4]);assert_eq!(element_batches.get(3), Some(&8));}diff --git a/docs/pii-release-gate.md b/docs/pii-release-gate.mdindex 3d303deed..dd32f5f2d 100644--- a/docs/pii-release-gate.md+++ b/docs/pii-release-gate.md@@ -5,7 +5,7 @@ Processing and admission contract for the covered local APIs and enterprise uplo<!-- doc-covers: crates/screenpipe-db/src/db/privacy_release.rs, crates/screenpipe-db/src/db/privacy_exports.rs, crates/screenpipe-redact/src/worker/release.rs, crates/screenpipe-redact/src/image/worker.rs, crates/screenpipe-engine/src/routes/privacy_release.rs, apps/screenpipe-app-tauri/src-tauri/src/enterprise/sync.rs --><!-- doc-verified: c288183019 -->-Capture persists through the existing writer. Background detectors process a source revision under a desired policy, then publish the sanitized replacement and its receipt in one transaction. A read adapter exposes only current receipts. Text and image completion are independent. Optional regex filtering and legacy timestamps cannot certify required model processing.+Capture persists through the existing writer. Background detectors process a source revision under a desired policy, then publish the sanitized replacement and its receipt in one transaction. A read adapter exposes only current receipts. Text and image completion are independent. Audio and live meeting transcripts are excluded from AI redaction and are readable immediately. Their sync receipts track source revisions without invoking a detector; they do not certify redaction. Optional capture-time pattern filtering remains separate. Optional regex filtering and legacy timestamps cannot certify required model processing.```textcapture -> durable local source -> background PII detector@@ -27,11 +27,11 @@ Hybrid payload replacements retain their generation checks. Storage-only sealingThe work queue is indexed by surface and availability deadline. A completed discovery cursor avoids scanning certified history on every idle poll. Legacy history and policy changes are discovered in pages of 128 IDs using the existing coordinated writer. Each selection examines at most 256 due candidates. Image maturity scheduling advances at most 256 young/future records, and a bounded oldest fallback avoids treating fresh screenshots as an empty queue while mature work is waiting. Undecodable image timestamps defer that record without blocking valid work; other database errors still propagate. Source deletion retains a revision tombstone, including while protection is disabled, so reusing an ID cannot accept stale work.-Text scheduling rotates across the registered text surfaces, including saved activity tasks and actions and alternates recent and oldest work. A record with multiple fields resumes between slices; no partial record becomes visible. The target duration is checked between backend steps. Local ONNX processing resumes between overlapping model windows; whole-field tokenization, JSON work, one window and remote requests remain indivisible. Failed attempts count toward CPU cooldown. Images release the shared CPU lane before idle or retry sleeps. Ready events retain only the current event per record; completion sequences still advance monotonically.+Text scheduling rotates across the registered surfaces (audio and meeting segments perform receipt bookkeeping only), including saved activity tasks and actions and alternates recent and oldest work. A record with multiple fields resumes between slices; no partial record becomes visible. The target duration is checked between backend steps. Local ONNX processing resumes between overlapping model windows; whole-field tokenization, JSON work, one window and remote requests remain indivisible. Failed attempts count toward CPU cooldown. Images release the shared CPU lane before idle or retry sleeps. Ready events retain only the current event per record; completion sequences still advance monotonically.## User-visible status-Settings shows processing, history discovery, retry, completion and unavailable states. Text and screenshots are reported separately. The API reads at most 1,001 queue entries per enabled surface, returns counts capped at 1,000, and marks counts as lower bounds during discovery or capping. Normal screenshot maturity waiting does not appear as a failed retry. Status polling runs sequentially every 15 seconds while the settings card is mounted and visible, with a five-second request timeout.+Settings shows processing, history discovery, retry, completion and unavailable states. Text and screenshots are reported separately. Audio receipt bookkeeping is excluded from AI processing counts. The API reads at most 1,001 queue entries per enabled surface, returns counts capped at 1,000, and marks counts as lower bounds during discovery or capping. Normal screenshot maturity waiting does not appear as a failed retry. Status polling runs sequentially every 15 seconds while the settings card is mounted and visible, with a five-second request timeout.Protected responses expose `x-screenpipe-privacy-completeness: unknown` and `/privacy/status`; JSON search, activity ledger and activity summary responses also include this metadata. An empty protected result must not be treated as proof that matching history does not exist. Status is a global snapshot, not exact completeness for a query range or confirmation of upload completion. HTTP admission checks revocation rather than the completion epoch, so unrelated newly processed records do not reject an otherwise valid response. Caches still use the completion epoch for freshness.@@ -79,7 +79,7 @@ Historical replay retains a request-specific discovery cursor and checks the exa## Scope and operating limits-- Raw SQL, raw video export, original audio samples, frame streaming, on-demand OCR, live content events, artifact file reads and database backup remain explicitly unavailable under protection. They have no release adapter; the API reports `privacy_surface_unavailable` rather than exposing raw content. Processed output metadata is available, but that receipt does not authorize the original file's bytes.+- Raw SQL, raw video export, frame streaming, on-demand OCR, non-audio live content events, artifact file reads and database backup remain explicitly unavailable under protection. The shared event socket forwards only the explicit audio event allowlist while protection is active; meeting transcript/status sockets and speaker audio samples remain available. Other blocked surfaces have no release adapter; the API reports `privacy_surface_unavailable` rather than exposing raw content. Processed output metadata is available, but that receipt does not authorize the original file's bytes.- The gate covers the selected local API and enterprise upload paths. Native model consumers reading the raw database, direct filesystem access, browser tools, other sync services, support logs and cloud history are separate boundaries. An agent with unrestricted filesystem access can bypass an HTTP gate.- Compact keys resolve the policy-identity storage amplification, and resumable local model windows reduce indivisible processing. Broad and sparse reads still have the measured costs above. Sustained overload increases freshness delay; these changes do not promise a particular throughput or a hard CPU ceiling.- A remote detector upgrade must preserve or advance its policy identity. Local version constants cannot independently attest an unversioned remote deployment. Image receipts rely on capture-owned files not being rewritten outside the database lifecycle.