Skip to content

feat: close the PowerShell diagnostics gaps from the 2026-08-05 incident session - #111

Merged
jonchun merged 3 commits into
mainfrom
feat/ps-diagnostics-gaps
Aug 6, 2026
Merged

feat: close the PowerShell diagnostics gaps from the 2026-08-05 incident session#111
jonchun merged 3 commits into
mainfrom
feat/ps-diagnostics-gaps

Conversation

@jonchun

@jonchun jonchun commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

A recorded 3DEXPERIENCE/SQL Server incident session kept a log of every command the validator rejected. Replaying that log against v0.9.6 split it in two:

Real gaps (fixed here):

  • Format-Table -Wrap — without it long Message fields truncate mid-sentence, forcing the much more verbose Format-List
  • Get-ChildItem -Include-Filter takes one Win32 glob; finding crash dumps + heap dumps + javacores took three passes
  • Select-String -Context — the grep -B/-A equivalent
  • net accounts — the only reader for lockout/password policy; allowed bare-only via subcommand dispatch and a new no_positional_args manifest field (the same slash switches that display policy also set it when given values, and they reach the validator as positionals). Bare net, net.exe, and every other net subcommand stay denied.

False negatives (fixed by correcting what we tell the agent): the session never attempted $_, calculated properties, Where-Object blocks, jps/jstack, time-bounded -FilterHashtable, Get-NetFirewallRule, or Get-Counter — all of which v0.9.6 already accepts. The agent self-censored because the WinRM connect hint still says "no $ or {} or ;", stale since the safe-expression grammar landed, and the script-block parse error claims blocks are unsupported outright. Both messages now describe the actual safe subset.

Test plan

  • New validator/windows_diagnostics_test.go covers each formerly-rejected command, plus guards: net accounts /forcelogoff:30, net user eve /add, net localgroup, and bare net all stay rejected
  • New parser test pins the script-block error to name the supported subset
  • New server/hint_test.go pins the connect hint to advertise $_, [math]::, jps, jstack, FilterHashtable and rejects the stale claim
  • go test ./... passes except TestLocalExecutor_Persistent_RoundTrip, which fails identically on unmodified main in this environment (zsh bracketed-paste escape codes in PTY output) — pre-existing, unrelated

🤖 Generated with Claude Code

jonchun and others added 3 commits August 6, 2026 13:04
…sion

A recorded 3DEXPERIENCE/SQL Server incident session logged every command
the validator rejected. Four were real gaps:

- Format-Table -Wrap: without it long Message fields truncate mid-sentence,
  forcing the far more verbose Format-List.
- Get-ChildItem -Include: -Filter takes one Win32 glob; searching for crash
  dumps, heap dumps, and javacores took three passes.
- Select-String -Context: the grep -B/-A equivalent.
- net accounts: the only reader for lockout/password policy; the Get-*
  cmdlets the denial pointed to cannot show it.

net accounts is allowed via subcommand dispatch so bare net, net.exe, and
every other net subcommand stay denied. The same slash switches that
display the policy also set it when given values, and they reach the
validator as positionals - so this adds no_positional_args, a manifest
field that rejects every positional argument, keeping only the bare
read-only form. positional_allowlist cannot express that: an empty values
list is rejected at load time as a likely manifest bug.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The old message said "Script blocks are not supported", which stopped
being true when the safe-expression grammar landed. The incident session
showed the cost: the agent never attempted calculated properties or
Where-Object blocks because the first rejection primed it to avoid every
construct with braces. Name what blocks do support and what they don't.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The connect hint still said "no $ or {} or ;" - stale since the
safe-expression grammar landed, and agents obey it completely. In the
2026-08-05 incident session the agent documented WorkingSet64 as
unreachable and skipped jstack entirely, both because of this hint,
while the validator would have accepted both.

The hint now names what works: $_ in script blocks, calculated
properties, [math]::/[datetime]:: calls, FilterHashtable time bounds,
the JVM tools, and net accounts - plus what still doesn't.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jonchun
jonchun merged commit 6244a02 into main Aug 6, 2026
2 checks passed
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