Skip to content

Commit b8510ed

Browse files
atishpatelcodexGoose
authored
fix(desktop): clarify CLI runtime setup (#2680)
## Why Installing the Codex, Claude, or Goose desktop app does not install the command-line harness Buzz needs. The current UI makes that distinction unclear, links some missing-CLI states to adapter documentation, and can report a successful install from the installer exit code even when runtime discovery still fails. On Windows, Buzz also invokes Goose's Bash installer, which writes the executable somewhere Buzz does not discover. ## What - distinguish missing vendor CLIs from missing or outdated ACP adapters in runtime metadata and UI guidance - link Codex, Claude Code, and Goose missing-CLI states to their official CLI installation documentation - explain in Settings, onboarding, and agent configuration that the desktop app alone is not sufficient - use Goose's official PowerShell installer on Windows - refresh PATH and rediscover the requested runtime after installation, keeping the control retryable if the runtime is still unavailable - add Rust and Playwright regression coverage for Windows installer selection, CLI/adapter guidance, false-success prevention, verified installs, and onboarding copy ## Risk Assessment Medium. This changes desktop onboarding and runtime installation behavior. Successful installs now require the runtime catalog to verify availability; previously hidden discovery failures will surface as actionable errors instead of a false success state. ## References - [Codex CLI installation](https://developers.openai.com/codex/cli/) - [Claude Code installation](https://code.claude.com/docs/en/getting-started) - [Goose installation](https://goose-docs.ai/docs/getting-started/installation/) - Follow-up to #2563 and #2587 ## Validation - `just desktop-typecheck` - `just desktop-test` — 3,455 passed - focused Rust post-install verification tests - focused Playwright Doctor/onboarding coverage (in progress; CI and local sequential rerun will provide final results) Generated with Codex --------- Signed-off-by: Atish Patel <[email protected]> Co-authored-by: Codex <[email protected]> Co-authored-by: Goose <[email protected]>
1 parent 8398468 commit b8510ed

19 files changed

Lines changed: 501 additions & 197 deletions

File tree

‎desktop/scripts/check-file-sizes.mjs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,9 @@ const overrides = new Map([
498498
// route PowerShell CLI installs natively on Windows (bypasses Git Bash PATH
499499
// poisoning that resolved GNU tar instead of bsdtar → Codex install failure).
500500
// Includes unit tests for detection, routing, and -Command body preservation.
501-
["src-tauri/src/commands/agent_discovery.rs", 1810],
501+
// +16: test_powershell_command_goose_catalog_dequoted proves the \$→$ escape
502+
// fix for the Goose Windows installer (PR #2680 interaction with #2750).
503+
["src-tauri/src/commands/agent_discovery.rs", 1826],
502504
// draft-persistence predicate: submit-time `loadDraft` check + inline comment
503505
// + deps-array entry in submitMessage closes the never-persisted-boundary
504506
// defect (Thufir Pass-3 finding). Load-bearing correctness fix; queued to

‎desktop/src-tauri/src/commands/agent_config.rs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,6 @@ fn parse_models(raw: Option<&serde_json::Value>) -> (Vec<AcpModelEntry>, Option<
596596

597597
#[cfg(test)]
598598
mod tests {
599-
use std::collections::BTreeMap;
600-
601599
use super::*;
602600
use crate::managed_agents::{BackendKind, RespondTo};
603601

@@ -614,7 +612,8 @@ mod tests {
614612
cli_install_commands: &[],
615613
cli_install_commands_windows: &[],
616614
adapter_install_commands: &[],
617-
install_instructions_url: "",
615+
cli_install_instructions_url: "",
616+
adapter_install_instructions_url: "",
618617
cli_install_hint: "",
619618
adapter_install_hint: "",
620619
skill_dir: None,
@@ -654,7 +653,7 @@ mod tests {
654653
parallelism: 1,
655654
system_prompt: None,
656655
model: None,
657-
env_vars: BTreeMap::new(),
656+
env_vars: Default::default(),
658657
start_on_app_launch: false,
659658
auto_restart_on_config_change: true,
660659
runtime_pid: None,
@@ -705,7 +704,7 @@ mod tests {
705704
is_active: true,
706705
source_team: None,
707706
source_team_persona_slug: None,
708-
env_vars: BTreeMap::new(),
707+
env_vars: Default::default(),
709708
respond_to: None,
710709
respond_to_allowlist: Vec::new(),
711710
parallelism: None,

‎desktop/src-tauri/src/commands/agent_discovery.rs‎

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ use crate::{
1212
relay::query_relay,
1313
};
1414

15+
mod post_install_verification;
16+
1517
fn active_installs() -> &'static std::sync::Mutex<std::collections::HashSet<String>> {
1618
use std::collections::HashSet;
1719
use std::sync::{Mutex, OnceLock};
@@ -229,11 +231,10 @@ fn install_acp_runtime_blocking(runtime_id: &str) -> Result<InstallRuntimeResult
229231
}
230232
}
231233

232-
// Clear the resolve cache so the next discovery picks up new binaries.
233-
crate::managed_agents::clear_resolve_cache();
234+
post_install_verification::run(runtime_id, &mut steps);
234235

235236
Ok(InstallRuntimeResult {
236-
success: true,
237+
success: steps.iter().all(|step| step.success),
237238
steps,
238239
restarted_count: 0,
239240
failed_restart_count: 0,
@@ -1500,17 +1501,6 @@ mod tests {
15001501
);
15011502
}
15021503

1503-
/// Goose install commands are the same on all platforms (script is Windows-aware).
1504-
#[test]
1505-
fn test_goose_install_commands_same_on_all_platforms() {
1506-
let goose = crate::managed_agents::known_acp_runtime_exact("goose").unwrap();
1507-
assert_eq!(
1508-
goose.cli_install_commands_for_os(),
1509-
goose.cli_install_commands,
1510-
"goose install commands must be identical across platforms"
1511-
);
1512-
}
1513-
15141504
/// buzz-agent has no install commands on any platform.
15151505
#[test]
15161506
fn test_buzz_agent_has_no_install_commands() {
@@ -1675,6 +1665,32 @@ mod tests {
16751665
);
16761666
}
16771667

1668+
/// Goose Windows catalog command (discovery.rs:78) must dequote to a bare pipeline
1669+
/// with a literal `$env:` prefix — no backslash before the dollar sign.
1670+
/// This proves the `\$` → `$` escape fix: post-#2750 the spawn is native and
1671+
/// PowerShell receives the body verbatim, so a residual `\` would produce
1672+
/// `\$env:CONFIGURE='false'` which is a malformed statement.
1673+
#[cfg(windows)]
1674+
#[test]
1675+
fn test_powershell_command_goose_catalog_dequoted() {
1676+
let cmd = super::install_powershell_command(
1677+
r#"powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$env:CONFIGURE='false'; irm https://raw.githubusercontent.com/aaif-goose/goose/main/download_cli.ps1 | iex""#,
1678+
);
1679+
assert_eq!(
1680+
cmd.get_args()
1681+
.map(|a| a.to_string_lossy().into_owned())
1682+
.collect::<Vec<_>>(),
1683+
vec![
1684+
"-NoProfile",
1685+
"-ExecutionPolicy",
1686+
"Bypass",
1687+
"-Command",
1688+
"$env:CONFIGURE='false'; irm https://raw.githubusercontent.com/aaif-goose/goose/main/download_cli.ps1 | iex",
1689+
],
1690+
"Goose catalog command must dequote with bare $env: (no backslash before $)"
1691+
);
1692+
}
1693+
16781694
// ── install retry ─────────────────────────────────────────────────────────
16791695

16801696
/// Build an `InstallStepResult` with just the fields the retry loop reads.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
use crate::managed_agents::{AcpAvailabilityStatus, InstallStepResult};
2+
3+
pub(super) fn run(runtime_id: &str, steps: &mut Vec<InstallStepResult>) {
4+
// Observe PATH changes and binaries added after Buzz launched.
5+
crate::managed_agents::refresh_login_shell_path();
6+
crate::managed_agents::clear_resolve_cache();
7+
8+
let availability = crate::managed_agents::discover_acp_runtime_availability(runtime_id);
9+
if let Some(failure) = failure(runtime_id, availability) {
10+
steps.push(failure);
11+
}
12+
}
13+
14+
fn failure(
15+
runtime_id: &str,
16+
availability: Option<AcpAvailabilityStatus>,
17+
) -> Option<InstallStepResult> {
18+
if availability == Some(AcpAvailabilityStatus::Available) {
19+
return None;
20+
}
21+
22+
let observed = availability
23+
.map(availability_label)
24+
.unwrap_or_else(|| "missing from the runtime catalog".to_string());
25+
Some(InstallStepResult {
26+
step: "verify".to_string(),
27+
command: format!("discover {runtime_id}"),
28+
success: false,
29+
stdout: String::new(),
30+
stderr: format!(
31+
"The installer finished, but Buzz still could not use {runtime_id} (observed: {observed})."
32+
),
33+
exit_code: None,
34+
hint: Some(
35+
"Buzz requires the vendor CLI executable, not only its desktop app. If the CLI was installed while Buzz was open, restart Buzz and check again."
36+
.to_string(),
37+
),
38+
})
39+
}
40+
41+
fn availability_label(status: AcpAvailabilityStatus) -> String {
42+
match status {
43+
AcpAvailabilityStatus::Available => "available",
44+
AcpAvailabilityStatus::AdapterMissing => "ACP adapter missing",
45+
AcpAvailabilityStatus::AdapterOutdated => "ACP adapter outdated",
46+
AcpAvailabilityStatus::CliMissing => "CLI missing",
47+
AcpAvailabilityStatus::NotInstalled => "not installed",
48+
}
49+
.to_string()
50+
}
51+
52+
#[cfg(test)]
53+
mod tests {
54+
use super::*;
55+
56+
#[test]
57+
fn accepts_available_runtime() {
58+
assert!(failure("goose", Some(AcpAvailabilityStatus::Available)).is_none());
59+
}
60+
61+
#[test]
62+
fn rejects_unresolved_runtime() {
63+
let failure = failure("goose", Some(AcpAvailabilityStatus::NotInstalled))
64+
.expect("not-installed runtime must fail verification");
65+
66+
assert_eq!(failure.step, "verify");
67+
assert!(!failure.success);
68+
assert!(failure.stderr.contains("observed: not installed"));
69+
assert!(failure
70+
.hint
71+
.as_deref()
72+
.is_some_and(|hint| hint.contains("desktop app")));
73+
}
74+
}

‎desktop/src-tauri/src/managed_agents/config_bridge/reader_tests.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ fn test_runtime() -> &'static KnownAcpRuntime {
4040
cli_install_commands: &[],
4141
cli_install_commands_windows: &[],
4242
adapter_install_commands: &[],
43-
install_instructions_url: "",
43+
cli_install_instructions_url: "",
44+
adapter_install_instructions_url: "",
4445
cli_install_hint: "",
4546
adapter_install_hint: "",
4647
skill_dir: None,
@@ -615,7 +616,8 @@ fn buzz_agent_runtime() -> &'static KnownAcpRuntime {
615616
cli_install_commands: &[],
616617
cli_install_commands_windows: &[],
617618
adapter_install_commands: &[],
618-
install_instructions_url: "",
619+
cli_install_instructions_url: "",
620+
adapter_install_instructions_url: "",
619621
cli_install_hint: "",
620622
adapter_install_hint: "",
621623
skill_dir: None,

0 commit comments

Comments
 (0)