Skip to content

fail-safe CLI exit codes: unknown verb → 1, logical failure → 10, paused → 3 - #23

Merged
kanfil merged 2 commits into
mainfrom
fix/issue-22-cli-fail-safe
Sep 30, 2026
Merged

kanfil merged 2 commits into
mainfrom
fix/issue-22-cli-fail-safe

Conversation

@kanfil

@kanfil kanfil commented Sep 30, 2026

Copy link
Copy Markdown
Member

Closes #22. Agent-authored (factory-mission run mission-adlc-cli-22-20260930); human merge only — do not auto-merge.

What

  • src/exit-codes.mjs (new, pure): classifyAgentExit (signal→130, 0→0, else→10), classifyWorkflowStatus (COMPLETED→0, PAUSED→3, FAILED→10, ABORTED→1, unknown→1).
  • src/dispatch.mjs: unknown top-level verb → stderr + usage + exit 1 in both trees; bare/help stay 0.
  • src/commands/agent.mjs: post-spawn return classified (pre-spawn validation still 1; run alias inherits).
  • src/commands/workflow.mjs: run + resume terminal mapping classified, with lane-contract comment (asInt(lastRetry.exitCode) != 10 && asInt(lastRetry.exitCode) != 3).
  • tests/cli-failsafe.test.mjs (new, 12 tests): RED observed pre-fix (9 fail), GREEN post-fix.

Verification

  • New suite 12/12; full npm test 318/318, 34 suites, 0 regressions.
  • Spot: bogus→1, bare→0, run-without-prompt→1.

Out of scope (tracked elsewhere)

  • Container propagation → tikalk/engineering/agentic-container#1. Lane expression application → adlc-argo-wf values MR. Paused=3 is the documented contract this PR establishes.

…paused)

Unknown top-level verb exits 1 with a usage hint (was: help + 0,
silent false success). Agent child failure maps to 10, signal to 130.
Workflow terminal status maps to COMPLETED=0, PAUSED=3, FAILED=10,
ABORTED/hard-errors=1. Pure classifiers in src/exit-codes.mjs;
12-test contract in tests/cli-failsafe.test.mjs (RED pre-fix).

Lane contract: paused exits 3 so the Argo retry expression
'asInt(lastRetry.exitCode) != 10 && asInt(lastRetry.exitCode) != 3'
excludes it. Closes #22.
@kanfil
kanfil merged commit 8048be2 into main Sep 30, 2026
9 checks passed
@kanfil
kanfil deleted the fix/issue-22-cli-fail-safe branch September 30, 2026 21:33
@kanfil kanfil mentioned this pull request Sep 30, 2026
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.

fail-safe CLI: unknown verb exits 0; no exit-10 for agent logical failure

1 participant