Let the exit-code taxonomy reach the two consumers that read it #342
No reviewers
Labels
No labels
burndown-2026-06
burndown-2026-08
sunday-sprint
autonomy
async-consult
autonomy
epic
autonomy
headless
autonomy
live-collab
coherence-core
priority
P0
priority
P1
priority
P2
priority
P3
priority
P4
qa-fixture
role/advocate
role/director
role/exec
role/frontend
role/gamedev
role/human
role/platform
role/qa
role/science
role/sysadmin
state
ambient
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
coilyco-flight-deck/umbra!342
Loading…
Reference in a new issue
No description provided.
Delete branch "exit-codes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #341.
pkg/exitcodehas carriedCoded,From, and a doc comment saying "main.go checks this via errors.As" since it was written. Nothing in the repo ever called it -grep -rn "exitcode.Coded"returns no non-test hit. Every coded error the engines carefully build was constructed and then thrown away.Three changes, one per consumer.
exitcode.OfResolves an error to its declared code,
Genericwhen it declares none,Successfor nil. The resolver both call sites wanted and neither had.The generated binary
Exits with that code instead of a flat 1. It also sets
CommandNotFound, because urfave exits 3 on an unknown subcommand and 3 isUpstreamFailed- a typo was being reported to an orchestrator as an upstream fault. A denied verb and a misspelt one both land there, and the message deliberately does not say which, since deny is absence.The audit row
Records the same code, and says
rejectinstead ofacceptwhen policy refused. Every failing row used to readaccept/exit_code: 1, so the durable log could not separate a guard refusal from a bad flag either. That is the half that matters months later, when the terminal is long gone.Measured, on a generated binary over a real MCP upstream
Audit row for the refusal now reads
decision=reject exit_code=2, againstexit_code=5for the bad flag beside it.Scope
This is why my claim in #336 and #337 that "the exit-code taxonomy binds unchanged" was wrong, and wrong for every dialect rather than only mcp. Corrected on #336.
Verified with
go build,go vet,go test ./...,golangci-lint run ./..., andpre-commit run --all-files, plus the before/after measurement above against the node-stats MCP server on kai-server.