Skip to content

fix(agent): exit non-zero on failure and allow local profiles without an API key - #59

Merged
radim10 merged 4 commits into
masterfrom
fix/agent-exit-codes-and-local-profiles
Oct 7, 2026
Merged

radim10 merged 4 commits into
masterfrom
fix/agent-exit-codes-and-local-profiles

Conversation

@radim10

@radim10 radim10 commented Oct 7, 2026

Copy link
Copy Markdown
Member

Summary

  • agent commands now exit 1 when they fail. Before, agent run, validate, explain and policy test printed 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.
  • The bare stashbase agent hooks invocation 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 list and agent profiles show no 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 plus exit_status_cli and the other integration tests pass
  • Updated the 4 characterization tests in tests/exit_status_cli.rs that pinned exit 0 for agent commands
  • Manually: a broken profile exits 1 for agent validate, run, explain and policy test
  • Manually: bare agent hooks with invalid stdin still exits 0
  • Manually: agent profiles list and show work without an API key

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.
@radim10 radim10 self-assigned this Oct 7, 2026
@radim10
radim10 merged commit 32ba66c into master Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant