Skip to content

automation subcommand --help can execute mutations #2323

Closed

Description

@Danielalnajjar

Attempted workflow

Inspect command-specific help for an existing automation update before changing its configuration.

Actual result

--help is recognized only when it occupies the command token itself. When supplied after the update subcommand, it is parsed as an ordinary flag and the update executes. During a read-only review this replaced an automation prompt before the captured prior value was immediately restored.

Source evidence:

  • plugins/automations/src/cli.ts returns help only when parsed.command is help, --help, or -h.
  • The update branch then calls service.update(...) without rejecting or honoring a trailing help flag.

Expected result

bb automation <subcommand> --help and -h print that subcommand's usage and perform no read or write side effect. Unknown flags should fail rather than being silently ignored.

Acceptance criteria

  • Every automation subcommand treats --help and -h as side-effect-free help regardless of flag position.
  • Mutating subcommands never call their service method on a help request.
  • Unknown flags return a non-zero usage error.
  • Tests cover create, update, pause, resume, run, and delete with trailing help flags and assert zero mutations/runs.

AGENT GENERATED: by GPT-5.6 Sol

Activity

  1. added theissue type on Aug 24, 2026
  2. added
    cli
    automations
    on Aug 24, 2026
  3. SawyerHood commented on Aug 24, 2026

    @SawyerHood
    Collaborator

    ---Auto-Generated---

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/2323.html

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): plugins/automations/src/cli.ts parseArgs only treats --help/-h as help when it is argv[0]; elsewhere --help becomes an unread boolean flag and -h a positional, and the core bb CLI forwards plugin argv raw to the server so commander's help/unknown-option handling never runs, so update/pause/resume/run/delete/create execute their service call.
    • Proposed fix: In plugins/automations/src/cli.ts: (1) make parseArgs recognise --help/-h at any position (including the command token) as a help: boolean on ParsedArgs instead of a flag/positional; (2) in run(), return per-subcommand usage (exit 0) when parsed.help is set, before requireFlag/buildUpdateRequest/any service.* call; hoist the registered commands list to a constant so helpText() and a new commandHelpText(name) share one source; (3) add a per-subcommand flag allowlist (COMMAND_FLAGS) plus assertKnownFlags() that exits 1 with usage on unknown options (also resolves Builtin memory/automations/custom-instructions CLIs silently ignore unknown flags (core bb and tasks reject them) #2299 for this plugin); (4) ke…
    • Caveats: No linked PR to review. The reporter's specific incident (a prompt overwritten during a review) could not be observed directly, but the exact command shape reproduces the overwrite on the base commit. origin/main equals the base commit, so nothing later fixes it. The worktree retains the prototype fix and the repro test (uncommitted) for review. No screenshots: CLI/data bug, evidence is verbatim t…

    The report is self-contained: copy-paste repro steps with the test or script inline, expected vs actual output, screenshots where the bug is visual, and code permalinks at the base commit. It was independently re-executed by a second agent (see its Verification section).

    AGENT GENERATED: by Claude Code

  4. added
    confirmed-repro
    on Aug 24, 2026
  5. added
    plugins
    on Sep 30, 2026
  6. ymichael commented on Oct 8, 2026

    @ymichael
    Collaborator

    Fixed by #3913: --help/-h anywhere in a plugin command now prints help and exits 0 without running the command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    automationscliconfirmed-reproplugins

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions