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(enterprise): report "centralized data not enabled" instead of "license rejected", and fix Discriminant(0) upload-mode logging
Louis Beaumont24454d5d730a
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rs b/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rsindex c975a2c51..8b4c37bdb 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rs@@ -564,8 +564,8 @@ mod imp {let mut cfg = cfg;cfg.resolve_upload_mode().await;info!(- "enterprise sync: resolved upload mode = {:?}",- std::mem::discriminant(&cfg.upload_mode)+ "enterprise sync: resolved upload mode = {}",+ cfg.upload_mode.label());ee_sync::run(cfg, local, rx).await;diff --git a/ee/desktop-rust/enterprise_sync.rs b/ee/desktop-rust/enterprise_sync.rsindex f8936f8f9..914d27795 100644--- a/ee/desktop-rust/enterprise_sync.rs+++ b/ee/desktop-rust/enterprise_sync.rs@@ -460,6 +460,8 @@ pub enum EnterpriseSyncError {Ingest(String),#[error("ingest auth rejected (license invalid / revoked)")]IngestAuthRejected,+ #[error("centralized data not enabled for this org")]+ CentralizedDataDisabled,#[error("ingest server error: status {0}")]IngestServerError(u16),#[error("control-plane network error: {0}")]@@ -631,7 +633,15 @@ pub async fn post_jsonl(if status.is_success() {return Ok(());}- if status == reqwest::StatusCode::UNAUTHORIZED || status == reqwest::StatusCode::FORBIDDEN {+ if status == reqwest::StatusCode::FORBIDDEN {+ // 403 = the license is valid, but centralized data is OFF for the org,+ // so the ingest endpoint refuses (privacy-by-default). NOT a license+ // problem — an admin must enable centralized data in the dashboard+ // before any device can upload. Distinct from 401 so it isn't+ // misreported as "license rejected".+ return Err(EnterpriseSyncError::CentralizedDataDisabled);+ }+ if status == reqwest::StatusCode::UNAUTHORIZED {return Err(EnterpriseSyncError::IngestAuthRejected);}if status.is_server_error() {@@ -1304,10 +1314,10 @@ async fn submit_stall_logs(cfg: &EnterpriseSyncConfig, http: &reqwest::Client) {// 3. confirm (this is what files it for support)let feedback = format!(- "auto: enterprise device recording but not landing data in org storage (license {}, device {}, mode {:?})",+ "auto: enterprise device recording but not landing data in org storage (license {}, device {}, mode {})",cfg.license_key,cfg.device_id,- std::mem::discriminant(&cfg.upload_mode)+ cfg.upload_mode.label());let _ = http.post(format!("{base}/api/logs/confirm"))@@ -1420,7 +1430,20 @@ pub async fn run(}Err(EnterpriseSyncError::IngestAuthRejected) => {error!(- "enterprise sync: license rejected by ingest endpoint, sleeping {}s",+ "enterprise sync: license rejected by ingest endpoint (license invalid / revoked), sleeping {}s",+ RETRY_AFTER_AUTH_FAIL.as_secs()+ );+ if sleep_or_shutdown(RETRY_AFTER_AUTH_FAIL, &mut shutdown).await {+ break;+ }+ continue;+ }+ Err(EnterpriseSyncError::CentralizedDataDisabled) => {+ // The device is recording but the org hasn't turned on+ // centralized data, so nothing can upload. Say exactly that —+ // the fix is an admin toggle in the dashboard, not a license issue.+ error!(+ "enterprise sync: centralized data is NOT enabled for this org — an admin must enable it in the dashboard before devices can upload; pausing {}s",RETRY_AFTER_AUTH_FAIL.as_secs());if sleep_or_shutdown(RETRY_AFTER_AUTH_FAIL, &mut shutdown).await {diff --git a/ee/desktop-rust/enterprise_upload.rs b/ee/desktop-rust/enterprise_upload.rsindex 174198767..2c0454522 100644--- a/ee/desktop-rust/enterprise_upload.rs+++ b/ee/desktop-rust/enterprise_upload.rs@@ -70,6 +70,18 @@ pub enum EnterpriseUploadMode {DirectReadable(DirectUploadConfig),}+impl EnterpriseUploadMode {+ /// Stable, human-readable mode name for logs / support output. Avoids the+ /// `{:?}`-on-`discriminant` footgun that printed a bare `Discriminant(0)`.+ pub fn label(&self) -> &'static str {+ match self {+ Self::HostedIngest => "hosted_ingest",+ Self::DirectEncrypted(_) => "direct_encrypted",+ Self::DirectReadable(_) => "direct_readable",+ }+ }+}+#[derive(Debug, Clone)]pub struct DirectUploadConfig {pub ticket_url: String,@@ -676,6 +688,19 @@ mod tests {// breaks loudly before any customer sees corrupt ciphertext.use screenpipe_core::sync::crypto::decrypt;+ #[test]+ fn upload_mode_label_is_readable_not_a_discriminant() {+ assert_eq!(EnterpriseUploadMode::HostedIngest.label(), "hosted_ingest");+ assert_eq!(+ EnterpriseUploadMode::DirectReadable(direct_cfg()).label(),+ "direct_readable"+ );+ assert_eq!(+ EnterpriseUploadMode::DirectEncrypted(direct_cfg()).label(),+ "direct_encrypted"+ );+ }+fn direct_cfg() -> DirectUploadConfig {DirectUploadConfig {ticket_url: "https://screenpipe.com/api/enterprise/upload-ticket".to_string(),