Skip to content

fix: Copilot CLI triage command rejected with 'Invalid command format' #147

Description

@don-petry

Parent issue

#145

Problem

When the session fell back to the Copilot engine for ContentTwin/pull/72, the triage step immediately failed:

error: Invalid command format.
Did you mean: copilot -i "suggest -p # Tier 1: Triage..."

The copilot CLI rejected the command that review-one-pr.sh issued during the triage tier. This indicates one or both of:

  • The CLI invocation syntax used by the script no longer matches the installed CLI version (flags / subcommand changed).
  • The prompt is being passed in a way the CLI rejects (e.g., positional arg vs --prompt flag, unescaped characters, length).

Because the CLI exited non-zero with this message, the rate-limit detector (see #147) classified it as a rate limit and aborted the entire session, skipping 18 PRs.

Acceptance criteria

  1. Root cause confirmed: identify the exact copilot CLI invocation in review-one-pr.sh (and any shared helper) that produces the format error, and document the correct invocation for the installed CLI version.
  2. Invocation fixed: the corrected command is applied and manually verified to succeed locally against a test prompt.
  3. Version pinned or detected: either pin the CLI version in the workflow's setup step, or add a version-check that emits a clear error when the installed CLI is below the minimum supported version.
  4. Smoke test step: add a lightweight copilot CLI smoke test (e.g., copilot --version and a one-liner prompt) as a pre-flight step so format errors surface as a clear setup failure rather than a mid-run rate-limit false-positive.
  5. The triage tier completes successfully against a real low-risk PR on the Copilot engine.

Expected tests

  • Unit (shellcheck / bats): the helper that builds the copilot CLI invocation string is tested with edge-case prompts (long prompt, prompts with quotes/newlines) to confirm no format errors.
  • Integration (dry-run): a dry-run workflow step runs the fixed Copilot triage command and asserts exit code 0.
  • Integration: a full end-to-end review of a known low-risk PR succeeds on the Copilot engine without format errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug reports

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions