Skip to content

Fix CLI consistency checker pre-agent help bootstrap to fail fast on empty datasets - #49414

Merged
pelikhan merged 2 commits into
mainfrom
copilot/agentic-token-optimizerfix-pre-agent-help-collecti
Aug 1, 2026
Merged

Fix CLI consistency checker pre-agent help bootstrap to fail fast on empty datasets#49414
pelikhan merged 2 commits into
mainfrom
copilot/agentic-token-optimizerfix-pre-agent-help-collecti

Conversation

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

The CLI Consistency Checker’s pre-agent bootstrap was repeatedly producing Pre-collected help lines: 0, forcing the agent to rebuild and re-collect help during execution and burning significant AIC/time before analysis. This change makes help collection deterministic and surfaces bootstrap failures directly in CI.

  • Pre-agent help capture reliability

    • Capture gh-aw --help output with 2>&1 so command metadata is consistently written to main.txt for parsing.
  • Fail-fast guard: command extraction

    • Add an explicit hard-fail when zero top-level commands are parsed from main.txt, instead of continuing into a silent empty-state path.
  • Fail-fast guard: aggregate dataset integrity

    • After concatenating help files into /tmp/gh-aw/agent/all-help.txt, fail if the file exists but is empty.
  • Compiled workflow sync

    • Recompiled cli-consistency-checker.lock.yml to reflect the updated pre-agent shell block.
./gh-aw --help > "${output_dir}/main.txt" 2>&1
mapfile -t top_commands < <(awk "${extract_commands}" "${output_dir}/main.txt" | sort -u)
if [ ${#top_commands[@]} -eq 0 ]; then
  echo "No top-level commands were parsed from ./gh-aw --help output" >&2
  exit 1
fi

cat "${help_files[@]}" > /tmp/gh-aw/agent/all-help.txt
if [ ! -s /tmp/gh-aw/agent/all-help.txt ]; then
  echo "Combined help output is empty" >&2
  exit 1
fi

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix broken pre-agent help-collection step for CLI Consistency Checker Fix CLI consistency checker pre-agent help bootstrap to fail fast on empty datasets Jul 31, 2026
Copilot AI requested a review from pelikhan July 31, 2026 22:00
@pelikhan
pelikhan marked this pull request as ready for review August 1, 2026 00:46
Copilot AI review requested due to automatic review settings August 1, 2026 00:46
@pelikhan
pelikhan merged commit 2831507 into main Aug 1, 2026
@pelikhan
pelikhan deleted the copilot/agentic-token-optimizerfix-pre-agent-help-collecti branch August 1, 2026 00:46

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.

Pull request overview

Fixes CLI help pre-collection so bootstrap failures surface before agent execution.

Changes:

  • Captures root help from stderr.
  • Adds extraction and aggregate-data guards.
  • Regenerates the compiled workflow.
Show a summary per file
File Description
.github/workflows/cli-consistency-checker.md Updates help collection and validation.
.github/workflows/cli-consistency-checker.lock.yml Synchronizes compiled workflow output.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines 48 to +49
mapfile -t top_commands < <(awk "${extract_commands}" "${output_dir}/main.txt" | sort -u)
if [ ${#top_commands[@]} -eq 0 ]; then
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.2

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.

[agentic-token-optimizer] CLI Consistency Checker: fix broken pre-agent help-collection step wasting ~110 AIC/run

3 participants