Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
fix(host): let other agents sign in after a refused prompt
forwardxub2489d060a8f
diff --git a/host/src/agent/backends/sign_in.rs b/host/src/agent/backends/sign_in.rsindex 9a466e44..7a4494d6 100644--- a/host/src/agent/backends/sign_in.rs+++ b/host/src/agent/backends/sign_in.rs@@ -37,12 +37,17 @@ pub fn signed_in(id: &str) -> Option<bool> {SIGNED_IN.locked().iter().find(|(h, _)| h == id).map(|(_, ok)| *ok)}-/// A prompt was refused because the agent asked for auth. `WorkBuddy` can still report an-/// account after that, which is not proof the next prompt will be accepted.+/// A prompt was refused because the agent asked for auth. Only an agent whose new session does+/// not prove sign-in (`WorkBuddy`) can still report an account after that. Other agents' own+/// checks stand, so a setup terminal or saved keys can sign them in.static PROMPT_REFUSED: Mutex<Vec<String>> = Mutex::new(Vec::new());/// The latest prompt for `id` was refused for auth. Stands until a prompt succeeds or the user signs in again.+/// An agent whose session proves sign-in is not recorded: its next check is the proof.pub fn note_prompt_refused(id: &str) {+ if super::workbuddy::session_proves_sign_in(id) {+ return;+ }let mut refused = PROMPT_REFUSED.locked();if !refused.iter().any(|known| known == id) {refused.push(id.to_owned());@@ -54,7 +59,11 @@ pub fn clear_prompt_refused(id: &str) {}/// An account check that says signed in loses to a prompt that was just refused for auth.+/// Other agents are unchanged: their check is what a finished terminal or saved keys report.pub fn apply_prompt_refusal(id: &str, probe: Option<bool>) -> Option<bool> {+ if super::workbuddy::session_proves_sign_in(id) {+ return probe;+ }if probe == Some(true) && PROMPT_REFUSED.locked().iter().any(|known| known == id) { Some(false) } else { probe }}@@ -105,7 +114,7 @@ mod tests {#[test]fn a_refused_prompt_outranks_an_account_that_still_looks_signed_in() {- let id = "workbuddy-refusal-test";+ let id = "workbuddy";clear_prompt_refused(id);assert_eq!(apply_prompt_refusal(id, Some(true)), Some(true));note_prompt_refused(id);@@ -115,4 +124,13 @@ mod tests {clear_prompt_refused(id);assert_eq!(apply_prompt_refusal(id, Some(true)), Some(true));}++ #[test]+ fn another_agents_sign_in_check_is_not_held_back() {+ let id = "qwen";+ clear_prompt_refused(id);+ note_prompt_refused(id);+ assert_eq!(apply_prompt_refusal(id, Some(true)), Some(true), "a setup terminal or saved keys can sign it in");+ assert_eq!(apply_prompt_refusal(id, None), None);+ }}diff --git a/host/src/agent/bot/queue.rs b/host/src/agent/bot/queue.rsindex 642ff36c..ed7bcc68 100644--- a/host/src/agent/bot/queue.rs+++ b/host/src/agent/bot/queue.rs@@ -344,8 +344,9 @@ impl Actor {}let held = self.held_for_sign_in().to_vec();crate::agent::backends::set_signed_in(&backend, Some(false));- // The account object can still be there. It must not count as signed in until a prompt works,- // or the user signs in again. WorkBuddy's current process was opened before that, so drop it.+ // WorkBuddy can still report an account after this, which is not a working login.+ // Other agents' own checks are left alone, so a terminal or saved keys can sign them in.+ // WorkBuddy's current process was opened before that, so drop it.crate::agent::backends::note_prompt_refused(&backend);if !crate::agent::backends::session_proves_sign_in(&backend) {self.restart_after_turn = true;