Skip to content

fix(powershell): retry every RULE_ERROR, not just NullRef/InvalidOp - #41

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/pssa-rule-error-retry
Jun 26, 2026
Merged

fix(powershell): retry every RULE_ERROR, not just NullRef/InvalidOp#41
kyle-sexton merged 1 commit into
mainfrom
fix/pssa-rule-error-retry

Conversation

@kyle-sexton

Copy link
Copy Markdown
Contributor

The per-file PSScriptAnalyzer child (Invoke-Pssa.ps1) retries the known #1708 CommandInfoCache runspace-affinity race, but only when it surfaces as NullReferenceException/InvalidOperationException. The same race also throws CommandNotFoundException"The term 'Get-Command' is not recognized" — when the crashed helper runspace comes up without its core cmdlets. That variant was classified as a real failure (no retry), so the powershell lane failed outright and only cleared on a manual re-run.

A rule throwing a RULE_ERROR is always a tooling crash, never a real finding (findings travel on the success stream). So this keys the transient classification on FullyQualifiedErrorId -like 'RULE_ERROR*' regardless of exception type, covering every manifestation of the race. Non-rule errors (parse errors, bad settings) carry a different id and still fail fast; a genuinely deterministic rule crash still hard-fails after the retry budget. .NOTES updated to match.

Observed in kyle-sexton/provisioning CI: the powershell lane failed twice with "Get-Command is not recognized" on a large test file, then passed on re-run — the signature of this exact race.

🤖 Generated with Claude Code

The per-file PSScriptAnalyzer child only retried the #1708 runspace race when it
surfaced as NullReferenceException/InvalidOperationException, but the same race
also throws CommandNotFoundException ("The term 'Get-Command' is not recognized")
when the crashed runspace loses its core cmdlets - which then failed the lane
outright with no retry. A rule throwing a RULE_ERROR is always a tooling crash,
never a real finding (findings travel on a separate stream), so classify any
RULE_ERROR* as transient regardless of exception type. Non-rule errors (parse,
bad settings) keep a different FullyQualifiedErrorId and still fail fast.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@claude

claude Bot commented Jun 26, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@kyle-sexton
kyle-sexton merged commit b6431a1 into main Jun 26, 2026
27 checks passed
@kyle-sexton
kyle-sexton deleted the fix/pssa-rule-error-retry branch June 26, 2026 20:10
kyle-sexton added a commit to melodic-software/standards that referenced this pull request Jun 26, 2026
…fix) (#44)

Bumps the pinned `melodic-software/ci-workflows` SHA to `b6431a1` to
pick up melodic-software/ci-workflows#41 — the PSScriptAnalyzer runner
now retries any `RULE_ERROR` crash, covering the
`CommandNotFoundException` ("Get-Command is not recognized") variant of
the #1708 race that intermittently failed the `powershell` lane. No
rules disabled; full SCA; Linux runners.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
kyle-sexton added a commit to melodic-software/claude-code-plugins that referenced this pull request Jun 26, 2026
…fix) (#10)

Bumps the pinned `melodic-software/ci-workflows` SHA to `b6431a1` to
pick up melodic-software/ci-workflows#41 — the PSScriptAnalyzer runner
now retries any `RULE_ERROR` crash, covering the
`CommandNotFoundException` ("Get-Command is not recognized") variant of
the #1708 race that intermittently failed the `powershell` lane. No
rules disabled; full SCA; Linux runners.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.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.

1 participant