[PR #6279] [MERGED] fix(ci): make Windows PowerShell observers cheap and cold-start tolerant #7251

Closed
opened 2026-11-01 21:46:30 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6279
Author: @kaoru0822-kitauji
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/windows-acl-observation-timeout


📝 Commits (1)

  • f9d6175 fix(ci): make Windows PowerShell observers cheap and cold-start tolerant

📊 Changes

2 files changed (+124 additions, -101 deletions)

View changed files

📝 docs/testing.md (+12 -7)
📝 scripts/verify-windows-native.mjs (+112 -94)

📄 Description

What broke: The Windows lane's private-runtime ACL observer (scripts/verify-windows-native.mjs) intermittently hit its 15s powershell.exe deadline (spawnSync powershell.exe ETIMEDOUT), turning scheduled main and unrelated PRs red.
Fix: The PowerShell observers now call .NET members directly (no Get-Acl, Update-TypeData, pipelines or ConvertTo-Json), keep the SID-only guarantee through SID-typed APIs, runtime SecurityIdentifier checks and a static guard, and use a 60s deadline sized for cold powershell.exe start.
Risk: CI verifier only; asserted ACL/readonly facts are unchanged. The new PowerShell is validated only by this PR's Windows lane (no local Windows/PowerShell available).

Summary

Fixes #6275

The independent ACL observer spent most of its ~1.2–2.9s in-script time in PowerShell machinery rather than the ACL read. On starved hosted runners those phases ran ~20x slower, and in one run powershell.exe did not reach its first statement within 15s.

Problem and expected behavior

Observed failures (job logs):

  • Scheduled main 39723321808: started 475ms, acl-read 949ms, owner-sid-read 954ms, rule-sids-read 10485ms, readonly-set 10500ms, killed before complete.
  • PR #6259 39731089547: empty stdout and stderr, SIGTERM. The script never printed started.

15 passing Windows lane jobs (2026-10-22 03:41–05:41Z) reached complete at 1235–2883ms. Per phase: Get-Acl 90–400ms, the Update-TypeData guard plus GetAccessRules 330–900ms, and the final @{…} | ConvertTo-Json/Where-Object 680–1520ms.

Expected: a cheap, deterministic SID-only observer whose deadline only catches a hung child.

Change and scope

  • ACL observer: reads with [Security.AccessControl.DirectorySecurity]::new(path, 'Access, Owner'), GetOwner([SecurityIdentifier]) and GetAccessRules($true, $true, [SecurityIdentifier]). It throws unless the owner and every rule identity are SecurityIdentifier, uses a foreach loop instead of Where-Object, and builds the JSON as a string. The facts (protected, ownerMatchesUser, trusteesOnlyUserAndSystem, count, rootReadonly) and their expected values are unchanged.
  • The #5941 Update-TypeData poison of Access is replaced by a load-time check in the verifier: the observer source must not contain Get-Acl, .Access, NTAccount or .Translate. This keeps the guarantee that accidental reintroduction gets caught, without the runtime type-table update.
  • Phase tracing is kept and adds process-uptime at script start, which separates powershell.exe startup from the observation.
  • Shared helper observeWithWindowsPowerShell (shared prelude, windowsHide, PSModulePath-free environment, one deadline). The other powershell.exe observers in the file now use it: the snapshot digest reader, readonly children (newline-separated paths instead of ConvertFrom-Json/ConvertTo-Json), and the delete-sharing-denied reader. The reader now also uses the PSModulePath-free environment and [void] instead of | Out-Null.
  • Deadline 15s → 60s. In-script work no longer goes through cmdlets. The deadline must cover a cold powershell.exe start on a starved runner, which was observed to exceed 15s (a lower bound only). 60s still fails a hung child well inside the lane's 25-minute budget.
  • docs/testing.md is updated to match.

Not included: no retries, no production code or provider authority changes. Maintainer scope decision: not applicable (existing CI observer).

Contract and boundary impact

  • Semantic owner and earliest changed stage: Windows native CI verifier (scripts/verify-windows-native.mjs).

  • Contribution scope fit and linked maintainer decision: CI reliability fix within existing boundaries; not applicable.

  • CLI and MCP/tool-catalog contract: none.

  • Provider, bridge, target-format, or platform compatibility: Windows PowerShell 5.1 observers in CI only.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details (if applicable): unchanged; same readonly mutation of the verifier's own private runtime root.

  • Generated metadata, package, or installation impact: none.

  • Read existing files or captured data.

  • Launch or attach to a process.

  • Inject instrumentation or run scripts/code.

  • Change process memory, registers, files, or configuration.

  • Contact network services.

  • Recover protected code or work around protections.

  • Documentation or usability only; no target interaction.

  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: the verifier itself is the regression. It is exercised by this PR's Windows capability and package lane, which scripts/verify-windows-*.mjs selects through the package scope.

  • Base reproduction or other evidence: the failing job logs and phase timings above (observed). The cost attribution to cmdlet, type-table and serializer work is source-derived from those phase timings. Runner starvation as the trigger is a hypothesis.

  • User-visible CLI/MCP output (if applicable): not applicable.

  • Remaining proof gaps: no local Windows or PowerShell parse/run. The new scripts are validated only by this PR's Windows lane. The flake is intermittent (2 of 17 sampled jobs), so a single green lane does not prove it is gone. The new process-uptime marker is meant to quantify cold start in future runs.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • node --check scripts/verify-windows-native.mjs passed.
  • Node check of the static guard regex: it does not match the observer, and it matches injected $a.Access.Count, Get-Acl, NTAccount and .Translate( lines.
  • npm run check:fast passed (macOS, after rebase on latest main).
  • npm run format:check passed.
  • npm run docs:check passed.
  • Windows lane: passed on head f9d6175c4 (run 39740240867, job 119706211092). One green run does not by itself establish the flake is gone (it previously hit 2 of 17 sampled jobs).

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: Windows covered only by this PR's hosted Windows lane.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the observer still never resolves account names and reads only the verifier's own private runtime root.

Author readiness

Human owner: @kaoru0822-kitauji

Declarations entered under the owner's standing written delegation for automation sessions. Independent human review was not observed in this session.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6279 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/windows-acl-observation-timeout` --- ### 📝 Commits (1) - [`f9d6175`](https://github.com/morluto/rea/commit/f9d6175c4cf920004cd99cef7933f2062c3e647e) fix(ci): make Windows PowerShell observers cheap and cold-start tolerant ### 📊 Changes **2 files changed** (+124 additions, -101 deletions) <details> <summary>View changed files</summary> 📝 `docs/testing.md` (+12 -7) 📝 `scripts/verify-windows-native.mjs` (+112 -94) </details> ### 📄 Description **What broke:** The Windows lane's private-runtime ACL observer (`scripts/verify-windows-native.mjs`) intermittently hit its 15s `powershell.exe` deadline (`spawnSync powershell.exe ETIMEDOUT`), turning scheduled main and unrelated PRs red. **Fix:** The PowerShell observers now call .NET members directly (no `Get-Acl`, `Update-TypeData`, pipelines or `ConvertTo-Json`), keep the SID-only guarantee through SID-typed APIs, runtime `SecurityIdentifier` checks and a static guard, and use a 60s deadline sized for cold `powershell.exe` start. **Risk:** CI verifier only; asserted ACL/readonly facts are unchanged. The new PowerShell is validated only by this PR's Windows lane (no local Windows/PowerShell available). ## Summary Fixes #6275 The independent ACL observer spent most of its ~1.2–2.9s in-script time in PowerShell machinery rather than the ACL read. On starved hosted runners those phases ran ~20x slower, and in one run `powershell.exe` did not reach its first statement within 15s. ## Problem and expected behavior Observed failures (job logs): - Scheduled main [39723321808](https://github.com/morluto/rea/actions/runs/39723321808/job/119648114325): `started 475ms, acl-read 949ms, owner-sid-read 954ms, rule-sids-read 10485ms, readonly-set 10500ms`, killed before `complete`. - PR #6259 [39731089547](https://github.com/morluto/rea/actions/runs/39731089547/job/119666774462): empty stdout and stderr, `SIGTERM`. The script never printed `started`. 15 passing Windows lane jobs (2026-10-22 03:41–05:41Z) reached `complete` at 1235–2883ms. Per phase: `Get-Acl` 90–400ms, the `Update-TypeData` guard plus `GetAccessRules` 330–900ms, and the final `@{…} | ConvertTo-Json`/`Where-Object` 680–1520ms. Expected: a cheap, deterministic SID-only observer whose deadline only catches a hung child. ## Change and scope - ACL observer: reads with `[Security.AccessControl.DirectorySecurity]::new(path, 'Access, Owner')`, `GetOwner([SecurityIdentifier])` and `GetAccessRules($true, $true, [SecurityIdentifier])`. It throws unless the owner and every rule identity are `SecurityIdentifier`, uses a `foreach` loop instead of `Where-Object`, and builds the JSON as a string. The facts (`protected`, `ownerMatchesUser`, `trusteesOnlyUserAndSystem`, `count`, `rootReadonly`) and their expected values are unchanged. - The #5941 `Update-TypeData` poison of `Access` is replaced by a load-time check in the verifier: the observer source must not contain `Get-Acl`, `.Access`, `NTAccount` or `.Translate`. This keeps the guarantee that accidental reintroduction gets caught, without the runtime type-table update. - Phase tracing is kept and adds `process-uptime` at script start, which separates `powershell.exe` startup from the observation. - Shared helper `observeWithWindowsPowerShell` (shared prelude, `windowsHide`, PSModulePath-free environment, one deadline). The other `powershell.exe` observers in the file now use it: the snapshot digest reader, readonly children (newline-separated paths instead of `ConvertFrom-Json`/`ConvertTo-Json`), and the delete-sharing-denied reader. The reader now also uses the PSModulePath-free environment and `[void]` instead of `| Out-Null`. - Deadline 15s → 60s. In-script work no longer goes through cmdlets. The deadline must cover a cold `powershell.exe` start on a starved runner, which was observed to exceed 15s (a lower bound only). 60s still fails a hung child well inside the lane's 25-minute budget. - `docs/testing.md` is updated to match. Not included: no retries, no production code or provider authority changes. Maintainer scope decision: not applicable (existing CI observer). ## Contract and boundary impact - Semantic owner and earliest changed stage: Windows native CI verifier (`scripts/verify-windows-native.mjs`). - Contribution scope fit and linked maintainer decision: CI reliability fix within existing boundaries; not applicable. - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: Windows PowerShell 5.1 observers in CI only. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details (if applicable): unchanged; same readonly mutation of the verifier's own private runtime root. - Generated metadata, package, or installation impact: none. - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: the verifier itself is the regression. It is exercised by this PR's Windows capability and package lane, which `scripts/verify-windows-*.mjs` selects through the `package` scope. - Base reproduction or other evidence: the failing job logs and phase timings above (observed). The cost attribution to cmdlet, type-table and serializer work is source-derived from those phase timings. Runner starvation as the trigger is a hypothesis. - User-visible CLI/MCP output (if applicable): not applicable. - Remaining proof gaps: no local Windows or PowerShell parse/run. The new scripts are validated only by this PR's Windows lane. The flake is intermittent (2 of 17 sampled jobs), so a single green lane does not prove it is gone. The new `process-uptime` marker is meant to quantify cold start in future runs. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `node --check scripts/verify-windows-native.mjs` passed. - Node check of the static guard regex: it does not match the observer, and it matches injected `$a.Access.Count`, `Get-Acl`, `NTAccount` and `.Translate(` lines. - `npm run check:fast` passed (macOS, after rebase on latest main). - `npm run format:check` passed. - `npm run docs:check` passed. - Windows lane: passed on head f9d6175c4 ([run 39740240867, job 119706211092](https://github.com/morluto/rea/actions/runs/39740240867/job/119706211092)). One green run does not by itself establish the flake is gone (it previously hit 2 of 17 sampled jobs). ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: Windows covered only by this PR's hosted Windows lane. - Package or release metadata impact: none. - Security, privacy, process, or containment review: the observer still never resolves account names and reads only the verifier's own private runtime root. ## Author readiness Human owner: @kaoru0822-kitauji Declarations entered under the owner's standing written delegation for automation sessions. Independent human review was not observed in this session. - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [ ] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:46:30 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7251
No description provided.