Skip to content

Pass the launched agent's exit code through - #13

Merged
wilbeibi merged 1 commit into
mainfrom
agent-exit-code
Sep 4, 2026
Merged

Pass the launched agent's exit code through#13
wilbeibi merged 1 commit into
mainfrom
agent-exit-code

Conversation

@wilbeibi

@wilbeibi wilbeibi commented Sep 4, 2026

Copy link
Copy Markdown
Owner

catchup fork replaces this terminal's occupant with another agent, but that agent's exit status stopped at catchup. A shim exiting 3 produced:

catchup: exit status 3
$ echo $?
1

Two things were wrong with that. A script wrapping catchup fork could not tell an agent that failed from a catchup that did — every outcome was 1. And the catchup: prefix put the blame on catchup for a program it had merely started, which matters now that the skill asks agents to triage catchup failures and report the unexpected ones: exit status 3 names no recovery and matches none of the known-local categories, so it reads as a catchup bug.

A clean non-zero exit now travels out as cli.ExitError and main exits with that number and prints nothing — the agent owns the terminal and has already said whatever it meant to. Failing to launch at all is unchanged and still catchup's to report, because nothing ran to have a status:

catchup: exec: "claude": executable file not found in $PATH

Verified end to end on both paths with an agent that exits 3: native fork claude and fork claude --into codex each return 3 with no added line, and PATH=/nonexistent still returns 1 with the not-found message.

fork hands the terminal to another program, but its exit status stopped
at catchup: every failure was reported as `catchup: exit status 3` and
flattened to exit 1. A wrapper could not tell an agent that failed from
a catchup that did, and an agent reading the message had no way to know
the fault was not catchup's — the one failure shape catchup manufactures
for itself.

A clean non-zero exit now travels out as ExitError and main exits with
that number, unannounced: the agent owns the terminal and has already
said whatever it meant to. Failing to launch at all keeps its own
message, because nothing ran to have a status.

Claude-Session: https://claude.ai/code/session_01SSuFsifuVnFBU69q6ZzZyJ
@wilbeibi
wilbeibi merged commit 1a691d6 into main Sep 4, 2026
2 checks passed
@wilbeibi
wilbeibi deleted the agent-exit-code branch September 4, 2026 04:21
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