-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix #4612: Return non-zero exit code when CLI session ends with error #4621
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
Merged
Conversation
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
When a session fails due to an error (e.g., invalid temperature parameter), the CLI now exits with code 1 instead of 0. This allows scripts and automation tools to properly detect when goose encounters an error. Previously, the error was only printed to stderr but the process would exit successfully with code 0, making it impossible to detect failures in automated environments. Fixes block#4612 Signed-off-by: jalateras <[email protected]>
2eb04a2 to
c4c4dfa
Compare
DOsinga
approved these changes
Sep 12, 2025
zanesq
added a commit
that referenced
this pull request
Sep 30, 2025
…-unification * 'main' of github.com:block/goose: (24 commits) feat(cli): add `path` & `limit` to `session list` command (#4878) Allow better concurrent access (#4896) fix: Windows prompt cursor positioning issue with ANSI escape sequences (#4464) Fix: LiteLLM API key field not showing in UI configuration (#4105) fix: path is duplicated on tool calls causing them to fail (#4658) (#4859) add new prompt to get all available tutorials (#4802) Add filtering for agentVisible: false messages on streaming providers (#4847) alexhancock/mcp-crate-cleanup (#4885) docs: rename sub-recipe to subrecipe (#4886) docs: new multi-model section with autopilot topic (#4864) make agent manager singleton (#4880) Cli web auth token (#4456) fix(token_counter): fix panic with GitHub Copilot (#4632) Revert "Internal MCP Crate Cleanup (#4800)" (#4883) remove 2 redundant comments and one that lies (#4866) Internal MCP Crate Cleanup (#4800) Fix #4612: Return non-zero exit code when CLI session ends with error (#4621) Dead code cleanup (#4873) fix: restoring test data and correcting name (#4875) Add .goosehints file to enforce lowercase branding in documentation (#4870) ...
matt-wirth
added a commit
to LiquidMetal-AI/goose
that referenced
this pull request
Sep 30, 2025
* remove only-pr-labels (block#4842) Signed-off-by: Angela Ning <[email protected]> * Docs: Add link to Plug & Play video for Reddit MCP (block#4852) * Fix: Token count UI doesn't re-render if it's open. (block#4822) * Update databricks flash model (block#4836) * Session manager (block#4648) Co-authored-by: Douwe Osinga <[email protected]> * Add Hacktoberfest Guides (block#4830) Co-authored-by: taniashiba <[email protected]> * docs: goose x Hacktoberfest 2025 Blog (block#4855) Co-authored-by: Tania Chakraborty <[email protected]> Co-authored-by: Angie Jones <[email protected]> * fix: delete some flaky and not-useful tests (block#4861) * can tell the system what shell it is using (block#4807) * new subrecipe blog post banner (block#4862) * docs: remove recipe generator link from next to extension search (block#4858) * lowercase g in goose (block#4832) * doc: file parameter recipe update (block#4594) * Fiie input recipe ref doc (block#4869) * Add .goosehints file to enforce lowercase branding in documentation (block#4870) Co-authored-by: Angie Jones <[email protected]> * fix: restoring test data and correcting name (block#4875) * Dead code cleanup (block#4873) Co-authored-by: Douwe Osinga <[email protected]> Co-authored-by: Michael Neale <[email protected]> * Fix block#4612: Return non-zero exit code when CLI session ends with error (block#4621) Signed-off-by: jalateras <[email protected]> * Internal MCP Crate Cleanup (block#4800) * remove 2 redundant comments and one that lies (block#4866) Co-authored-by: Douwe Osinga <[email protected]> * Revert "Internal MCP Crate Cleanup (block#4800)" (block#4883) * fix(token_counter): fix panic with GitHub Copilot (block#4632) Signed-off-by: sings-to-bees-on-wednesdays <[email protected]> main was broken. this seems important * Cli web auth token (block#4456) Signed-off-by: Evanfeenstra <[email protected]> * make agent manager singleton (block#4880) * docs: new multi-model section with autopilot topic (block#4864) * docs: rename sub-recipe to subrecipe (block#4886) * alexhancock/mcp-crate-cleanup (block#4885) * Temporary workaround for mcp server * Add filtering for agentVisible: false messages on streaming providers (block#4847) * add new prompt to get all available tutorials (block#4802) Signed-off-by: AdemolaAri <[email protected]> * Fix for auth in extension, fix for stale keychain * fix: path is duplicated on tool calls causing them to fail (block#4658) (block#4859) Signed-off-by: demetrio108 <[email protected]> * Fix: LiteLLM API key field not showing in UI configuration (block#4105) Signed-off-by: jalateras <[email protected]> Co-authored-by: Ebony Louis <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Jack Amadeo <[email protected]> * fix: Windows prompt cursor positioning issue with ANSI escape sequences (block#4464) Signed-off-by: Matt Donovan <[email protected]> Co-authored-by: Matt Donovan <[email protected]> * Allow better concurrent access (block#4896) Co-authored-by: Douwe Osinga <[email protected]> * feat(cli): add `path` & `limit` to `session list` command (block#4878) * Added CMD+T keyboard shortcut that takes you to the Home tab (block#4541) Signed-off-by: Guillaume Simard <[email protected]> --------- Signed-off-by: Angela Ning <[email protected]> Signed-off-by: jalateras <[email protected]> Signed-off-by: Evanfeenstra <[email protected]> Signed-off-by: AdemolaAri <[email protected]> Signed-off-by: demetrio108 <[email protected]> Signed-off-by: Matt Donovan <[email protected]> Signed-off-by: Guillaume Simard <[email protected]> Co-authored-by: Angela Ning <[email protected]> Co-authored-by: Emma Youndtsmith <[email protected]> Co-authored-by: David Katz <[email protected]> Co-authored-by: Douwe Osinga <[email protected]> Co-authored-by: Douwe Osinga <[email protected]> Co-authored-by: Ebony Louis <[email protected]> Co-authored-by: taniashiba <[email protected]> Co-authored-by: taniandjerry <[email protected]> Co-authored-by: Tania Chakraborty <[email protected]> Co-authored-by: Angie Jones <[email protected]> Co-authored-by: Jack Amadeo <[email protected]> Co-authored-by: Michael Neale <[email protected]> Co-authored-by: w. ian douglas <[email protected]> Co-authored-by: Alex Hancock <[email protected]> Co-authored-by: Jarrod Sibbison <[email protected]> Co-authored-by: Rizel Scarlett <[email protected]> Co-authored-by: Jim Alateras <[email protected]> Co-authored-by: sings-to-bees-on-wednesdays <[email protected]> Co-authored-by: Evan Feenstra <[email protected]> Co-authored-by: Yingjie He <[email protected]> Co-authored-by: dianed-square <[email protected]> Co-authored-by: Ademola Arigbabuwo <[email protected]> Co-authored-by: Demetrio ⚡️ <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Jack Amadeo <[email protected]> Co-authored-by: Matt Donovan <[email protected]> Co-authored-by: Matt Donovan <[email protected]> Co-authored-by: Robert Mcgregor <[email protected]> Co-authored-by: Guillaume Simard <[email protected]>
HikaruEgashira
pushed a commit
to HikaruEgashira/goose
that referenced
this pull request
Oct 3, 2025
…error (block#4621) Signed-off-by: jalateras <[email protected]> Signed-off-by: HikaruEgashira <[email protected]>
This was referenced Oct 8, 2025
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR fixes the CLI to properly return a non-zero exit code (1) when a session ends with an error, allowing scripts and CI/CD pipelines to detect failures.
Problem
When the goose CLI encounters an error during a session (such as an invalid temperature parameter), it prints the error message to stderr but still exits with code 0. This makes it impossible for automated scripts to detect when goose has failed.
Solution
Added
std::process::exit(1)after printing the error message when a session fails. This ensures the process exits with a non-zero status code that scripts can detect.Changes
crates/goose-cli/src/cli.rsto callstd::process::exit(1)whensession.interactive()returns an errorTesting
cargo build --package goose-clicargo test --package goose-cliExample
Before this fix:
After this fix:
Fixes #4612