Skip to content

fix: propagate deploy failure exit codes#3597

Open
hikali123456789 wants to merge 2 commits into
orchestration-agent:mainfrom
hikali123456789:fix/cli-deploy-exit-codes
Open

fix: propagate deploy failure exit codes#3597
hikali123456789 wants to merge 2 commits into
orchestration-agent:mainfrom
hikali123456789:fix/cli-deploy-exit-codes

Conversation

@hikali123456789
Copy link
Copy Markdown

Summary

Refactors CLI command branches into handler functions that return explicit integer exit codes, enabling scripts to reliably detect failed deploys.

Changes

  1. Added exit code constants (src/cli/main.py)

    • EXIT_SUCCESS = 0 and EXIT_FAILURE = 1
  2. Extracted command handlers (src/cli/main.py)

    • handle_init(), handle_deploy(), handle_status(), handle_logs()
    • Each returns an explicit exit code (int)
    • COMMAND_HANDLERS dict maps command names to handlers
  3. Refactored cli() function (src/cli/main.py)

    • Now returns int exit code instead of calling sys.exit() directly
    • __main__ block uses sys.exit(cli()) to propagate the code
  4. Added regression tests (tests/test_cli_deploy.py)

    • Tests for exit code constants
    • Tests for each handler returning proper codes
    • Tests for cli() return values

Before

if args.command == "deploy":
    print(f"Deploying agent from manifest: {args.manifest}")
# No exit code returned - scripts cannot detect failure

After

def handle_deploy(args) -> int:
    print(f"Deploying agent from manifest: {args.manifest}")
    return EXIT_SUCCESS  # or EXIT_FAILURE on error

Acceptance Criteria

  • A regression test covers this CLI case
  • The changed behavior is documented or asserted by the relevant test

Fixes #3584

- Refactor CLI branches into handler functions that return int exit codes
- Add EXIT_SUCCESS/EXIT_FAILURE constants
- cli() now returns exit code instead of calling sys.exit directly
- Each command handler (init, deploy, status, logs) returns explicit exit code
- Enables scripts to reliably detect failed deploys

Fixes orchestration-agent#3584
- Test EXIT_SUCCESS/EXIT_FAILURE constants
- Test each handler returns explicit exit code
- Test cli() returns proper codes for all commands
- Test no-command case returns EXIT_FAILURE
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.

[ Bounty $3k ] [ CLI ] Propagate deploy failure exit codes — exit status

1 participant