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

Bump app to v2.4.175 — re-enable AI PII removal w/ rfdetr_v9 + Secret-only policy — release-app

Louis Beaumont229612a8e175
diff --git a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx
index 15f7e1e03..a5ca57daa 100644
--- a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx
@@ -307,11 +307,29 @@ export function PrivacySection() {
handleSettingsChange({ usePiiRemoval: checked }, true);
};
- // AI PII removal toggles + backend picker were hidden in v2.4.161;
- // the feature is no-op'd at the worker spawn sites. Settings keys
- // (asyncPiiRedaction, asyncImagePiiRedaction, piiBackend) remain on
- // the schema for serde compat — anyone who had them set just gets
- // silent no-op behavior until we re-ship.
+ // "AI PII removal" — single user-facing toggle that flips both the
+ // text reconciliation worker AND the image redactor (rfdetr_v8) on
+ // or off together. The technical knobs (destructive vs sibling,
+ // text-only vs image-only) stay CLI-only so the UI stays simple.
+ const aiPiiRemovalEnabled =
+ Boolean(settings.asyncPiiRedaction ?? false) ||
+ Boolean(settings.asyncImagePiiRedaction ?? false);
+
+ const handleAiPiiRemovalChange = (checked: boolean) => {
+ handleSettingsChange(
+ {
+ asyncPiiRedaction: checked,
+ asyncImagePiiRedaction: checked,
+ },
+ true,
+ );
+ };
+
+ // Where the AI workers run — one switch covers both modalities.
+ const piiBackend = (settings.piiBackend as "local" | "tinfoil" | undefined) ?? "local";
+ const handlePiiBackendChange = (next: "local" | "tinfoil") => {
+ handleSettingsChange({ piiBackend: next } as any, true);
+ };
const handleIncognitoToggle = (checked: boolean) => {
handleSettingsChange({ ignoreIncognitoWindows: checked }, true);
@@ -841,16 +859,68 @@ export function PrivacySection() {
</CardContent>
</Card>
- {/* AI PII removal — UI hidden in v2.4.161. The feature is
- disabled at the worker spawn sites in server_core.rs and
- bin/screenpipe-engine.rs (no-op even if `asyncPiiRedaction`
- / `asyncImagePiiRedaction` are set via CLI / config). The
- local rfdetr_v8 image model had unacceptable precision AND
- recall on real screenpipe content (over-redacted code /
- docs, missed actual passwords), and the local text ONNX
- wasn't shipped — the Settings option mis-routed text
- redaction to the cloud enclave silently. Will re-surface
- when we ship a model + benchmark we can stand behind. */}
+ {/* AI PII removal — covers text + images via the async worker */}
+ <Card className="border-border bg-card">
+ <CardContent className="px-3 py-2.5">
+ <div className="flex items-center justify-between">
+ <div className="flex items-center space-x-2.5">
+ <Shield className="h-4 w-4 text-muted-foreground shrink-0" />
+ <div>
+ <h3 className="text-sm font-medium text-foreground flex items-center gap-1.5">
+ AI PII removal
+ <span className="text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted px-1.5 py-0.5 rounded">
+ Experimental
+ </span>
+ <HelpTooltip text="Uses an on-device AI model to detect and remove PII from both screen frames and captured text (names, emails, addresses, secrets, URLs). Downloads a ~100 MB model on first run and uses extra CPU/GPU while it processes captures in the background." />
+ </h3>
+ <p className="text-xs text-muted-foreground">
+ Removes PII from text and images. Uses extra resources.
+ </p>
+ </div>
+ </div>
+ <Switch
+ id="aiPiiRemoval"
+ checked={aiPiiRemovalEnabled}
+ onCheckedChange={handleAiPiiRemovalChange}
+ />
+ </div>
+ {aiPiiRemovalEnabled && (
+ <div className="mt-3 ml-6 space-y-2 border-l-2 border-border pl-3">
+ <p className="text-xs font-medium text-foreground">Where it runs</p>
+ <label className="flex cursor-pointer items-start gap-2 text-xs">
+ <input
+ type="radio"
+ name="piiBackend"
+ className="mt-0.5"
+ checked={piiBackend === "local"}
+ onChange={() => handlePiiBackendChange("local")}
+ />
+ <span>
+ <span className="font-medium text-foreground">Local</span>
+ <span className="text-muted-foreground">
+ {" "}— on your device. Strongest privacy. Slower on weak hardware.
+ </span>
+ </span>
+ </label>
+ <label className="flex cursor-pointer items-start gap-2 text-xs">
+ <input
+ type="radio"
+ name="piiBackend"
+ className="mt-0.5"
+ checked={piiBackend === "tinfoil"}
+ onChange={() => handlePiiBackendChange("tinfoil")}
+ />
+ <span>
+ <span className="font-medium text-foreground">Cloud (enclave)</span>
+ <span className="text-muted-foreground">
+ {" "}— screenpipe&apos;s confidential-compute enclave. Fast everywhere; your device cryptographically verifies the enclave is running the open-source build before sending anything.
+ </span>
+ </span>
+ </label>
+ </div>
+ )}
+ </CardContent>
+ </Card>
</div>
</LockedSetting>
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 1e9779a5a..4f7d440ec 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9972,7 +9972,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.4.174"
+version = "2.4.175"
dependencies = [
"aes",
"anyhow",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 9dc3a3b31..f068872f9 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.4.174"
+version = "2.4.175"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs b/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs
index 0955cf4ab..4f9ed9a75 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs
@@ -472,30 +472,85 @@ impl ServerCore {
warn!("mdns advertisement failed (non-fatal): {}", e);
}
- // ── AI PII removal — disabled in v2.4.161 ────────────────────────
- // The text + image PII workers are no longer spawned, even if
- // `async_pii_redaction` / `async_image_pii_redaction` are set
- // via CLI flag, settings file, or stale config. Reasoning:
- // - rfdetr_v8 had unacceptable precision AND recall on real
- // screenpipe content (over-redacted code/docs, missed
- // actual passwords). Combined with destructive writes
- // this destroyed users' timelines within hours of opt-in.
- // - The local text ONNX never shipped, so "Local" backend
- // silently routed text redaction to the cloud enclave —
- // mismatch with the toggle's label.
- // The Settings UI toggles were hidden in the same release;
- // schema fields stay on the config struct for serde compat.
- // Re-enable when we ship a model + benchmark we can stand
- // behind. Until then, log a one-shot warning if the user has
- // it enabled so they're not confused about why nothing happens.
- if config.async_pii_redaction || config.async_image_pii_redaction {
- warn!(
- "AI PII removal is disabled in this build (async_pii_redaction={}, \
- async_image_pii_redaction={}). The local rfdetr_v8 image model + \
- the unfinished local text ONNX were both unsafe defaults; the feature \
- will return when there's a model + benchmark we trust.",
- config.async_pii_redaction, config.async_image_pii_redaction
- );
+ // ── Async PII reconciliation workers (issue #3185 / PR #3188) ─────
+ // Two independent workers — text and image — each gated by its
+ // own toggle. Both off by default; users opt in through
+ // Settings → Privacy → "AI PII removal".
+ //
+ // The single `pii_backend` config flag selects the inner
+ // adapter for BOTH modalities:
+ // - "local" → local ONNX (text: stub, image: rfdetr_v8)
+ // - "tinfoil" → confidential-compute enclave (H200) for both
+ let backend = config.pii_backend.as_str();
+ let use_tinfoil = matches!(backend, "tinfoil" | "cloud" | "enclave");
+
+ if config.async_pii_redaction {
+ use screenpipe_redact::adapters::tinfoil::TinfoilRedactor;
+ use screenpipe_redact::pipeline::{Pipeline, PipelineConfig};
+ use screenpipe_redact::worker::{Worker, WorkerConfig, ALL_TARGET_TABLES};
+ use screenpipe_redact::Redactor;
+
+ // Today: regardless of `pii_backend`, the text "AI" step
+ // is the Tinfoil enclave because the local OPF ONNX
+ // export is still landing (see PR description). The flag
+ // is here so flipping the enclave OFF on the local mode
+ // is a one-line change once OnnxRedactor is ready.
+ let ai: Arc<dyn Redactor> = Arc::new(TinfoilRedactor::from_env());
+ // The worker is destructive-only: it overwrites the source
+ // columns (`text` / `transcription` / `text_content` /
+ // `accessibility_text`) with the redacted text and stamps
+ // `*_redacted_at`. That's what the user-facing "AI PII
+ // removal" toggle means. The 20260507 migration drops the
+ // dead duplicate columns the old non-destructive mode used.
+ info!("starting async text-PII reconciliation worker (backend={backend})");
+ let pipeline = Pipeline::regex_then_ai(ai, PipelineConfig::default());
+ let pipeline_arc = Arc::new(pipeline) as Arc<dyn Redactor>;
+ let cfg = WorkerConfig {
+ tables: ALL_TARGET_TABLES.to_vec(),
+ ..Default::default()
+ };
+ let _ = Worker::new(db.pool.clone(), pipeline_arc, cfg).spawn();
+ }
+
+ if config.async_image_pii_redaction {
+ use screenpipe_redact::adapters::rfdetr::{RfdetrConfig, RfdetrRedactor};
+ use screenpipe_redact::adapters::tinfoil_image::TinfoilImageRedactor;
+ use screenpipe_redact::image::worker::{ImageWorker, ImageWorkerConfig};
+ use screenpipe_redact::ImageRedactor;
+
+ let pool = db.pool.clone();
+ if use_tinfoil {
+ info!("starting async image-PII worker (backend=tinfoil)");
+ let detector =
+ Arc::new(TinfoilImageRedactor::from_env()) as Arc<dyn ImageRedactor>;
+ let _ = ImageWorker::new(pool, detector, ImageWorkerConfig::default()).spawn();
+ } else {
+ // Local mode: rfdetr_v8 ONNX. First-run downloads
+ // ~108 MB from huggingface.co/screenpipe/pii-image-redactor
+ // and verifies SHA-256 before landing in ~/.screenpipe/models/.
+ tokio::spawn(async move {
+ match RfdetrRedactor::load_or_download(RfdetrConfig::default()).await {
+ Ok(detector) => {
+ info!("starting async image-PII worker (backend=local)");
+ let detector_arc =
+ Arc::new(detector) as Arc<dyn ImageRedactor>;
+ let _ = ImageWorker::new(
+ pool,
+ detector_arc,
+ ImageWorkerConfig::default(),
+ )
+ .spawn();
+ }
+ Err(e) => {
+ warn!(
+ "image-PII (local) enabled but couldn't load rfdetr_v8 model; \
+ skipping: {e}. switch to backend=tinfoil in Settings to use \
+ the cloud enclave instead."
+ );
+ }
+ }
+ });
+ }
}
Ok(Self {
diff --git a/crates/screenpipe-engine/src/bin/screenpipe-engine.rs b/crates/screenpipe-engine/src/bin/screenpipe-engine.rs
index 020f08afd..3af216009 100644
--- a/crates/screenpipe-engine/src/bin/screenpipe-engine.rs
+++ b/crates/screenpipe-engine/src/bin/screenpipe-engine.rs
@@ -1491,19 +1491,76 @@ async fn main() -> anyhow::Result<()> {
});
}
- // AI PII removal — disabled in v2.4.161. The text + image PII
- // workers are no longer spawned even if `--async-pii-redaction` /
- // `--async-image-pii-redaction` are set. See server_core.rs in
- // the desktop app for the full rationale; same code path here.
- if record_args.async_pii_redaction || record_args.async_image_pii_redaction {
- tracing::warn!(
- "AI PII removal is disabled in this build (async_pii_redaction={}, \
- async_image_pii_redaction={}). The local rfdetr_v8 image model + \
- the unfinished local text ONNX were both unsafe defaults; the feature \
- will return when there's a model + benchmark we trust.",
- record_args.async_pii_redaction,
- record_args.async_image_pii_redaction
- );
+ // Spawn the async PII reconciliation worker (issue #3185).
+ // Off by default — only runs when `--async-pii-redaction` is set.
+ // The capture path is unaffected either way.
+ if record_args.async_pii_redaction {
+ use screenpipe_redact::{
+ adapters::tinfoil::TinfoilRedactor,
+ pipeline::{Pipeline, PipelineConfig},
+ worker::{Worker, WorkerConfig, ALL_TARGET_TABLES},
+ Redactor,
+ };
+ use std::sync::Arc;
+
+ info!("starting async PII reconciliation worker (destructive overwrite of source columns)");
+
+ // Pipeline: regex pre-pass + Tinfoil enclave fallback. Regex
+ // catches structural PII deterministically and on-device; the
+ // Tinfoil call only fires for inputs longer than regex can
+ // fully cover (see PipelineConfig).
+ let tinfoil = Arc::new(TinfoilRedactor::from_env()) as Arc<dyn Redactor>;
+ let pipeline = Pipeline::regex_then_ai(tinfoil, PipelineConfig::default());
+ let pipeline_arc = Arc::new(pipeline) as Arc<dyn Redactor>;
+
+ let worker_cfg = WorkerConfig {
+ tables: ALL_TARGET_TABLES.to_vec(),
+ ..Default::default()
+ };
+ let _worker_handle = Worker::new(db.pool.clone(), pipeline_arc, worker_cfg).spawn();
+ // The worker runs for the lifetime of the engine. We don't
+ // join its handle — when the process exits the runtime
+ // tears down the task. If we ever want graceful shutdown
+ // (drain in-flight HTTP calls), wire `_worker_handle` into
+ // the shutdown_tx flow.
+ }
+
+ // Image-PII reconciliation worker (issue #3185 follow-up).
+ // Independent of the text worker — users can toggle either one
+ // without the other. Requires the rfdetr_v8.onnx model present
+ // and at least one of the `onnx-*` cargo features built.
+ if record_args.async_image_pii_redaction {
+ use screenpipe_redact::adapters::rfdetr::{RfdetrConfig, RfdetrRedactor};
+ use screenpipe_redact::image::worker::{ImageWorker, ImageWorkerConfig};
+ use screenpipe_redact::ImageRedactor;
+ use std::sync::Arc;
+
+ // load_or_download fetches the ONNX from
+ // huggingface.co/screenpipe/pii-image-redactor on first run
+ // (~108 MB), verifies SHA-256, caches at
+ // ~/.screenpipe/models/rfdetr_v8.onnx. Subsequent starts are
+ // instant.
+ match RfdetrRedactor::load_or_download(RfdetrConfig::default()).await {
+ Ok(detector) => {
+ info!(
+ "starting async image-PII reconciliation worker (destructive overwrite of source JPGs)"
+ );
+ let cfg = ImageWorkerConfig::default();
+ let detector_arc = Arc::new(detector) as Arc<dyn ImageRedactor>;
+ let _img_handle = ImageWorker::new(db.pool.clone(), detector_arc, cfg).spawn();
+ }
+ Err(e) => {
+ // Loud-but-non-fatal: capture continues; user gets an
+ // explicit "model missing or download failed" message
+ // in the log, and the regular text redactor (if
+ // enabled) keeps running.
+ tracing::warn!(
+ "image-PII redaction enabled but couldn't load model; skipping: {e}. \
+ check network reachability to huggingface.co or pre-stage \
+ rfdetr_v8.onnx at ~/.screenpipe/models/."
+ );
+ }
+ }
}
// Add auto-destruct watcher
diff --git a/crates/screenpipe-redact/src/adapters/rfdetr.rs b/crates/screenpipe-redact/src/adapters/rfdetr.rs
index 45cd73389..e2715c921 100644
--- a/crates/screenpipe-redact/src/adapters/rfdetr.rs
+++ b/crates/screenpipe-redact/src/adapters/rfdetr.rs
@@ -20,7 +20,7 @@
//!
//! ## Reference benchmark numbers
//!
-//! `rfdetr_v8` (320×320 input, FP32 ONNX, ~109 MB):
+//! `rfdetr_v9` (384×384 input, FP32 ONNX, ~108 MB):
//!
//! | platform | EP | p50 |
//! |----------------------------|-----------|---------:|
@@ -45,7 +45,7 @@ use crate::RedactError;
use crate::SpanLabel;
const RFDETR_NAME: &str = "rfdetr";
-const RFDETR_VERSION: u32 = 8; // matches the rfdetr_v8 ONNX
+const RFDETR_VERSION: u32 = 9; // matches the rfdetr_v9 ONNX
#[cfg(feature = "onnx-cpu")]
const NUM_CLASSES: usize = 12;
@@ -73,7 +73,7 @@ const CLASSES: [SpanLabel; NUM_CLASSES] = [
/// Configuration for [`RfdetrRedactor`].
#[derive(Debug, Clone)]
pub struct RfdetrConfig {
- /// Path to `rfdetr_vN.onnx`. We default to `~/.screenpipe/models/rfdetr_v8.onnx`
+ /// Path to `rfdetr_vN.onnx`. We default to `~/.screenpipe/models/rfdetr_v9.onnx`
/// in [`Self::default_model_path`] but callers may override (e.g.
/// for an INT8-quantized variant in the future).
pub model_path: PathBuf,
@@ -93,20 +93,25 @@ impl Default for RfdetrConfig {
Self {
model_path: Self::default_model_path(),
input_size: 0, // auto-detect from ONNX inputs[0].shape
- conf_threshold: 0.10,
+ // 0.50 matches ImageRedactionPolicy::default's min_score so
+ // the adapter doesn't waste cycles emitting low-confidence
+ // candidates the policy will discard. The policy can still
+ // tighten further (e.g. 0.70 paranoid mode) — that just
+ // applies a second floor.
+ conf_threshold: 0.50,
}
}
}
impl RfdetrConfig {
- /// `~/.screenpipe/models/rfdetr_v8.onnx`. Created lazily by
+ /// `~/.screenpipe/models/rfdetr_v9.onnx`. Created lazily by
/// [`Self::ensure_model_present`] on first run.
pub fn default_model_path() -> PathBuf {
dirs::home_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join(".screenpipe")
.join("models")
- .join("rfdetr_v8.onnx")
+ .join("rfdetr_v9.onnx")
}
/// HuggingFace download URL for the canonical ONNX. Pinned to
@@ -114,16 +119,16 @@ impl RfdetrConfig {
/// (URL + expected SHA-256 + [`RFDETR_VERSION`] all bumped
/// together).
pub const HF_DOWNLOAD_URL: &'static str =
- "https://huggingface.co/screenpipe/pii-image-redactor/resolve/main/rfdetr_v8.onnx";
+ "https://huggingface.co/screenpipe/pii-image-redactor/resolve/main/rfdetr_v9.onnx";
- /// Expected SHA-256 of the canonical `rfdetr_v8.onnx`. Verified
+ /// Expected SHA-256 of the canonical `rfdetr_v9.onnx`. Verified
/// after every download. If a future training run produces a new
/// best, bump [`RFDETR_VERSION`], re-publish to HF, update this
/// constant. Note: the worker is destructive-only and does NOT
/// re-redact already-processed frames, so a model-version bump
/// only takes effect for newly-captured frames going forward.
pub const EXPECTED_SHA256: &'static str =
- "431acc0f0beb22a39572b7a50af4fc446e799840fb71320dc124fbd79a121eb3";
+ "179a5e08ab12bfc70ff1e8dc1e2a67379de2a3be93eb2e7e1f8ec3dbd973f662";
/// Make sure the ONNX is present on disk. Idempotent — does
/// nothing if [`Self::model_path`] already exists with the
@@ -152,7 +157,7 @@ impl RfdetrConfig {
tracing::info!(
url = Self::HF_DOWNLOAD_URL,
target = %self.model_path.display(),
- "downloading rfdetr_v8.onnx (~108 MB) — first-run only"
+ "downloading rfdetr_v9.onnx (~108 MB) — first-run only"
);
let resp = reqwest::Client::new()
.get(Self::HF_DOWNLOAD_URL)
@@ -189,7 +194,7 @@ impl RfdetrConfig {
tracing::info!(
target = %self.model_path.display(),
bytes = bytes.len(),
- "rfdetr_v8.onnx ready"
+ "rfdetr_v9.onnx ready"
);
Ok(())
}
@@ -471,7 +476,7 @@ mod tests {
fn default_path_lives_under_screenpipe_dir() {
let p = RfdetrConfig::default_model_path();
let s = p.to_string_lossy();
- assert!(s.contains(".screenpipe/models/rfdetr_v8.onnx"));
+ assert!(s.contains(".screenpipe/models/rfdetr_v9.onnx"));
}
#[test]
@@ -502,7 +507,7 @@ mod tests {
// (Real download path is exercised by integration tests off
// the unit-test harness.)
let d = tempdir().unwrap();
- let p = d.path().join("models").join("rfdetr_v8.onnx");
+ let p = d.path().join("models").join("rfdetr_v9.onnx");
std::fs::create_dir_all(p.parent().unwrap()).unwrap();
std::fs::write(&p, b"not the real model").unwrap();
let cfg = RfdetrConfig {
diff --git a/crates/screenpipe-redact/src/image/mod.rs b/crates/screenpipe-redact/src/image/mod.rs
index 550e1ccd8..83efada9f 100644
--- a/crates/screenpipe-redact/src/image/mod.rs
+++ b/crates/screenpipe-redact/src/image/mod.rs
@@ -92,25 +92,36 @@ pub trait ImageRedactor: Send + Sync {
/// out. Same idea as the text-pipeline's per-label policy: the model
/// detects everything it can, the policy decides what gets redacted.
///
-/// Default is intentionally conservative: ONLY the `Secret` class,
-/// and only at very high confidence (≥ 0.9). This is a hard-won
-/// default — the original `[Person, Email, Phone, Address, Url,
-/// Company, Repo, Handle, Channel, Id, Date, Secret]` allow-list at
-/// `min_score=0.3` produced catastrophic over-redaction in the wild
-/// (May 2026): rfdetr_v8 routinely flagged code identifiers / file
-/// paths / version strings / sidebar nav items as `Url` / `Id` /
-/// `Repo` / `Handle`, so a user who flipped the toggle on found their
-/// timeline rendered useless within hours. Combined with destructive
-/// writes the originals were unrecoverable. See commit history for
-/// the regression incident.
+/// Default policy is `allow=[Secret], min_score=0.50`.
///
-/// Re-broadening this default requires:
-/// 1. A precision benchmark on real screenpipe content (terminals,
-/// IDEs, browser docs) showing < 1% false-positive rate for the
-/// added classes at the chosen threshold, AND
-/// 2. A user-facing policy preset selector in Settings → Privacy
-/// so per-class trade-offs are user-controlled, not silently
-/// destructive.
+/// **Why secrets-only.** For screenpipe's use case (local memory of
+/// the user's screen), most of what the 12-class model flags as "PII"
+/// is actually *value* — emails, names, dates, URLs, channels are
+/// what makes the timeline searchable. The genuinely-dangerous class
+/// is leaked credentials: passwords, API keys, private keys, auth
+/// tokens, database connection strings. Default redaction is
+/// scoped to that.
+///
+/// **Why min_score 0.50.** rfdetr_v9 (trained 2026-05-08 on the 905-
+/// image augmented bench in screenpipe/screenpipe-pii-bench-image)
+/// ships per-class metrics on the Secret class:
+/// thr 0.30 — P=0.90 R=0.78 F1=0.83
+/// thr 0.50 — P=0.97 R=0.66 F1=0.78 ← this default
+/// thr 0.70 — P=1.00 R=0.60 F1=0.75
+/// 0.50 keeps near-perfect precision (≈ 1 false redaction per 33
+/// detections) while catching ~2 / 3 of actual leaked credentials.
+/// The previous v8-era default at 0.9 produced 0 % recall (model
+/// effectively off); this restores function.
+///
+/// Earlier hotfix history (commits 0d55e6c4b → 8125837ff) pushed the
+/// threshold to 0.9 and then hid the UI entirely after rfdetr_v8
+/// over-redacted code/IDE content at any usable threshold. Both
+/// failure modes are addressed by v9 + this policy: precision is
+/// near-perfect, the allow-list is tight, the UI is back.
+///
+/// To re-broaden the allow-list later (Person, Email, Phone, Url, …),
+/// validate per-class precision on the augmented bench and surface a
+/// per-class toggle in Settings → Privacy so users opt in per class.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ImageRedactionPolicy {
/// Labels whose detections become black boxes. Anything not in
@@ -123,23 +134,23 @@ pub struct ImageRedactionPolicy {
impl Default for ImageRedactionPolicy {
fn default() -> Self {
- // Conservative hotfix default — see the type-level docs above
- // for why we shrank the allow-list and pushed min_score up.
+ // Secrets-only at 0.50 — see the type-level docs for the v9
+ // per-class metrics that motivate this default.
Self {
allow: vec![SpanLabel::Secret],
- min_score: 0.9,
+ min_score: 0.50,
}
}
}
impl ImageRedactionPolicy {
- /// Convenience: same as the (conservative) `Default` for now —
- /// kept as a named entry point so callers that explicitly want
- /// "secrets only" survive future widening of the default.
+ /// Convenience: same as the `Default` for now — kept as a named
+ /// entry point so callers that explicitly want "secrets only"
+ /// survive future widening of the default.
pub fn secrets_only() -> Self {
Self {
allow: vec![SpanLabel::Secret],
- min_score: 0.9,
+ min_score: 0.50,
}
}
}