Repository navigation
fix(agent): exit non-zero on failure and allow local profiles without an API key - #59
Merged
Merged
Conversation
agent run, validate, explain and policy test printed their error and exited 0, so a profile that failed closed looked like a success to scripts and CI. Every agent command failure now exits 1; a child's own exit code is still passed through.
Both only read local profile files and the local config.
Claude Code, Codex and Cursor run `stashbase agent hooks` before tool calls and read its exit code, so it is left out of the exit-1 rule for agent commands.
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
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
agentcommands now exit 1 when they fail. Before,agent run,validate,explainandpolicy testprinted the error and exited 0, so a profile that failed closed looked like a success to scripts and CI. An agent that actually runs still passes its own exit code through.stashbase agent hooksinvocation is left out of that rule. Claude Code, Codex and Cursor run it before tool calls and read its exit code, so its codes don't change.agent profiles listandagent profiles showno longer require an API key. Both only read local profile files and the local config.The rest of the CLI still exits 0 on errors. That will be handled in a follow-up PR, and both should ship in the same release.
Test plan
cargo test: unit tests plusexit_status_cliand the other integration tests passtests/exit_status_cli.rsthat pinned exit 0 for agent commandsagent validate,run,explainandpolicy testagent hookswith invalid stdin still exits 0agent profiles listandshowwork without an API key