Skip to content

Add least-privilege failure reporting and systematic scenario matrix to Windows CLI integration - #67410

Merged
pelikhan merged 3 commits into
mainfrom
pelikhan-issue-66822-assess-windows-failure-reporting-677adb
Oct 10, 2026
Merged

pelikhan merged 3 commits into
mainfrom
pelikhan-issue-66822-assess-windows-failure-reporting-677adb

Conversation

@pelikhan

@pelikhan pelikhan commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #66822.

Problem

The conclusion job in .github/workflows/windows-cli-integration.yml had only contents: read and, on failure, wrote a step summary and exit 1 — no issue was created. This was a deliberate regression: PR #65929 removed a working gh issue create step to avoid granting issues: write. Five duplicate issues (#66016, #66441, #66780, #67109, #67341) re-requested this and a systematic scenario matrix; the hand-picked 20-entry matrix combined env-shape variants almost exclusively with pwsh-default/workspace-first, leaving cmd and most path styles untested against environment variation.

Changes

  • conclusion job: adds issues: write, scoped to this job only (build/integration remain contents: read). A new "Create or update failure issue" step, gated on failure, searches for an existing open tracking issue by title and comments on it instead of creating a new one each day (dedupe per [windows-integration] Add failure issue creation to Windows CLI integration workflow #66441), else creates one with the failed job names and run URL.
  • Scenario matrix: $scenarioMatrix is now generated from declared $shells × $launchModes × $envShapes × $pathStyles arrays instead of hand-picked literals. Every shell is exercised both directly and via PATH resolution; every env-shape is exercised across every path-style via a fixed representative shell/launch, so growth is additive (32 scenarios) rather than a full 240+ cross product that would risk the job timeout.
  • Per-scenario failures are now wrapped with the scenario name for faster triage.

Review feedback addressed

  • PATH-resolution mismatch (copilot-pull-request-reviewer): dimension pair 2 originally paired every path style, including "default", with launch="path". Since the "default" style leaves PATH untouched, where gh-aw could never resolve the workspace-copied binary for those scenarios on a clean runner — they would fail before the CLI was even invoked. Fixed: path="default" now pairs with launch="direct" (PATH rearrangement has no effect on a direct invocation anyway), and the duplicate-skip condition was updated to exclude both combinations dimension pair 1 already covers for the representative shell. Net scenario count is now 32 (was 33).
  • Heredoc "syntax bug" claims (github-actions[bot], 2 threads): investigated and determined to be false positives. The claimed reproduction extracted the step's raw, file-indented text without accounting for YAML block-literal (run: |) indentation stripping, which removes the common leading indentation from every line of the block uniformly — including the heredoc terminator. Confirmed via two independent YAML parsers (Ruby Psych, Python PyYAML) that the actual parsed value has EOF at column 0, and via real Ubuntu 22.04/bash 5.1.16 execution (matching ubuntu-latest, exact GH Actions shell invocation) that the true executed script is syntactically valid and runs end-to-end correctly, including the dedupe create/comment paths. No code change was needed for this part.

Validation

Static checks:

  • ruby -ryaml / direct actionlint on the file: no issues.
  • bash -n + shellcheck on the extracted "Create or update failure issue" bash step: clean.
  • make agent-report-progress (build + impacted Go tests + schema freshness): passed.

Deep validation, using a local Docker/colima mcr.microsoft.com/powershell:latest (amd64, emulated) container and real Ubuntu 22.04 bash — not brace-counting or static guessing:

  • Actual PowerShell AST parse of the full "Windows CLI scenario matrix" script body ([System.Management.Automation.Language.Parser]::ParseFile): 0 syntax errors (1654 tokens after the PATH-mismatch fix).
  • Actual execution of the isolated scenario-generation block (dimension arrays + both nested-loop blocks, extracted verbatim) with deterministic assertions:
    • Scenario count: 32 (matches (shells×launchModes) + (envShapes×pathStyles) − 2).
    • All 32 scenario names are unique.
    • Full coverage confirmed: all 10 (shell, launch) pairs and all 22 non-skipped (env, path) pairs appear at least once.
    • New explicit regression assertion: no scenario with launch="path" has path="default" (the bug class the reviewer flagged).
    • This matrix generation previously also had a since-fixed overlap bug: an earlier revision's skip condition only excluded env=default,path=default, missing that env=default,path=workspace-first was already produced by dimension pair 1 — that overlap is now also correctly excluded.
  • Mocked dedupe logic for the "Create or update failure issue" step: extracted the YAML-parsed (not raw-indented) bash body verbatim and ran it against a stub gh binary in real bash 5.1 covering 5 scenarios — no existing issue (→ creates), existing issue found (→ comments), gh issue list failing (→ aborts via set -euo pipefail, no silent fallback to create), gh issue comment failing (→ aborts), gh issue create failing (→ aborts). All 5 behaved as expected; the step correctly fails loudly rather than silently succeeding on any gh error.

Explicitly NOT verified (cannot be, without triggering Actions):

  • Real windows-latest runner execution/timing of the 32-scenario matrix (wall-clock budget was reasoned about, not measured).
  • Live GitHub Issues search semantics for gh issue list --search "in:title \"...\"" reliably matching the exact dedupe title against real API behavior.
  • End-to-end issue creation/comment against a real repository and token.

Recommend observing the next scheduled run (06:00 UTC) or a maintainer-triggered workflow_dispatch for final confirmation of runtime and the dedupe path; no workflow trigger was requested or performed by this session.

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com

pelikhan and others added 2 commits October 10, 2026 04:43
…to Windows CLI integration

- conclusion job now creates (or comments on an existing open) tracking
  issue naming failed jobs and linking the run when build/integration
  fails, scoped to issues:write on this job only.
- scenarioMatrix is generated from declared shell/launch-mode/env-shape/
  path-style dimension arrays instead of a hand-picked list, with bounded
  growth (dimension-pair coverage) to avoid blowing the job timeout.
- per-scenario failures are now tagged with the scenario name for faster
  triage.

Fixes #66822

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Deterministic execution of the scenario-generation logic (via PowerShell
AST parser + actual loop execution in a container, not just brace
counting) caught a genuine duplicate: dimension pair 1 already produces
$representativeShell/path/default/workspace-first (its "path" launch
mode always resolves to the workspace-first PATH style), but dimension
pair 2's skip condition only excluded env=default+path=default, not
env=default+path=workspace-first. Fixed the skip condition so the 33
generated scenarios are now verified unique, with full shell x launch
and env x path coverage confirmed by execution.

Fixes #66822

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 10, 2026 12:35
Copilot AI balanced review requested due to automatic review settings October 10, 2026 12:35
@github-actions

github-actions Bot commented Oct 10, 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

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. Test Quality Sentinel skipped.

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #67410

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR review automation could not emit write-intents from this sandbox because safeoutputs review commands returned a permission-denied approval gate with no responder.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

No ADR enforcement needed: PR #67410 has no 'implementation' label and 0 new lines in business logic directories (1 file changed, threshold 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

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.

🟡 Changes recommended

Default-PATH scenarios use PATH launch without placing the binary on PATH, causing clean-runner failures.

1 open finding
What changed in this PR

Adds systematic Windows CLI scenario coverage and least-privilege failure issue reporting.

Changes:

  • Generates an additive shell/environment/PATH scenario matrix.
  • Adds scenario-specific failure diagnostics.
  • Creates or updates a failure-tracking issue.
File Description
.github/​workflows/​windows-cli-integration.yml Expands integration coverage and adds failure reporting.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/windows-cli-integration.yml
@github-actions github-actions Bot mentioned this pull request Oct 10, 2026

@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 /diagnosing-bugs — requesting changes: the new failure-reporting step has a shell syntax bug that will make it fail every time it's actually needed.

📋 Key Themes & Highlights

Key Themes

  • Blocking bug: the Create or update failure issue step's heredoc (BODY=$(cat <<EOF ... EOF)) uses an indented EOF terminator, which bash does not recognize as a valid closing delimiter unless <<-EOF with tab indentation is used. Verified with bash -n and shellcheck against the extracted step: both report a fatal parse error (SC1073/SC1039/SC1072). Since this step only runs if: steps.evaluate.outputs.failed == 'true', the bug is silent until the first real failure — exactly the scenario this PR exists to make work.
  • The PR description states bash -n + shellcheck were run on "the extracted ... bash step: clean" — that claim doesn't match what's committed, so the extracted snippet used for validation likely differed from the final indentation.

Positive Highlights

  • ✅ Scoping issues: write to only the conclusion job (not build/integration) is the right least-privilege shape for this permission.
  • ✅ The scenario-matrix generation refactor (hand-picked list → declared dimension arrays) is a solid /codebase-design improvement — it make the coverage rationale explicit via dimension pairing instead of an opaque literal list, and the PR already caught/fixed a real duplicate-scenario bug (dimension pair 2 overlap) during their own validation, which I independently re-derived (33/33 unique names) against the committed dimension arrays.
  • ✅ Wrapping the per-scenario body in try/catch with the scenario name re-thrown gives much better triage signal than the prior bare error.
  • ✅ Dedup-by-search-and-comment on the existing open issue (vs. creating a new one per failure) addresses the exact issue (#66441) that was duplicated five times.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 61.7 AIC · ⌖ 13.6 AIC · ⊞ 10.1K
Comment /matt to run again

Comment thread .github/workflows/windows-cli-integration.yml

@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.

Applied Impeccable harden (missing error/edge-state verification) since this PR explicitly adds failure-path reporting; found one blocking issue via reproduction, no other blocking findings in the scenario-matrix refactor (PowerShell generation logic matches the PR's stated/validated behavior).

Blocking: The BODY=$(cat <<EOF ... EOF\n) heredoc in the new "Create or update failure issue" step has its closing EOF indented (matching the surrounding YAML block), which bash does not accept as a terminator without <<-. I reproduced this by extracting the exact step body and running it with bash: it fails with a syntax error (unexpected EOF while looking for matching ')'), so the entire dedupe/create logic — the core feature of this PR — never executes on a real failure.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 61.1 AIC · ⌖ 13.4 AIC · ⊞ 8.2K

Comment thread .github/workflows/windows-cli-integration.yml
copilot-pull-request-reviewer flagged that dimension pair 2's
generated scenarios paired every path style (including "default")
with launch="path". For path="default" the PATH-rearrangement
switch is a no-op, leaving PATH unmodified, so the workspace copy of
gh-aw.exe is never resolvable via `where gh-aw` on a clean runner --
those scenarios would fail before invoking the CLI at all.

Fix: path="default" now pairs with launch="direct" (consistent with
dimension pair 1's own default/default scenario, since PATH
rearrangement has no effect on a direct invocation anyway); every
other path style still pairs with launch="path". Updated the
duplicate-skip condition accordingly (now skips both combinations
dimension pair 1 already covers for the representative shell),
yielding 32 unique scenarios (down from 33, since one more overlap is
now correctly excluded).

Verified via actual PowerShell execution in a container (not just
static review): scenario count, name uniqueness, full shell x launch
and env x path coverage, and a new explicit regression check that no
launch="path" scenario has path="default".

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

[AW Top 10] 06 Add failure reporting to Windows CLI integration workflow

2 participants