Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
Connect Claude Code saves the token again; the Claude Code sign-in stays with Claude Code (#6103)
ddupontf06d538f7f74
diff --git a/apps/cua-spaces-web/src/__tests__/connectors-redesign.test.tsx b/apps/cua-spaces-web/src/__tests__/connectors-redesign.test.tsxindex a65ee291da..d607f644ce 100644--- a/apps/cua-spaces-web/src/__tests__/connectors-redesign.test.tsx+++ b/apps/cua-spaces-web/src/__tests__/connectors-redesign.test.tsx@@ -66,7 +66,7 @@ describe.skipIf(!wasmBuilt)("Settings, Connectors (redesign)", () => {await click(btn);await waitFor(() => expect(q("[data-connector-app=claude-code]")!.dataset.state).toBe("connected"));await waitFor(() => expect(q("[data-connector-provider=anthropic]")!.dataset.state).toBe("connected"));- expect(q("[data-connector-provider=anthropic]")!.textContent).toContain("Claude sign-in, for Claude Code");+ expect(q("[data-connector-provider=anthropic]")!.textContent).toContain("Claude Code sign-in");const connects = calls.filter((c) => c.op === "agents.connect").map((c) => c.args as { agents: string[]; signIn: boolean });expect(connects).toEqual([{ agents: ["claude-code"], signIn: true }]);});diff --git a/docs/content/docs/cua-sdk/guides/run-a-coding-agent.mdx b/docs/content/docs/cua-sdk/guides/run-a-coding-agent.mdxindex 26af934a8c..92a940a6ad 100644--- a/docs/content/docs/cua-sdk/guides/run-a-coding-agent.mdx+++ b/docs/content/docs/cua-sdk/guides/run-a-coding-agent.mdx@@ -235,7 +235,7 @@ print([h["id"] for h in json.loads(cua.agent_harnesses())])| `opencode` | `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `OPENROUTER_API_KEY` | `openai-chat` | || `goose` | `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`, `OPENROUTER_API_KEY` | `openai-chat` | || `pi` | `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `OPENROUTER_API_KEY` | `openai-chat` | Community ACP adapter; no MCP client |-| `hermes` | `OPENROUTER_API_KEY`, `ANTHROPIC_API_KEY`, `CLAUDE_CODE_OAUTH_TOKEN`, `OPENAI_API_KEY` | `openai-chat` | Needs git; ignores run MCP servers; reads the Claude sign-in, not the ChatGPT one |+| `hermes` | `OPENROUTER_API_KEY`, `ANTHROPIC_API_KEY`, `OPENAI_API_KEY` | `openai-chat` | Needs git; ignores run MCP servers; API keys only (the Claude Code and ChatGPT sign-ins are not given to it) || `openclaw` | `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `OPENROUTER_API_KEY` | `openai-chat` | Starts its own loopback Gateway; no per-run MCP servers |`cua agent harnesses` (or `cua.agent_harnesses()`) prints the full record:diff --git a/libs/cua/crates/cua-agent-setup/src/connection.rs b/libs/cua/crates/cua-agent-setup/src/connection.rsindex 945885937c..864199ee17 100644--- a/libs/cua/crates/cua-agent-setup/src/connection.rs+++ b/libs/cua/crates/cua-agent-setup/src/connection.rs@@ -848,9 +848,9 @@ impl AgentSetup {copy: &SignInCopy,vault: &dyn SignInVault,) -> std::result::Result<ImportedSignIn, signin::CopyRefusal> {- let saved = vault.save(copy).map_err(|e| {- signin::CopyRefusal::Failed(format!("Connected. Sign-in not copied: {e}"))- })?;+ let saved = vault+ .save(copy)+ .map_err(|e| signin::CopyRefusal::Failed(format!("Couldn't save the sign-in: {e}")))?;if let Ok(mut state) = State::load(&self.state_path) {let r = state.connections.entry(agent.to_string()).or_default();r.sign_in = Some(crate::state::SignInRecord {@@ -976,9 +976,7 @@ impl AgentSetup {None => SignInResult {imported: None,refused: Some("failed".into()),- line: Some(- "Connected. Sign-in not copied: Keyvault isn't available here.".into(),- ),+ line: Some("Couldn't save the sign-in: Keyvault isn't available here.".into()),},Some(v) => match match show.as_deref_mut() {Some(show) if signin::signs_in_with_a_code(a.id) => {diff --git a/libs/cua/crates/cua-agent-setup/src/lib.rs b/libs/cua/crates/cua-agent-setup/src/lib.rsindex f65b91052d..f73e5013fb 100644--- a/libs/cua/crates/cua-agent-setup/src/lib.rs+++ b/libs/cua/crates/cua-agent-setup/src/lib.rs@@ -157,7 +157,6 @@ const VARS: &[&str] = &["CUA_HOME","CLAUDE_CONFIG_DIR","CODEX_HOME",- "CUA_TOKEN_CHECK_URL","GEMINI_CLI_HOME","CLINE_DATA_DIR","OPENCLAW_STATE_DIR",diff --git a/libs/cua/crates/cua-agent-setup/src/signin.rs b/libs/cua/crates/cua-agent-setup/src/signin.rsindex ec73a042da..298af48410 100644--- a/libs/cua/crates/cua-agent-setup/src/signin.rs+++ b/libs/cua/crates/cua-agent-setup/src/signin.rs@@ -363,76 +363,6 @@ pub fn find_setup_token(out: &str) -> Option<String> {(tok.len() >= SETUP_TOKEN_MIN && tok.len() <= SETUP_TOKEN_MAX).then_some(tok)}-/// What the provider said about a token.-#[derive(Clone, Copy, Debug, PartialEq, Eq)]-pub enum TokenCheck {- /// Accepted.- Valid,- /// Refused (401 or 403): saving it would only give every agent a 401.- Invalid,- /// No answer (offline, another status): it is saved and used.- Unknown,-}--/// What a status code of the provider's models list says about a token.-fn token_check_for(status: u16) -> TokenCheck {- match status {- 200..=299 => TokenCheck::Valid,- 401 | 403 => TokenCheck::Invalid,- _ => TokenCheck::Unknown,- }-}--/// Asks Anthropic once whether `token` is accepted (a read-only GET of the-/// models list, as the sign-in token the way Claude Code sends it). The token-/// goes to `curl` on its standard input, never in its arguments. Without-/// `run_agent_clis` nothing is asked.-pub fn check_claude_token(env: &HostEnv, token: &str) -> TokenCheck {- use std::io::Write;- if !env.run_agent_clis {- return TokenCheck::Unknown;- }- let base = env- .var("CUA_TOKEN_CHECK_URL")- .map(|b| b.trim_end_matches('/').to_string())- .filter(|b| b.starts_with("http"))- .unwrap_or_else(|| "https://api.anthropic.com".into());- let Ok(mut child) = std::process::Command::new("curl")- .args([- "-sS",- "-o",- "/dev/null",- "-w",- "%{http_code}",- "--max-time",- "15",- "-K",- "-",- ])- .arg(format!("{base}/v1/models?limit=1"))- .stdin(std::process::Stdio::piped())- .stdout(std::process::Stdio::piped())- .stderr(std::process::Stdio::null())- .spawn()- else {- return TokenCheck::Unknown;- };- if let Some(mut stdin) = child.stdin.take() {- let cfg = format!(- "header = \"Authorization: Bearer {token}\"\nheader = \"anthropic-beta: oauth-2025-04-20\"\nheader = \"anthropic-version: 2023-06-01\"\n"- );- let _ = stdin.write_all(cfg.as_bytes());- }- let Ok(out) = child.wait_with_output() else {- return TokenCheck::Unknown;- };- String::from_utf8_lossy(&out.stdout)- .trim()- .parse::<u16>()- .map(token_check_for)- .unwrap_or(TokenCheck::Unknown)-}-fn claude_copy(env: &HostEnv, wait: Duration) -> Result<SignInCopy, CopyRefusal> {let bin = crate::connection::binary(env, registry::find("claude-code").unwrap()).ok_or_else(|| CopyRefusal::Failed("Claude Code isn't installed on This Mac.".into()))?;@@ -465,16 +395,10 @@ fn claude_copy(env: &HostEnv, wait: Duration) -> Result<SignInCopy, CopyRefusal>};let Some((code, stdout)) = out else {return Err(CopyRefusal::Cancelled(- "Connected. Sign-in not copied: the browser approval didn't finish.".into(),+ "The browser approval didn't finish. Try Connect again.".into(),));};match find_setup_token(&stdout) {- Some(token) if check_claude_token(env, &token) == TokenCheck::Invalid => {- Err(CopyRefusal::Failed(- "Connected. Sign-in not copied: Claude didn't accept the token. Try Connect again."- .into(),- ))- }Some(token) => Ok(SignInCopy {source: "claude-code".into(),env: "CLAUDE_CODE_OAUTH_TOKEN".into(),@@ -484,10 +408,10 @@ fn claude_copy(env: &HostEnv, wait: Duration) -> Result<SignInCopy, CopyRefusal>expires_ms: Some(now_ms() + 365 * 24 * 3600 * 1000),}),None if code == Some(0) => Err(CopyRefusal::Failed(- "Connected. Sign-in not copied: claude setup-token printed no token.".into(),+ "Couldn't read the sign-in from Claude. Try Connect again.".into(),)),None => Err(CopyRefusal::Cancelled(- "Connected. Sign-in not copied: the browser approval was cancelled.".into(),+ "The browser approval was cancelled. Try Connect again.".into(),)),}}@@ -1078,63 +1002,6 @@ mod tests {);}- #[test]- fn a_token_check_reads_only_a_refusal_as_invalid() {- assert_eq!(token_check_for(200), TokenCheck::Valid);- assert_eq!(token_check_for(401), TokenCheck::Invalid);- assert_eq!(token_check_for(403), TokenCheck::Invalid);- assert_eq!(token_check_for(429), TokenCheck::Unknown);- assert_eq!(token_check_for(529), TokenCheck::Unknown);- }-- /// A one-shot local provider answering `status`; the request it got.- fn stub_provider(status: &'static str) -> (String, std::thread::JoinHandle<String>) {- use std::io::{Read, Write};- let l = std::net::TcpListener::bind("127.0.0.1:0").unwrap();- let url = format!("http://{}", l.local_addr().unwrap());- let h = std::thread::spawn(move || {- let (mut c, _) = l.accept().unwrap();- let mut buf = [0u8; 4096];- let n = c.read(&mut buf).unwrap();- let body = r#"{"type":"error","error":{"type":"authentication_error","message":"OAuth token invalid"}}"#;- let _ = write!(- c,- "HTTP/1.1 {status}\r\ncontent-type: application/json\r\ncontent-length: {}\r\nconnection: close\r\n\r\n{body}",- body.len()- );- String::from_utf8_lossy(&buf[..n]).into_owned()- });- (url, h)- }-- /// A corrupted token gets the provider's 401 and is refused before it is- /// saved; the token travels in a header, never in the command line.- #[test]- fn a_token_the_provider_refuses_is_not_saved() {- let d = tempfile::tempdir().unwrap();- for (status, want) in [- ("401 Unauthorized", TokenCheck::Invalid),- ("200 OK", TokenCheck::Valid),- ("529 Overloaded", TokenCheck::Unknown),- ] {- let (url, server) = stub_provider(status);- let mut env = HostEnv::isolated(d.path());- env.run_agent_clis = true;- env.vars.insert("CUA_TOKEN_CHECK_URL".into(), url);- let token = "sk-ant-oat01-corrupted-0123456789";- assert_eq!(check_claude_token(&env, token), want, "{status}");- let request = server.join().unwrap();- assert!(request.starts_with("GET /v1/models"), "{request}");- assert!(request.contains(&format!("Bearer {token}")), "{request}");- }- // Nothing is asked when agent commands are off.- let off = HostEnv::isolated(d.path());- assert_eq!(- check_claude_token(&off, "sk-ant-oat01-x"),- TokenCheck::Unknown- );- }-#[test]fn dotenv_reads_hermes_lines() {let d = tempfile::tempdir().unwrap();diff --git a/libs/cua/crates/cua-agent-setup/tests/connection_matrix.rs b/libs/cua/crates/cua-agent-setup/tests/connection_matrix.rsindex aa4c4e9443..fc7f656c99 100644--- a/libs/cua/crates/cua-agent-setup/tests/connection_matrix.rs+++ b/libs/cua/crates/cua-agent-setup/tests/connection_matrix.rs@@ -117,6 +117,7 @@ const CLAUDE_EXTRA: &str = r#" auth)echo '{"authMethod":"none"}'; exit 1 ;;setup-token)if [ -f "$HOME/.fake-claude-cancel" ]; then echo "Login cancelled"; exit 1; fi+ if [ -f "$HOME/.fake-claude-short" ]; then printf 'Your OAuth token:\r\n\r\n sk-ant-oat01-FAKEtoken_0123456789\r\n' ; exit 0; fiprintf 'Your OAuth token:\r\n\r\n sk-ant-oat01-FAKEtoken_0123456789abcdef_ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz_0123456789_QQQQ\r\n' ; exit 0 ;;"#;@@ -129,10 +130,6 @@ impl World {std::fs::create_dir_all(&bin).unwrap();let mut env = HostEnv::isolated(&home);env.path = vec![bin.clone()];- // The pre-save token check asks this address, where nothing answers- // (the check is then inconclusive and the token is saved).- env.vars- .insert("CUA_TOKEN_CHECK_URL".into(), "http://127.0.0.1:9".into());let w = World {_dir: dir,home,@@ -423,33 +420,40 @@ fn connected_but_not_signed_in_says_so_and_offers_sign_in_where_cua_can_start_itassert_eq!(r.signed_in, SignedInState::Unknown);}-/// A corrupted token gets the provider's 401 from a local stub and is never-/// saved: Connect reports it, and the vault stays empty.+/// A token cut short (a redraw, a wrapped line) is never saved, and the line+/// says what happened in plain words, never "Connected" next to "not copied".#[test]-fn a_token_the_provider_refuses_is_never_saved() {- use std::io::{Read, Write};- let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();- let url = format!("http://{}", listener.local_addr().unwrap());- let server = std::thread::spawn(move || {- let (mut c, _) = listener.accept().unwrap();- let mut buf = [0u8; 4096];- let _ = c.read(&mut buf).unwrap();- let body = r#"{"type":"error","error":{"type":"authentication_error","message":"OAuth token invalid"}}"#;- let _ = write!(- c,- "HTTP/1.1 401 Unauthorized\r\ncontent-length: {}\r\nconnection: close\r\n\r\n{body}",- body.len()- );- });- let mut w = World::new();- w.env.vars.insert("CUA_TOKEN_CHECK_URL".into(), url);+fn a_truncated_token_is_refused_with_a_plain_line_and_a_whole_one_is_saved() {+ let w = World::new();w.install("claude-code", "2.4.1");w.sign_in("claude-code");- w.connect("claude-code", true);- server.join().unwrap();+ w.write(".fake-claude-short", "1");+ let mut env = w.env.clone();+ env.run_agent_clis = true;+ let r = AgentSetup::new(env)+ .connect(+ &["claude-code".into()],+ &w.server(),+ ConnectParts {+ skills: false,+ mcp: false,+ sign_in: true,+ },+ Some(&w.vault),+ Duration::from_secs(10),+ )+ .unwrap();+ let s = r[0].sign_in.as_ref().unwrap();+ assert_eq!(+ s.line.as_deref(),+ Some("Couldn't read the sign-in from Claude. Try Connect again.")+ );+ assert!(!s.line.as_ref().unwrap().contains("Connected"));assert_eq!(w.vault.value("claude-code"), None);- let r = w.row("claude-code");- assert_ne!(r.signin_import, ImportState::Ok, "{r:#?}");+ // The whole token (about 108 characters) is saved with no network involved.+ std::fs::remove_file(w.home.join(".fake-claude-short")).unwrap();+ w.connect("claude-code", true);+ assert_eq!(w.vault.value("claude-code").unwrap().len(), 109);}#[test]@@ -606,7 +610,7 @@ fn a_refused_sign_in_copy_leaves_the_tools_connected_with_one_line() {s.line.as_ref().unwrap()- .starts_with("Connected. Sign-in not copied")+ .starts_with("The browser approval was cancelled"));// Hermes on an OAuth provider: not yet.w.install("hermes", "0.22.5");diff --git a/libs/cua/crates/cua-agents/src/failure.rs b/libs/cua/crates/cua-agents/src/failure.rsindex f340fbab41..467c9cf20a 100644--- a/libs/cua/crates/cua-agents/src/failure.rs+++ b/libs/cua/crates/cua-agents/src/failure.rs@@ -123,12 +123,17 @@ pub fn classify(harness: &str, text: &str) -> Failure {/// What a person reads instead of the raw error, in plain words from the/// agent's side (it is the agent's reply).-pub fn plain(f: &Failure) -> String {+pub fn plain(f: &Failure, harness: &str) -> String {match f.class {- FailureClass::NeedsConnect => match f.provider.as_deref() {- Some("anthropic") => "I can't reach Claude yet. Connect Claude, then try again.".into(),- Some("openai") => "I can't reach OpenAI yet. Connect OpenAI, then try again.".into(),- _ => "I'm not connected to an AI provider yet. Connect one, then try again.".into(),+ FailureClass::NeedsConnect => match (harness, f.provider.as_deref()) {+ ("claude-code", _) => "I can't reach Claude yet. Connect Claude, then try again.".into(),+ ("openai-codex", _) => "I can't reach OpenAI yet. Connect OpenAI, then try again.".into(),+ // The subscription sign-ins are Claude Code's and Codex's alone.+ ("hermes", _) => "Hermes needs an Anthropic API key or another provider. Your Claude subscription sign-in only works in Claude Code.".into(),+ (h, _) => {+ let name = crate::harness::harness(h).map_or("This agent", |h| h.name);+ format!("{name} needs an API key for a provider it can use. Your Claude subscription sign-in only works in Claude Code.")+ }},FailureClass::Error => "I couldn't finish that.".into(),}@@ -183,7 +188,13 @@ mod tests {#[test]fn plain_words_never_carry_the_raw_error() {let f = classify("claude-code", "API Error: 401 {\"error\":\"invalid\"}");- let p = plain(&f);+ let p = plain(&f, "claude-code");+ let h = plain(+ &classify("hermes", "not connected to any AI provider"),+ "hermes",+ );+ assert!(h.starts_with("Hermes needs an Anthropic API key"), "{h}");+ assert!(h.contains("only works in Claude Code"));assert!(!p.contains("401") && !p.contains('{'), "{p}");assert!(!p.contains('\u{b7}'));}diff --git a/libs/cua/crates/cua-agents/src/harness.rs b/libs/cua/crates/cua-agents/src/harness.rsindex d737102287..d73239371d 100644--- a/libs/cua/crates/cua-agents/src/harness.rs+++ b/libs/cua/crates/cua-agents/src/harness.rs@@ -241,15 +241,10 @@ pub const HARNESSES: &[Harness] = &[installs: &["hermes"],acp: &["hermes-acp"],cli: Some("hermes"),- // CLAUDE_CODE_OAUTH_TOKEN: the Claude sign-in Connect made; Hermes- // reads it as its Anthropic credential. It has no reader for the- // ChatGPT sign-in (CODEX_AUTH_JSON), so that one is not forwarded.- keys: &[- "OPENROUTER_API_KEY",- "ANTHROPIC_API_KEY",- "CLAUDE_CODE_OAUTH_TOKEN",- "OPENAI_API_KEY",- ],+ // Provider API keys only. The Claude subscription sign-in+ // (CLAUDE_CODE_OAUTH_TOKEN) and the ChatGPT one (CODEX_AUTH_JSON) are+ // Claude Code's and Codex's: they are never given to Hermes.+ keys: &["OPENROUTER_API_KEY", "ANTHROPIC_API_KEY", "OPENAI_API_KEY"],// Its own `.env` (a key set inside the Space) or a provider sign-in.logins: Some(&["[ -s \"$HOME/.hermes/.env\" ]",diff --git a/libs/cua/crates/cua-agents/src/runs.rs b/libs/cua/crates/cua-agents/src/runs.rsindex 304dbe8fde..2f8d0d83a4 100644--- a/libs/cua/crates/cua-agents/src/runs.rs+++ b/libs/cua/crates/cua-agents/src/runs.rs@@ -1612,10 +1612,13 @@ mod tests {h.id);}- // Hermes reads the Claude sign-in too.+ // The subscription sign-ins stay with Claude Code and Codex.let hermes = harness::harness("hermes").unwrap();- assert!(hermes.keys.contains(&"CLAUDE_CODE_OAUTH_TOKEN"));+ assert!(!hermes.keys.contains(&"CLAUDE_CODE_OAUTH_TOKEN"));assert!(!hermes.keys.contains(&"CODEX_AUTH_JSON"));+ for h in harness::HARNESSES.iter().filter(|h| h.id != "claude-code") {+ assert!(!h.keys.contains(&"CLAUDE_CODE_OAUTH_TOKEN"), "{}", h.id);+ }// A harness added without a list of its own files only gets a note.let open = Harness {logins: None,diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/connectors.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/connectors.jsonindex 4f6d530eb2..be80d0a2c2 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/connectors.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/connectors.json@@ -22,7 +22,7 @@],"footer": "Sign-ins and keys stay on this Mac in the Keychain. Each one is only given to the apps that use it.","providers": [- "anthropic | connected | Claude sign-in, for Claude Code | Sign out",+ "anthropic | connected | Claude Code sign-in | Sign out","openai | connected | API key •••• 3f9a | Sign out","github | not-connected | Not connected | Connect"],@@ -74,7 +74,7 @@{"detail": "claude-code","note": null,- "signIn": "Signs in with Anthropic | Claude sign-in, for Claude Code | Sign out",+ "signIn": "Signs in with Anthropic | Claude Code sign-in | Sign out","status": "Connected","toggles": ["skills | Cua skills | true",diff --git a/libs/cua/crates/cua-spaces-app-core/src/connectors.rs b/libs/cua/crates/cua-spaces-app-core/src/connectors.rsindex c67a96f9fc..883d8da978 100644--- a/libs/cua/crates/cua-spaces-app-core/src/connectors.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/connectors.rs@@ -92,7 +92,7 @@ const PROVIDERS: &[Provider] = &[label: "Anthropic",env: "ANTHROPIC_API_KEY",also: &["CLAUDE_CODE_OAUTH_TOKEN"],- used_by: "Claude Code, Hermes and other apps that use Claude.",+ used_by: "Claude Code. Hermes and other apps that use Claude need an API key.",key_help: "Create a key at console.anthropic.com. Every app that uses Claude can use it.",placeholder: "sk-ant-…",ways: &[CLAUDE_TOKEN, Way::Key, Way::Shell],@@ -160,13 +160,8 @@ const APPS: &[AppSignIn] = &[app: "hermes",providers: &["anthropic", "openai"],way: None,- // Not CODEX_AUTH_JSON: Hermes has no reader for the ChatGPT sign-in.- reads: &[- "OPENROUTER_API_KEY",- "ANTHROPIC_API_KEY",- "CLAUDE_CODE_OAUTH_TOKEN",- "OPENAI_API_KEY",- ],+ // API keys only: the Claude Code and ChatGPT sign-ins are not Hermes'.+ reads: &["OPENROUTER_API_KEY", "ANTHROPIC_API_KEY", "OPENAI_API_KEY"],},AppSignIn {app: "t3code",@@ -325,7 +320,7 @@ fn dots(k: &AgentKeyInput) -> String {/// How a saved credential reads on its provider's row.fn credential_text(p: &Provider, k: &AgentKeyInput) -> String {match k.env.as_str() {- "CLAUDE_CODE_OAUTH_TOKEN" => "Claude sign-in, for Claude Code".into(),+ "CLAUDE_CODE_OAUTH_TOKEN" => "Claude Code sign-in".into(),"CODEX_AUTH_JSON" => "ChatGPT sign-in, for Codex".into(),e if e == p.env => format!("API key {}", dots(k)),e => format!("{e} {}", dots(k)),@@ -376,7 +371,7 @@ pub struct ConnectorProviderRow {pub label: String,/// `connected`, `not-connected`, `connecting`, `failed`.pub state: String,- /// "Not connected", "API key •••• 3f9a", "Claude sign-in, for Claude Code",+ /// "Not connected", "API key •••• 3f9a", "Claude Code sign-in",/// "Approve in your browser…".pub status: String,/// Who uses it.@@ -445,12 +440,19 @@ fn app_row(input: &ConnectorsInput, a: &ConnectorAppInput) -> ConnectorAppRow {let signed_in = app_signed_in(input, &a.agent);let done = a.configured && signed_in;let needs = app_sign_in(&a.agent).filter(|_| !signed_in).map(|s| {- s.providers+ let names = s+ .providers.iter().filter_map(|p| provider(p)).map(|p| p.label).collect::<Vec<_>>()- .join(" or ")+ .join(" or ");+ // An app with no sign-in of its own takes API keys: say so.+ if s.way.is_none() && !s.reads.is_empty() {+ format!("Needs an API key for {names}.")+ } else {+ format!("Needs a sign-in to {names}.")+ }});let (state, line, btn) = if let Some(step) = busy {let line = match step {@@ -483,7 +485,7 @@ fn app_row(input: &ConnectorsInput, a: &ConnectorAppInput) -> ConnectorAppRow {if app_expired(input, &a.agent) {Some("The sign-in expired. Reconnect.".to_string())} else {- needs.map(|n| format!("Needs a sign-in to {n}."))+ needs},Some(button("connect", "Connect", true)),)@@ -833,7 +835,7 @@ pub struct ConnectorToggle {pub struct ConnectorSignIn {/// "Signs in with Anthropic".pub title: String,- /// The provider row's status for it ("Claude sign-in, for Claude Code", "Not connected").+ /// The provider row's status for it ("Claude Code sign-in", "Not connected").pub status: String,pub connected: bool,/// How Connect signs it in ("Claude sign-in, through claude setup-token").@@ -1091,8 +1093,13 @@ mod tests {assert!(app_signed_in(&k, "hermes"));let mut t = input();t.keys.keys.push(key("CLAUDE_CODE_OAUTH_TOKEN", "AAAA"));- assert!(app_signed_in(&t, "hermes") && app_signed_in(&t, "claude-code"));+ // The Claude Code sign-in is Claude Code's alone.+ assert!(app_signed_in(&t, "claude-code"));+ assert!(!app_signed_in(&t, "hermes"));assert!(!app_signed_in(&t, "codex"));+ let mut a = input();+ a.keys.keys.push(key("ANTHROPIC_API_KEY", "AAAA"));+ assert!(app_signed_in(&a, "hermes") && app_signed_in(&a, "claude-code"));}#[test]@@ -1154,7 +1161,7 @@ mod tests {assert_eq!(v.apps[0].state, "connected");let a = &v.providers[0];assert_eq!(a.state, "connected");- assert_eq!(a.status, "Claude sign-in, for Claude Code");+ assert_eq!(a.status, "Claude Code sign-in");assert_eq!(a.button.label, "Sign out");assert_eq!(a.sign_out_envs, ["CLAUDE_CODE_OAUTH_TOKEN"]);// The sign-in token is the provider's, not an Other key.diff --git a/libs/cua/crates/cua-spaces-ext/src/persistent/members.rs b/libs/cua/crates/cua-spaces-ext/src/persistent/members.rsindex 66f642e346..4e0df42f1b 100644--- a/libs/cua/crates/cua-spaces-ext/src/persistent/members.rs+++ b/libs/cua/crates/cua-spaces-ext/src/persistent/members.rs@@ -671,7 +671,7 @@ impl Persistent {let mut reply = Draft::new(Author::agent(&rec.name),EntryKind::Message,- ag::failure::plain(&failure),+ ag::failure::plain(&failure, &rec.harness),);reply.reply_to = Some(task.seq);reply.failure = Some(failure);@@ -864,7 +864,7 @@ impl Persistent {let failure = error.as_deref().map(|e| failure_for(rec, e));let text = match (&failure, &answer) {// Plain words; the complete error rides along as `failure`.- (Some(f), _) => ag::failure::plain(f),+ (Some(f), _) => ag::failure::plain(f, &rec.harness),(None, Some(a)) if !a.trim().is_empty() => a.trim().to_string(),_ => "Finished.".to_string(),};