Skip to content

Use the gh aw prefix in CLI errors and help - #78463

Merged
pelikhan merged 2 commits into
mainfrom
copilot/cli-consistency-fix-error-messages
Nov 17, 2026
Merged

pelikhan merged 2 commits into
mainfrom
copilot/cli-consistency-fix-error-messages

Conversation

@gh-aw-bot

@gh-aw-bot gh-aw-bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Some command errors showed Cobra’s shortened gh <command> path instead of gh aw <command>, and root help used tabs in its Common Tasks block.

  • Command paths: Normalize workflow-specification, unknown-subcommand, and legacy-command errors to use the canonical gh aw prefix, including generic Cobra errors.
  • Help alignment: Replace tabs with spaces in the root Common Tasks block.
✗ unknown command "foo" for "gh aw work-queue"

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@gh-aw-bot gh-aw-bot changed the title [WIP] Fix error messages to show 'gh aw' instead of 'gh' Use the gh aw prefix in CLI errors and help Nov 16, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 17, 2026 01:04
Copilot AI adaptive review requested due to automatic review settings November 17, 2026 01:04
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Ponytail Reviewer for #78463 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by PR Specification Reviewer for #78463 · copilot · gpt56 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-6ab21efc-0f56-428a-821c-3ad9e8b92fb1","parents":[],"payload":{"id":"ldg-16073448-2a50-4e9e-91fb-30cb181077d6","operation":"append","value":{"finding_count":0,"head_sha":"f4e40f70b277d238feb5c882d94a1bf8fe622aee","outcome":"aligned"}},"sha":"sha256:bb55247bbe06cb4c4d518a46a652dc773cc00ed1fc0ea38098e54fc8bbc26b5b","timestamp":"2026-11-17T01:12:00.529Z","type":"ledger_append","version":1}
History

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes address the reported CLI error-path and help-alignment inconsistencies with targeted updates and regression tests across the affected commands, with no active issues identified.

No open issues 🎉

What changed in this PR

This PR standardizes user-facing CLI errors on the canonical gh aw prefix and replaces tab-based alignment in the root help’s Common Tasks section.

Changes:

  • Added command-path normalization for workflow argument, unknown-subcommand, legacy-command, and generic Cobra errors.
  • Updated root help alignment to use spaces.
  • Added and updated regression tests for error paths and help formatting.
File Description
pkg/​cli/​trial_command.go Uses the canonical gh aw trial path in missing-argument errors.
pkg/​cli/​trial_command_test.go Verifies trial errors use the canonical command path.
pkg/​cli/​secrets_command.go Normalizes unknown-subcommand errors for secrets.
pkg/​cli/​secrets_command_test.go Updates expected secrets error paths.
pkg/​cli/​mcp.go Normalizes unknown-subcommand errors for mcp.
pkg/​cli/​mcp_command_test.go Updates expected MCP error paths.
pkg/​cli/​gh_guard_subcommand.go Adds shared command-path formatting and applies it to legacy-command errors.
pkg/​cli/​deploy_command.go Uses the canonical gh aw deploy path in validation errors.
pkg/​cli/​deploy_command_test.go Verifies deploy errors use the canonical command path.
pkg/​cli/​cli_consistency_help_test.go Tests normalized command paths and legacy-command errors.
pkg/​cli/​add_no_args_test.go Verifies add errors use the canonical command path.
pkg/​cli/​add_command.go Uses the canonical gh aw add path in missing-argument errors.
cmd/​gh-aw/​main.go Rewrites generic Cobra unknown-command errors and aligns root help text with spaces.
cmd/​gh-aw/​main_help_text_test.go Adds regression tests for help alignment and generic error-path normalization.

Review effort: Lite (adaptive)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one correctness issue in the path normalization: the prefix check is not token-boundary-aware, so command paths beginning with gh aw... can be mistaken for already-normalized paths. Please tighten the boundary check before merging. No tests were run per the static-review instructions.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again

Comment thread cmd/gh-aw/main.go
return message
}
const marker = ` for "`
start := strings.LastIndex(message, marker)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strings.HasPrefix(s, "gh aw") treats any path beginning with that byte sequence as already normalized. For example, an unknown command path of gh awesome remains gh awesome instead of becoming gh aw awesome, so the canonical prefix is still wrong for valid command names beginning with aw. Check the token boundary (e.g. s == "gh aw" or strings.HasPrefix(s, "gh aw ")) before skipping the rewrite.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-dcf2e33a-9daf-4293-8248-22451e850316","parents":[],"payload":{"id":"ldg-306ff5dc-498b-4def-9d7d-5b7cc6db58fd","operation":"append","value":{"finding_count":1,"head_sha":"f4e40f70b277d238feb5c882d94a1bf8fe622aee","outcome":"findings"}},"sha":"sha256:14853ae7ded375a41e00d2c67eac16ee665ea75ebbef43942f0ca7bbbb838b54","timestamp":"2026-11-17T01:13:50.483Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /tdd and /codebase-design. Requesting changes because the gh aw path rewrite misses Cobra's invalid argument errors, which the PR description says it covers.

📋 Key Themes & Highlights

Key Themes

  • Incomplete coverage: fixCommandPathInError only handles unknown command. Cobra's invalid argument error (from cobra.OnlyValidArgs) still shows gh completion. Verified on the built binary.
  • Duplicated path rule: cliCommandPath repeats the gh to gh aw normalization already in fixPathForCommand.

Positive Highlights

  • ✅ Root Common Tasks block now aligns; verified with --help.
  • ✅ Unknown-command errors for secrets and mcp now show gh aw; verified on the built binary.
  • ✅ Targeted tests pass in cmd/gh-aw and pkg/cli, and gofmt is clean.

Process Note

Triage was not run as a separate agent. I classified the change directly from the pre-fetched diff, which was small enough to read in full.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

Comment thread cmd/gh-aw/main.go
}

func fixCommandPathInError(message string) string {
if !strings.HasPrefix(message, "unknown command ") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/tdd] The rewrite only covers unknown command messages, but Cobra's invalid argument %q for %q (args.go:61, emitted by cobra.OnlyValidArgs) also embeds CommandPath(). Verified on the built binary: gh aw completion bogus still prints ✗ invalid argument "bogus" for "gh completion", so the PR's "including generic Cobra errors" goal is only partly met. Not a regression, but worth fixing here.

💡 Suggested change

Accept the invalid argument prefix too, and add a regression test next to TestUnknownCommandErrorUsesExtensionPath:

func fixCommandPathInError(message string) string {
	if !strings.HasPrefix(message, "unknown command ") && !strings.HasPrefix(message, "invalid argument ") {
		return message
	}
	// rest unchanged
assert.Equal(t, `invalid argument "bar" for "gh aw completion"`,
	fixCommandPathInError(`invalid argument "bar" for "gh completion"`))

The existing first-quote scan stops at the path's closing quote, so suggestion text appended by findSuggestions is preserved.

@copilot please address this.

"github.com/spf13/cobra"
)

func cliCommandPath(cmd *cobra.Command) string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] cliCommandPath duplicates the gh to gh aw normalization already done by fixPathForCommand in cmd/gh-aw/main.go. Two copies of the same rule can drift, so a future fix to one would silently miss the other.

💡 Suggested change

Move the string rule into one shared helper (for example in pkg/constants, next to CLIExtensionPrefix) and have both call sites use it. cliCommandPath would then only handle the root-name check and delegate the rewrite.

@copilot please address this.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator Author

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (cmd/gh-aw/main.go:650): address unresolved feedback - Review comment
  3. Review (cmd/gh-aw/main.go:646): address unresolved feedback - Review comment
  4. Review (pkg/cli/gh_guard_subcommand.go:11): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "f4e40f70b277d238feb5c882d94a1bf8fe622aee",
  "kind": "requested",
  "schema_version": "1",
  "state": "1c822742880b48e36b49ff7c78cafd1a8e6f9ddb1258393ba1f9ecf8c9969ecf",
  "work": [
    "0523a02227aba8f4eea998e32428a34a3bf2e6c96da8dfe5d8a98735b5a66fa3",
    "3088be964b47f52248c167c5cca093809d4c5af309ca3e714c5e97126acab07c",
    "9b4fcc6f75f4c68f753a32b05ce6d63bc7365eb9ec5268c68690ca9f077056d2"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

@pelikhan
pelikhan merged commit 69865cb into main Nov 17, 2026
148 of 149 checks passed
@pelikhan
pelikhan deleted the copilot/cli-consistency-fix-error-messages branch November 17, 2026 01:46
Copilot stopped work on behalf of gh-aw-bot due to an error November 17, 2026 01:46
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.1

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.

[cli-consistency] CLI Consistency Issues - 2026-11-16

4 participants