From 97c6eebfd1c1004ae219936802efc427e5ecd99c Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 31 Oct 2025 02:46:31 -0400 Subject: [PATCH] remove logging --- .../grok/state/grok_credential_manager.rs | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/crates/desktop/artcraft/src/services/grok/state/grok_credential_manager.rs b/crates/desktop/artcraft/src/services/grok/state/grok_credential_manager.rs index 4c2cf9818e..f8728fc060 100644 --- a/crates/desktop/artcraft/src/services/grok/state/grok_credential_manager.rs +++ b/crates/desktop/artcraft/src/services/grok/state/grok_credential_manager.rs @@ -135,7 +135,7 @@ impl GrokCredentialManager { pub fn do_task_polling(&self) -> anyhow::Result { self.session_appears_active() } - + // NB: This is just a heuristic. We'll add better checks later. pub fn session_appears_active(&self) -> anyhow::Result { let holder = match self.credential_data.read() { @@ -143,31 +143,33 @@ impl GrokCredentialManager { Ok(store) => store.clone(), }; + if holder.grok_user_data.is_some() { + return Ok(true); + } + if holder.browser_cookies.is_none() { return Ok(false); } - let cookies = match holder.browser_cookies.as_ref() { - None => return Ok(false), - Some(cookies) => cookies, - }; + // TODO: Heuristic + Ok(true) - let has_user_data = holder.grok_user_data.is_some(); - - // NB: We consider the session active if we have auth cookies and a user id. - //let has_user_id = user_info.user_id.is_some(); - //let maybe_has_auth_cookies = cookie_store_has_auth_cookies(&cookies); - let maybe_has_auth_cookies = true; // TODO TODO TODO - fix this - - // Misc cookies without login cookies are ~1055 length - // AUTH_I is ~1500 length - // AUTH_R is ~500 length - let maybe_has_big_enough_cookie = cookies.calculate_approx_cookie_character_length() > 2100; - - // TODO: Heuristic should count. - // TODO: Consolidate with "login window thread" logic. - // TODO: Check timestamp of last valid request. - Ok(has_user_data || (maybe_has_auth_cookies && maybe_has_big_enough_cookie && maybe_has_big_enough_cookie)) + //let cookies = match holder.browser_cookies.as_ref() { + // None => return Ok(false), + // Some(cookies) => cookies, + //}; + //// NB: We consider the session active if we have auth cookies and a user id. + ////let has_user_id = user_info.user_id.is_some(); + ////let maybe_has_auth_cookies = cookie_store_has_auth_cookies(&cookies); + //let maybe_has_auth_cookies = true; // TODO TODO TODO - fix this + //// Misc cookies without login cookies are ~1055 length + //// AUTH_I is ~1500 length + //// AUTH_R is ~500 length + //let maybe_has_big_enough_cookie = cookies.calculate_approx_cookie_character_length() > 2100; + //// TODO: Heuristic should count. + //// TODO: Consolidate with "login window thread" logic. + //// TODO: Check timestamp of last valid request. + //Ok((maybe_has_auth_cookies && maybe_has_big_enough_cookie && maybe_has_big_enough_cookie)) } pub fn clear_credentials(&self) -> anyhow::Result<()> {