agents-cli icon indicating copy to clipboard operation
agents-cli copied to clipboard

`agents-cli create` precondition and generation failures can exit successfully or show tracebacks

Open benagentai93-dot opened this issue 3 months ago • 1 comments

Baseline

Reproduced from v1.3.1 at 5a306f8956cb1eeae69f9709de0e4d61b44e11e7.

Reproduction

Examples:

agents-cli create xxxxxxxxxxxxxxxxxxxxxxxxxxx --skip-welcome
agents-cli create existing --output-dir /tmp --skip-welcome
agents-cli create sample-agent --agent not-an-agent --skip-welcome

For the second command, pre-create /tmp/existing. Remote-template fetch, invalid agent-directory, or template generation exceptions expose the other paths.

Actual behavior

Several precondition failures print an error and return normally, producing exit code 0. Other validation/generation paths raise raw exceptions or Abort, leading to inconsistent output and possible tracebacks.

Expected behavior

Usage/precondition errors must exit non-zero as click.UsageError; fetch/generation failures must exit non-zero as concise click.ClickException errors. Interactive cancellation should retain Click's cancellation semantics. Normal CLI use should not show a traceback.

Minimal fix

Route create-time failures through one command-boundary handler: re-raise existing ClickException and Abort, translate validation ValueError to UsageError, and translate other generation/fetch exceptions to ClickException. Replace ordinary error returns with explicit Click errors.

Reference implementation: https://github.com/benagentai93-dot/agents-cli/commit/f1c212bb377975449dc8c6407788922d53e0e94d

Test evidence

Eight runnable regression cases cover overlong names, existing directories, invalid agent/base-template/agent-directory, generation/fetch failures, and interactive cancellation. They verify exit codes and absence of tracebacks.

Fork verification on Python 3.11/3.13:

  • focused Batch 1 suite: 17 passed
  • full root suite: 19 passed
  • lint, type check, build, and installed-wheel smoke: passed

benagentai93-dot avatar Aug 13 '26 09:08 benagentai93-dot

Thanks for reporting this issue. We will look into it and get back to you if we need any additional info

asrujana-44 avatar Aug 31 '26 18:08 asrujana-44