-
Notifications
You must be signed in to change notification settings - Fork 2.1k
desktop: show Goose updates when available #3839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lifeizhou-ap
wants to merge
4
commits into
block:main
Choose a base branch
from
lifeizhou-ap:codex/goose-update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9b8764e
feat(desktop): add manual Goose updates
lifeizhou-ap c4a031d
feat(desktop): show Goose updates when available
lifeizhou-ap f2f0498
fix(desktop): scope update progress to Goose
lifeizhou-ap 1bef070
fix(desktop): scope Goose update checks to session
lifeizhou-ap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
desktop/src-tauri/src/commands/agent_discovery/cli_setup.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| use std::path::Path; | ||
|
|
||
| use crate::managed_agents::KnownAcpRuntime; | ||
|
|
||
| /// Plan the vendor CLI portion of an explicit runtime setup request. | ||
| /// | ||
| /// Missing CLIs use the catalog installer. An already-installed Goose uses its | ||
| /// resolved executable for an optional user-requested update. Other installed | ||
| /// CLIs need no setup command. | ||
| pub(super) fn plan(runtime: &KnownAcpRuntime) -> Vec<(&'static str, String)> { | ||
| let Some(cli) = runtime.underlying_cli else { | ||
| return Vec::new(); | ||
| }; | ||
| let cli_path = crate::managed_agents::resolve_command(cli); | ||
| plan_commands( | ||
| runtime.id, | ||
| cli_path.as_deref(), | ||
| runtime.cli_install_commands_for_os(), | ||
| ) | ||
| } | ||
|
|
||
| fn plan_commands( | ||
| runtime_id: &str, | ||
| cli_path: Option<&Path>, | ||
| install_commands: &[&str], | ||
| ) -> Vec<(&'static str, String)> { | ||
| match cli_path { | ||
| Some(path) if runtime_id == "goose" => { | ||
| vec![("update", goose_update_command(path))] | ||
| } | ||
| Some(_) => Vec::new(), | ||
| None => install_commands | ||
| .iter() | ||
| .map(|command| ("cli", (*command).to_string())) | ||
| .collect(), | ||
| } | ||
| } | ||
|
|
||
| #[cfg(not(windows))] | ||
| fn goose_update_command(path: &Path) -> String { | ||
| let path = path.display().to_string(); | ||
| format!("'{}' update", path.replace('\'', "'\"'\"'")) | ||
| } | ||
|
|
||
| #[cfg(windows)] | ||
| fn goose_update_command(path: &Path) -> String { | ||
| let path = path.display().to_string(); | ||
| let quoted_path = format!("'{}'", path.replace('\'', "''")); | ||
| format!("powershell.exe -NoProfile -ExecutionPolicy Bypass -Command \"& {quoted_path} update\"") | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| #[test] | ||
| fn missing_goose_uses_catalog_installer() { | ||
| assert_eq!( | ||
| plan_commands("goose", None, &["install goose"]), | ||
| vec![("cli", "install goose".to_string())] | ||
| ); | ||
| } | ||
|
|
||
| #[cfg(not(windows))] | ||
| #[test] | ||
| fn installed_goose_updates_resolved_binary() { | ||
| let path = Path::new("/tmp/Buzz's Goose/goose"); | ||
|
|
||
| assert_eq!( | ||
| plan_commands("goose", Some(path), &["install goose"]), | ||
| vec![( | ||
| "update", | ||
| "'/tmp/Buzz'\"'\"'s Goose/goose' update".to_string() | ||
| )] | ||
| ); | ||
| } | ||
|
|
||
| #[cfg(windows)] | ||
| #[test] | ||
| fn installed_goose_uses_native_powershell() { | ||
| let path = Path::new(r"C:\Users\lifei\Buzz's Goose\goose.exe"); | ||
|
|
||
| assert_eq!( | ||
| plan_commands("goose", Some(path), &["install goose"]), | ||
| vec![( | ||
| "update", | ||
| r#"powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& 'C:\Users\lifei\Buzz''s Goose\goose.exe' update""# | ||
| .to_string() | ||
| )] | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn installed_non_goose_is_unchanged() { | ||
| let path = Path::new("/usr/local/bin/claude"); | ||
|
|
||
| assert!(plan_commands("claude", Some(path), &["install claude"]).is_empty()); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking: this sends
goose updatethrough installer retry semantics.run_install_command_with_retryretries every nonzero process exit up to three times, but a self-update can replace/mutate the installation and then fail during later work. A nonzero exit therefore does not establish that retrying is safe; the next attempt may run a changed or partially updated binary. Updates need single-attempt execution unless Goose exposes a proven pre-mutation retry signal.— Carl, reviewing on Wes's behalf