Repository navigation
fix(windows): repair the install-dir package ACL that blanks the window - #17740
Conversation
An install tree carrying an orphan AppContainer ACE (S-1-15-2-<x>) with no ALL RESTRICTED APPLICATION PACKAGES grant denies Chromium's LPAC children read on the shipped modules; they die at init with 0x80000003 and the window stays blank forever (electron/electron#51761). - Tighten the probe verdict to require the S-1-15-2-2 grant specifically: an ALL APPLICATION PACKAGES (S-1-15-2-1) ACE, the Program Files default, does not appear in an LPAC token and cannot satisfy the orphan. - Drop BUILTIN from the English-locale heuristic (fr-FR/es-ES print it verbatim) so a localized icacls is correctly reported as un-name-checkable. - Add an additive, marker-guarded icacls self-repair: an inheritable root grant plus a flagless (RX) /T pass, never /grant:r. - Route the crash-loop dialog through a testable prompt module that names the permission cause, offers Copy Commands without dismissing itself, and keeps the graphics-driver hint. The repair only runs on win32, off serve mode, and only on the exact probe verdict that reproduced the crash.
📝 WalkthroughWalkthroughThe change detects poisoned Windows install-directory ACLs and starts repair when the probe reports a poisoned ACL. The repair runs root and tree Merge Risk: 🔵 Low · up to The PR adds automatic Windows ACL repair and clearer recovery messaging. A failed or partial repair may not be retried on later launches of the same version, and some new recovery text still needs localization follow-up. The change is mergeable with explicit owner awareness of these bounded risks. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description provides detailed scope, rationale, implementation, testing, trade-offs, and limitations. However, it does not follow the repository template fully: it lacks a repository issue reference using Resolution Add the missing template sections. Include a repository issue reference in
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR extends the Windows install-directory ACL probe into an automatic, marker-guarded repair and adds an ACL-aware renderer recovery prompt.
Confidence Score: 4/5The PR is not yet safe to merge because localized ACL output can still be marked reliable and trigger a recursive repair of a healthy install tree. The locale fix only removes Files Needing Attention: src/main/startup/windows-install-dir-acl-probe.ts
|
| Filename | Overview |
|---|---|
| src/main/startup/windows-install-dir-acl-probe.ts | Refines package ACE parsing, but the locale-reliability heuristic still preserves the previously reported false-positive path through untranslated authority names. |
| src/main/startup/windows-install-dir-package-acl-repair.ts | Adds marker-guarded, additive root and recursive ACL grants with bounded process execution and repair breadcrumbs. |
| src/main/startup/windows-install-dir-acl-recovery.ts | Connects accepted probe verdicts to background repair state and user-facing diagnosis. |
| src/main/window/renderer-recovery-prompt.ts | Extracts the crash-loop prompt and supports re-reading diagnosis, copying commands without dismissal, manual reload, and quit. |
| src/main/index.ts | Wires the install ACL repair into Windows startup and delegates renderer crash recovery to the extracted prompt. |
Reviews (2): Last reviewed commit: "fix(windows): keep the install-ACL poiso..." | Re-trigger Greptile
| const RESTRICTED_PACKAGE_NAME = /ALL RESTRICTED APPLICATION PACKAGES/i | ||
| // Not BUILTIN: fr-FR and es-ES print it verbatim while localizing the package | ||
| // names, so it is evidence of nothing. SYSTEM's ACE is on every install tree. | ||
| const ENGLISH_PRINCIPAL = /\b(NT AUTHORITY|APPLICATION PACKAGE AUTHORITY)\b/i |
There was a problem hiding this comment.
Locale reliability checks wrong substring
When localized Windows output keeps NT AUTHORITY or APPLICATION PACKAGE AUTHORITY in English but translates ALL RESTRICTED APPLICATION PACKAGES, this check marks the output reliable while the parser misses the valid restricted-package grant. An install containing that grant and an orphan SID is then falsely classified as poisoned, causing Orca to recursively rewrite a healthy install ACL and present incorrect recovery instructions.
Knowledge Base Used: Desktop application platform
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 97575b1a-33fb-472b-84b2-cb4c71430374
📒 Files selected for processing (11)
src/main/index.tssrc/main/startup/windows-install-dir-acl-probe.test.tssrc/main/startup/windows-install-dir-acl-probe.tssrc/main/startup/windows-install-dir-acl-recovery.test.tssrc/main/startup/windows-install-dir-acl-recovery.tssrc/main/startup/windows-install-dir-acl.test-fixture.tssrc/main/startup/windows-install-dir-package-acl-repair.test.tssrc/main/startup/windows-install-dir-package-acl-repair.tssrc/main/window/createMainWindow-renderer-crash-recovery.test.tssrc/main/window/renderer-recovery-prompt.test.tssrc/main/window/renderer-recovery-prompt.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
| const GENERIC_DETAIL = | ||
| 'This is often a graphics-driver or installation problem. Reload to try again, or quit and relaunch Orca.' | ||
| // Why keep it alongside the ACL diagnosis: the probe cannot name-check every | ||
| // locale, so a driver crash on a healthy install must not lose its only hint. | ||
| const DRIVER_FALLBACK = 'If that does not help, the cause is usually a graphics driver.' |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Localize the new recovery-dialog text.
Replace the user-visible ACL and renderer recovery literals with intent-named localization IDs, using named interpolation placeholders for dynamic values such as recentRecoveryCount. These messages may be the only usable recovery surface when the window is blank.
Also apply this to the ACL recovery strings in src/main/startup/windows-install-dir-acl-recovery.ts.
📍 Affects 2 files
src/main/window/renderer-recovery-prompt.ts#L9-L13(this comment)src/main/startup/windows-install-dir-acl-recovery.ts#L57-L58
Source: Learnings
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the install-dir package ACL repair end to end: the tightened probe verdict, the locale heuristic fix, the new self-repair module and its recovery wiring, the crash-loop dialog rewrite, and the follow-up cost-model comment correction.
- Tightened probe verdict —
matchesPoisonSignaturenow rides onhasRestrictedPackageGrant(S-1-15-2-2) alone, sinceALL APPLICATION PACKAGES(S-1-15-2-1) is absent from an LPAC token and was masking the single most common poisoned shape. - Locale heuristic fix —
BUILTINdropped fromENGLISH_PRINCIPALso a localizedicaclsis correctly reported as un-name-checkable instead of triggering a false-positive repair. - Additive self-repair —
windows-install-dir-package-acl-repair.tsruns twoicacls /grantpasses (inheritable(OI)(CI)(RX)root grant, then flagless(RX)/T /C), never/grant:r, marker-guarded inuserDatakeyed on install dir + app version. - Recovery and dialog — the probe's
onDonehands its verdict to the repair; the crash-loop dialog is extracted into a testablerenderer-recovery-prompt.tsthat names the real cause, offers a non-dismissing Copy Commands button, and re-reads the diagnosis each pass. - Cost-model comment —
95631a3e12corrects the/Twalk estimate from "~80 entries" to the shipped ~3.2k-entry shape.
Verified locally: all five affected suites pass (64 tests) and pnpm tc:node is clean.
ℹ️ Nitpicks
- The PR body's "Perf review" section still says the cost-model comment is "deliberately not fixed" and defers a
perf(windows)follow-up, but commit95631a3e12already corrected the comment — the description is now slightly stale and could mislead a reader into expecting an open follow-up.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior review, one commit landed: 95631a3e12 corrects the /T install-tree walk cost-model comment in windows-install-dir-package-acl-repair.ts, replacing the inaccurate "~80 entries (45ms measured)" claim with the shipped ~3.2k-entry estimate and a ~2.2ms/entry figure sourced from the measured windows-user-data-acl.ts walk. Comment-only — no behavioral change.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
An orphan package ACE alongside the Program Files ALL APPLICATION PACKAGES default launches clean on win32 10.0.26200 / Electron 43.4.1, so requiring S-1-15-2-2 specifically declared poison on healthy installs - and this branch acts on that verdict with a tree-wide icacls write and the crash-recovery dialog's primary cause. hasRestrictedPackageGrant stays reported for triage; only the verdict reverts.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/startup/windows-install-dir-acl-probe.ts (1)
175-175: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winRequire the restricted package grant for a clean verdict.
hasWellKnownPackageGrantis true for bothS-1-15-2-1andS-1-15-2-2. This predicate therefore marks an orphan ACE plus onlyALL APPLICATION PACKAGESas clean. The recovery gate then skips repair and diagnosis.Use
!f.hasRestrictedPackageGranthere. Update the matching expectations insrc/main/startup/windows-install-dir-acl-probe.test.tsandsrc/main/startup/windows-install-dir-acl-recovery.test.ts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: ddb200d6-91a0-4536-b2bc-1a12bc1ad231
📒 Files selected for processing (6)
src/main/startup/windows-install-dir-acl-probe.test.tssrc/main/startup/windows-install-dir-acl-probe.tssrc/main/startup/windows-install-dir-acl-recovery.test.tssrc/main/startup/windows-install-dir-acl.test-fixture.tssrc/main/startup/windows-install-dir-package-acl-repair.test.tssrc/main/startup/windows-install-dir-package-acl-repair.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/main/startup/windows-install-dir-package-acl-repair.test.ts
- src/main/startup/windows-install-dir-acl.test-fixture.ts
- src/main/startup/windows-install-dir-package-acl-repair.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
There was a problem hiding this comment.
Important
The new commit reverses the poison-verdict gate back to accepting ALL APPLICATION PACKAGES (S-1-15-2-1) as satisfying the orphan. That re-opens the exact under-trigger Round 2 closed: the LPAC children that crash don't consult -1 in their access check, so the most common poisoned shape (an orphan plus only the Program Files-inherited -1 grant) is now reported clean and gets neither the repair nor the dialog copy. Details inline.
Reviewed changes
Reviewed the single commit that landed since the prior Pullfrog review (bfdcb63086).
- Reverted the poison-verdict gate —
matchesPoisonSignaturemoved from requiringS-1-15-2-2(!hasRestrictedPackageGrant) back to accepting either well-known grant (!hasWellKnownPackageGrant);hasRestrictedPackageGrantis now diagnostic-only in the breadcrumb. - Rewrote the probe header comment and test expectations — the orphan +
ALL APPLICATION PACKAGESshape is now asserted clean in both the probe suite and the recovery suite. - Updated fixtures and repair header comments to describe
S-1-15-2-1as a shape that "launches clean".
ℹ️ PR description now contradicts the code
The PR body's "What" (item 1) and the "Fix evidence" section still describe the old behavior — "The verdict now requires S-1-15-2-2 specifically" — which this commit undid. If the reversal stands, the body (and the Round 2 fix-evidence before/after quotes) should be updated so a reader doesn't infer the code still gates on -2.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| // Capped: correlating the same orphan across reports is what would | ||
| // identify the tool that left it, which is the point of recording it. | ||
| orphanPackageSids: sanitizeCrashReportString(orphans.slice(0, 3).join(','), 200), | ||
| // The verdict rides on this one: either well-known grant satisfies the orphan. |
There was a problem hiding this comment.
The verdict now lets S-1-15-2-1 (ALL APPLICATION PACKAGES) satisfy the orphan, but the LPAC children that crash don't see -1: their access check is against S-1-15-2-2. So an orphan plus only the Program Files-inherited -1 grant still leaves the renderer/GPU children locked out, yet is now reported matchesPoisonSignature: false — skipping both the repair and the dialog copy for the single most common poisoned shape this PR exists to fix.
Technical details
# Reverted poison gate under-triggers the most common poisoned shape
## Affected sites
- src/main/startup/windows-install-dir-acl-probe.ts:174 — `poisoned` now uses `!f.hasWellKnownPackageGrant`, so `S-1-15-2-1` clears the signature.
- src/main/startup/windows-install-dir-acl-probe.ts:186,193 — the breadcrumb comment marks `hasWellKnownPackageGrant` as "the verdict" and `hasRestrictedPackageGrant` as diagnostic-only.
- src/main/startup/windows-install-dir-acl-probe.test.ts:81-92 — asserts the orphan + `ALL APPLICATION PACKAGES` shape is clean.
- src/main/startup/windows-install-dir-acl-recovery.test.ts:90-96 — asserts no repair and no dialog for that shape.
## Required outcome
- Reconcile the gate with the LPAC access-check semantics, or revert to the `!hasRestrictedPackageGrant` verdict from `95631a3e12`.
## Evidence the reversal is wrong
- Chromium's LPAC emulation removes `S-1-15-2-1` ACEs from the DACL precisely to simulate LPAC behavior (`sandbox/win/src/app_container_base.cc`, `AppContainerBase::AccessCheck` with `enable_low_privilege_app_container_` calls `SetDaclEntry(kAllApplicationPackages, kRevoke, ...)`).
- `TokenIsLessPrivilegedAppContainer` (NtDoc `phnt` headers) states the LPAC flag "replaces" the `ALL APPLICATION PACKAGES` (`S-1-15-2-1`) access check with `ALL RESTRICTED APPLICATION PACKAGES` (`S-1-15-2-2`), marked by the `WIN://NOALLAPPPKG` attribute.
- electron/electron#51761's reproducible remedy is the additive `S-1-15-2-2` grant; a `-1`-only DACL is not reported anywhere there as a fix.
## Internal inconsistency to check
- The new test comment at windows-install-dir-acl-probe.test.ts:83 concedes `-1` is "useless ... to an LPAC token" while still concluding the `-1`-only shape "launched clean". If `-1` is useless to the LPAC child, that shape should still crash — which suggests the "launched clean" observation came from a DACL that carried some other grant (e.g. `-2` elsewhere in the tree) or a test artifact, not from `-1` satisfying the child. Please post the actual `icacls` output of the directory *and* the module file that launched clean; if there is a `-2` grant on the module files, the gate should still require it.
## Open questions for the human
- Was the "launched clean" repro's DACL truly orphan + `S-1-15-2-1` only, on both the install root and the `ffmpeg.dll`/`libGLESv2.dll` module files the probe reads?
Merge record: readiness + real-hardware validation passedReadiness checklist: passed. Counsel adjudication: no P0/P1 findings after 1 fix round. Real-hardware validation hosts:
Key evidence:
CI: all PR Checks green on Merging. |
…nderer is decidable (#18367) * fix(windows): refuse tree-kills of Orca's own Chromium pids and record the rest G2 is 20 field reports that share only a symptom. It is at least four fingerprints: ~15 Windows `reason=killed exitCode=1`, 3 POSIX SIGKILL under memory pressure (G4-oom), 2 duplicate reports of one macOS V8 Proxy Resolver SIGKILL, and 1 `0x80000003` install-dir ACL crash (G1; #17740 ships in v1.4.196 only, not 1.4.195). Nothing here claims to fix all of them. Two changes: 1. Behaviour. `classifyWindowsTreeKillTarget` returns `own` for any direct child of the main process — which our renderer, GPU and network-service utility all are — so PTY teardown could `taskkill /T /F` Orca's own UI (#10680). Both that classifier and `terminateWindowsProcessTree` now refuse any pid Electron is currently accounting for in `getAppMetrics()`. 2. Diagnosis. An Orca-issued kill and an external one are byte-identical in every field the crash report records today, so the cluster is undecidable. Every main-process force-kill choke point now records a durable `self_tree_kill` breadcrumb, and `process_gone` reports carry `selfInitiatedTreeKills` naming the pid and its offset from the death. A refused kill records `self_tree_kill_refused_own_chromium`, which is falsifiable: if it ever shows up in the field, we were the killer. * fix(crash-reporting): coalesce self-kill breadcrumbs and scope the discriminator Round-1 review remediation. Three blocking findings, all accepted. 1. Breadcrumb flood (accepted). recordSelfInitiatedTreeKill wrote an uncoalesced durable crumb from two routine teardown paths, and the reviewer reproduced 12 terminal closes x 3 process groups completely evicting the 30-slot ring — including this PR's own refusal crumb — plus a forced writeSync per killed group. It now uses the existing recordCoalescedDurableCrashBreadcrumb (5s window for pid-addressed taskkills, 60s for routine group/job teardown), so a burst costs one ring slot and one flush. The refusal crumb is coalesced per victim pid, so a retry loop cannot flood while a distinct pid always gets its own crumb. Regression test replays the reviewer's exact 12x3 reproduction and asserts the refusal crumb and a pre-existing gpu_process_crashed both survive. 2. Undifferentiated count (accepted). posix-process-group and win-pty-job are structurally incapable of reaching a Chromium process, and scope was absent from the persisted string. Scope is now in every entry (`<scope>/<site>/pid<N> +Nms`), and the count is split: selfInitiatedTreeKillCount now counts only pid-addressed taskkills — the kills that can land on a recycled pid that is now our renderer — with pty-scoped sweeps in selfInitiatedGroupKillCount. The list is renamed selfInitiatedKills because it carries both, and sorts pid-addressed kills first so truncation never drops the discriminating ones for teardown noise. The reviewer's repro (routine macOS terminal close + unrelated exit-133 crash) now yields selfInitiatedTreeKillCount undefined. 3. Recording gaps and a false comment (accepted). New admitSelfInitiatedTreeKill gate: it refuses own-Chromium pids and records the rest, and all three main-process taskkill families now go through it — terminateWindowsProcessTree plus codex-accounts/service.ts and claude-accounts (which keep their own spawn lifetimes). The false "single taskkill choke point" comment is gone. The runProcess choke point the investigation asked for is instrumented via a setProcessTreeKillObserver seam in src/shared/child-process — shared code runs in the CLI and relay so it cannot import the main breadcrumb store — registered in main preflight. The codex app-server POSIX group teardowns and the claude POSIX branch record too. The module doc no longer claims absence is discriminating: it enumerates what is instrumented and names the direct process.kill(-pid) sites that are not. Non-blocking, also fixed: - Breadcrumb calls moved out of the try blocks whose catch is the ESRCH contract (posix-pty-process-groups, codex teardown, claude POSIX), so a throw from the diagnostic path can never be reported as a failed kill. - Detail truncation now bounds the first entry too, matching its comment. - own-chromium-tree-kill-refusal.test.ts renamed to own-chromium-tree-kill-guard.test.ts, colocated with the module it tests. Not changed, with reasons: - Date.now() vs performance.now(): kept. Offsets are computed against goneAt = Date.now() in process-gone-recorder; a monotonic clock here would make the offsets meaningless. The reviewer verified this and agreed it is not a defect. - app.getAppMetrics() per force-kill remains unbenchmarked. It reads in-process browser state rather than enumerating the OS process table, and a TTL cache would let a recycled pid slip past the refusal, so it stays uncached. - The ~15 remaining direct process.kill(-pid) sites (browser routes, notebooks, automation prechecks, ephemeral VM recipes) are not instrumented. Rather than claim coverage this PR does not have, the module doc names them. claude-command-process.ts crossed the 300-line cap, so terminateClaudeProcess moved to claude-login-process-termination.ts. No max-lines suppression added. * fix(crash-reporting): scope the self-kill guard to its real host topology Round-2 review findings on the own-Chromium tree-kill guard. BLOCKING 1 — "the own-Chromium refusal is a no-op in the process that issues the pty-descendant-sweep taskkill". Correct on the mechanism, wrong on the consequence; REBUTTED in part and documented in full. Confirmed: the only non-test `setAppEnvironment` installs are main-process-preflight.ts:177 (Electron) and orcad-entry.ts:84 (Node, whose `getAppMetrics()` is `[]`); daemon-init-fresh-import.ts is a test harness. So in the standalone daemon `readOrcaChromiumProcessPids()` is empty and `admitSelfInitiatedTreeKill` always admits. But that is not a live hazard. `killWithDescendantSweep` reaches `terminateWindowsProcessTree` only when `verifyWindowsTreeKillTarget` returns `own`, and that walks ancestry back to `deps.ownerPid ?? process.pid` — the KILLING process's pid. In the daemon that is the daemon's pid. Orca's Chromium processes are children of Electron main, a sibling of the daemon, so their chain never reaches it: hop 0 lands on main, and within MAX_ANCESTOR_HOPS the walk dead-ends and returns `foreign`. The reviewer's probe passes `ownerPid: 1000` with the renderer as a direct child of 1000 — that is the Electron-main topology, where the AppEnvironment IS installed and the guard DOES fire, not the daemon's. On an orcad/SSH host there is no Chromium on the box at all, so `[]` is accurate rather than degraded. Locked in as tests rather than prose (own-chromium-tree-kill-guard.test.ts): a renderer classifies `foreign` from a daemon ownerPid with an empty pid set, and `own` from main's ownerPid with an empty set — the falsifiable pair showing the pid set is load-bearing in main and nowhere else. Documented the host coverage in orca-chromium-process-pids.ts and own-chromium-tree-kill-guard.ts. One genuine hole the finding exposes: `signalProcessTree`'s `taskkillTree` is a fourth pid-addressed taskkill family (non-blocking item 2), it runs in the daemon/relay/CLI where the guard cannot run, and it guarded only on `!child.pid`. Reusing the predicate the codex login teardown already uses, the win32 branch now refuses a reaped child and falls back to `killRoot` — the same shape as the existing `!child.pid` branch. That closes the reaped-then-recycled pid path in every host. BLOCKING 2 — module doc overstates coverage. Rewritten: the ring is per-process and its only reader lives in Electron main, so a count on a `render-process-gone` covers main-issued kills only. Sites are now split into main-only, main-and- other-hosts (runProcess choke point, POSIX PTY group sweep, Windows Job Object — which record into a ring nothing reads when they run in the daemon or relay), and never-instrumented, with the note that a daemon/relay omission is a diagnostics gap, not a missed suspect, per the topology argument above. BLOCKING 3 — the three out-of-main instrumentation sites were untested. Added regression coverage: the runProcess seam on both branches plus the reaped-child refusal (process-tree-termination.test.ts), the group sweep recording only groups it actually signalled and skipping an ESRCH group (posix-pty-process-groups.test.ts), and the Job Object recording the shell pid only on `terminated` (windows-pty-job.test.ts). Verified red: reverting the three production files to origin/main fails 7 of the new tests. BLOCKING 4 — the Windows evidence validates a single-process model. Accepted. The main2.js arms exercise `pty-descendant-sweep` inside one Electron process; that models the in-process/degraded daemon and the local PTY provider, not the standalone daemon. Arm C's "the 449351d6 shape is not producible with the guard" holds for main-issued kills only. In the daemon the shape is blocked one layer earlier, by the ancestry check, which the arms do not exercise. NON-BLOCKING taken: `recordSelfInitiatedTreeKill` moved outside the native `terminateJob` try in windows-pty-job.ts, so a diagnostics throw can no longer downgrade a real termination to `unavailable` and escalate callers to a broader kill; covered by a test. The "all three families" parenthetical is gone with the doc rewrite. `pnpm build:relay` run: exit 0, all seven targets built. NON-BLOCKING declined: codex-accounts/service.ts records before the spawn because a refusal must prevent the spawn — the crumb means "we were about to kill this pid", which is the artifact worth having; the existing comment already says so. `app.getAppMetrics()` perf is unbenchmarked and unchanged by this round. Verification: pnpm tc clean; oxlint clean on touched paths; check:code-quality:changed 0 new findings; oxfmt applied. 730 tests pass across shared/child-process, main/crash-reporting, main/pty, main/windows and the guard and descendant-sweep suites. The 4 failures in providers/git/codex-integration reproduce on HEAD without these changes. * fix(crash-reporting): keep the reaped-pid skip from flipping the termination barrier The win32 hasExited short-circuit correctly avoids taskkill on a pid Windows may have reissued, but it resolved `true` — verified tree termination. A taskkill against a reaped pid already resolved `false`, and run-process turns `true` into barrierTerminationVerified + terminationReporter.report(), which releases the git admission grant on root exit instead of on `close`. That admits the next git command while a descendant holding the inherited pipes is still writing the repo. Resolve `false` so the skip changes only which process we refuse to signal, not what the barrier claims.
…ow (stablyai#17740) * fix(windows): repair the install-dir package ACL that blanks the window An install tree carrying an orphan AppContainer ACE (S-1-15-2-<x>) with no ALL RESTRICTED APPLICATION PACKAGES grant denies Chromium's LPAC children read on the shipped modules; they die at init with 0x80000003 and the window stays blank forever (electron/electron#51761). - Tighten the probe verdict to require the S-1-15-2-2 grant specifically: an ALL APPLICATION PACKAGES (S-1-15-2-1) ACE, the Program Files default, does not appear in an LPAC token and cannot satisfy the orphan. - Drop BUILTIN from the English-locale heuristic (fr-FR/es-ES print it verbatim) so a localized icacls is correctly reported as un-name-checkable. - Add an additive, marker-guarded icacls self-repair: an inheritable root grant plus a flagless (RX) /T pass, never /grant:r. - Route the crash-loop dialog through a testable prompt module that names the permission cause, offers Copy Commands without dismissing itself, and keeps the graphics-driver hint. The repair only runs on win32, off serve mode, and only on the exact probe verdict that reproduced the crash. * docs(windows): correct the install-tree ACL walk cost model * fix(windows): keep the install-ACL poison gate at the reproduced shape An orphan package ACE alongside the Program Files ALL APPLICATION PACKAGES default launches clean on win32 10.0.26200 / Electron 43.4.1, so requiring S-1-15-2-2 specifically declared poison on healthy installs - and this branch acts on that verdict with a tree-wide icacls write and the crash-recovery dialog's primary cause. hasRestrictedPackageGrant stays reported for triage; only the verdict reverts.
…nderer is decidable (stablyai#18367) * fix(windows): refuse tree-kills of Orca's own Chromium pids and record the rest G2 is 20 field reports that share only a symptom. It is at least four fingerprints: ~15 Windows `reason=killed exitCode=1`, 3 POSIX SIGKILL under memory pressure (G4-oom), 2 duplicate reports of one macOS V8 Proxy Resolver SIGKILL, and 1 `0x80000003` install-dir ACL crash (G1; stablyai#17740 ships in v1.4.196 only, not 1.4.195). Nothing here claims to fix all of them. Two changes: 1. Behaviour. `classifyWindowsTreeKillTarget` returns `own` for any direct child of the main process — which our renderer, GPU and network-service utility all are — so PTY teardown could `taskkill /T /F` Orca's own UI (stablyai#10680). Both that classifier and `terminateWindowsProcessTree` now refuse any pid Electron is currently accounting for in `getAppMetrics()`. 2. Diagnosis. An Orca-issued kill and an external one are byte-identical in every field the crash report records today, so the cluster is undecidable. Every main-process force-kill choke point now records a durable `self_tree_kill` breadcrumb, and `process_gone` reports carry `selfInitiatedTreeKills` naming the pid and its offset from the death. A refused kill records `self_tree_kill_refused_own_chromium`, which is falsifiable: if it ever shows up in the field, we were the killer. * fix(crash-reporting): coalesce self-kill breadcrumbs and scope the discriminator Round-1 review remediation. Three blocking findings, all accepted. 1. Breadcrumb flood (accepted). recordSelfInitiatedTreeKill wrote an uncoalesced durable crumb from two routine teardown paths, and the reviewer reproduced 12 terminal closes x 3 process groups completely evicting the 30-slot ring — including this PR's own refusal crumb — plus a forced writeSync per killed group. It now uses the existing recordCoalescedDurableCrashBreadcrumb (5s window for pid-addressed taskkills, 60s for routine group/job teardown), so a burst costs one ring slot and one flush. The refusal crumb is coalesced per victim pid, so a retry loop cannot flood while a distinct pid always gets its own crumb. Regression test replays the reviewer's exact 12x3 reproduction and asserts the refusal crumb and a pre-existing gpu_process_crashed both survive. 2. Undifferentiated count (accepted). posix-process-group and win-pty-job are structurally incapable of reaching a Chromium process, and scope was absent from the persisted string. Scope is now in every entry (`<scope>/<site>/pid<N> +Nms`), and the count is split: selfInitiatedTreeKillCount now counts only pid-addressed taskkills — the kills that can land on a recycled pid that is now our renderer — with pty-scoped sweeps in selfInitiatedGroupKillCount. The list is renamed selfInitiatedKills because it carries both, and sorts pid-addressed kills first so truncation never drops the discriminating ones for teardown noise. The reviewer's repro (routine macOS terminal close + unrelated exit-133 crash) now yields selfInitiatedTreeKillCount undefined. 3. Recording gaps and a false comment (accepted). New admitSelfInitiatedTreeKill gate: it refuses own-Chromium pids and records the rest, and all three main-process taskkill families now go through it — terminateWindowsProcessTree plus codex-accounts/service.ts and claude-accounts (which keep their own spawn lifetimes). The false "single taskkill choke point" comment is gone. The runProcess choke point the investigation asked for is instrumented via a setProcessTreeKillObserver seam in src/shared/child-process — shared code runs in the CLI and relay so it cannot import the main breadcrumb store — registered in main preflight. The codex app-server POSIX group teardowns and the claude POSIX branch record too. The module doc no longer claims absence is discriminating: it enumerates what is instrumented and names the direct process.kill(-pid) sites that are not. Non-blocking, also fixed: - Breadcrumb calls moved out of the try blocks whose catch is the ESRCH contract (posix-pty-process-groups, codex teardown, claude POSIX), so a throw from the diagnostic path can never be reported as a failed kill. - Detail truncation now bounds the first entry too, matching its comment. - own-chromium-tree-kill-refusal.test.ts renamed to own-chromium-tree-kill-guard.test.ts, colocated with the module it tests. Not changed, with reasons: - Date.now() vs performance.now(): kept. Offsets are computed against goneAt = Date.now() in process-gone-recorder; a monotonic clock here would make the offsets meaningless. The reviewer verified this and agreed it is not a defect. - app.getAppMetrics() per force-kill remains unbenchmarked. It reads in-process browser state rather than enumerating the OS process table, and a TTL cache would let a recycled pid slip past the refusal, so it stays uncached. - The ~15 remaining direct process.kill(-pid) sites (browser routes, notebooks, automation prechecks, ephemeral VM recipes) are not instrumented. Rather than claim coverage this PR does not have, the module doc names them. claude-command-process.ts crossed the 300-line cap, so terminateClaudeProcess moved to claude-login-process-termination.ts. No max-lines suppression added. * fix(crash-reporting): scope the self-kill guard to its real host topology Round-2 review findings on the own-Chromium tree-kill guard. BLOCKING 1 — "the own-Chromium refusal is a no-op in the process that issues the pty-descendant-sweep taskkill". Correct on the mechanism, wrong on the consequence; REBUTTED in part and documented in full. Confirmed: the only non-test `setAppEnvironment` installs are main-process-preflight.ts:177 (Electron) and orcad-entry.ts:84 (Node, whose `getAppMetrics()` is `[]`); daemon-init-fresh-import.ts is a test harness. So in the standalone daemon `readOrcaChromiumProcessPids()` is empty and `admitSelfInitiatedTreeKill` always admits. But that is not a live hazard. `killWithDescendantSweep` reaches `terminateWindowsProcessTree` only when `verifyWindowsTreeKillTarget` returns `own`, and that walks ancestry back to `deps.ownerPid ?? process.pid` — the KILLING process's pid. In the daemon that is the daemon's pid. Orca's Chromium processes are children of Electron main, a sibling of the daemon, so their chain never reaches it: hop 0 lands on main, and within MAX_ANCESTOR_HOPS the walk dead-ends and returns `foreign`. The reviewer's probe passes `ownerPid: 1000` with the renderer as a direct child of 1000 — that is the Electron-main topology, where the AppEnvironment IS installed and the guard DOES fire, not the daemon's. On an orcad/SSH host there is no Chromium on the box at all, so `[]` is accurate rather than degraded. Locked in as tests rather than prose (own-chromium-tree-kill-guard.test.ts): a renderer classifies `foreign` from a daemon ownerPid with an empty pid set, and `own` from main's ownerPid with an empty set — the falsifiable pair showing the pid set is load-bearing in main and nowhere else. Documented the host coverage in orca-chromium-process-pids.ts and own-chromium-tree-kill-guard.ts. One genuine hole the finding exposes: `signalProcessTree`'s `taskkillTree` is a fourth pid-addressed taskkill family (non-blocking item 2), it runs in the daemon/relay/CLI where the guard cannot run, and it guarded only on `!child.pid`. Reusing the predicate the codex login teardown already uses, the win32 branch now refuses a reaped child and falls back to `killRoot` — the same shape as the existing `!child.pid` branch. That closes the reaped-then-recycled pid path in every host. BLOCKING 2 — module doc overstates coverage. Rewritten: the ring is per-process and its only reader lives in Electron main, so a count on a `render-process-gone` covers main-issued kills only. Sites are now split into main-only, main-and- other-hosts (runProcess choke point, POSIX PTY group sweep, Windows Job Object — which record into a ring nothing reads when they run in the daemon or relay), and never-instrumented, with the note that a daemon/relay omission is a diagnostics gap, not a missed suspect, per the topology argument above. BLOCKING 3 — the three out-of-main instrumentation sites were untested. Added regression coverage: the runProcess seam on both branches plus the reaped-child refusal (process-tree-termination.test.ts), the group sweep recording only groups it actually signalled and skipping an ESRCH group (posix-pty-process-groups.test.ts), and the Job Object recording the shell pid only on `terminated` (windows-pty-job.test.ts). Verified red: reverting the three production files to origin/main fails 7 of the new tests. BLOCKING 4 — the Windows evidence validates a single-process model. Accepted. The main2.js arms exercise `pty-descendant-sweep` inside one Electron process; that models the in-process/degraded daemon and the local PTY provider, not the standalone daemon. Arm C's "the 449351d6 shape is not producible with the guard" holds for main-issued kills only. In the daemon the shape is blocked one layer earlier, by the ancestry check, which the arms do not exercise. NON-BLOCKING taken: `recordSelfInitiatedTreeKill` moved outside the native `terminateJob` try in windows-pty-job.ts, so a diagnostics throw can no longer downgrade a real termination to `unavailable` and escalate callers to a broader kill; covered by a test. The "all three families" parenthetical is gone with the doc rewrite. `pnpm build:relay` run: exit 0, all seven targets built. NON-BLOCKING declined: codex-accounts/service.ts records before the spawn because a refusal must prevent the spawn — the crumb means "we were about to kill this pid", which is the artifact worth having; the existing comment already says so. `app.getAppMetrics()` perf is unbenchmarked and unchanged by this round. Verification: pnpm tc clean; oxlint clean on touched paths; check:code-quality:changed 0 new findings; oxfmt applied. 730 tests pass across shared/child-process, main/crash-reporting, main/pty, main/windows and the guard and descendant-sweep suites. The 4 failures in providers/git/codex-integration reproduce on HEAD without these changes. * fix(crash-reporting): keep the reaped-pid skip from flipping the termination barrier The win32 hasExited short-circuit correctly avoids taskkill on a pid Windows may have reissued, but it resolved `true` — verified tree termination. A taskkill against a reaped pid already resolved `false`, and run-process turns `true` into barrierTerminationVerified + terminationReporter.report(), which releases the git admission grant on root exit instead of on `close`. That admits the next git command while a descendant holding the inherited pipes is still writing the repo. Resolve `false` so the skip changes only which process we refuse to signal, not what the barrier claims.

What
On Windows, an install tree can end up carrying an orphan AppContainer ACE — an
S-1-15-2-<x>entry left behind by an uninstalled/reset app package — with noALL RESTRICTED APPLICATION PACKAGES(S-1-15-2-2) grant to satisfy it. In that state Chromium's LPAC (Less Privileged AppContainer) children are denied read on the very modules Orca shipped with: the GPU and renderer children die at init with0x80000003, and once the GPU fallback engages--in-process-gputhe renderer dies on every load and the window stays blank forever. See electron/electron#51761.#15107already landed a read-only DACL probe that records this shape into the crash breadcrumb. This PR makes the app act on it:S-1-15-2-1or-2) as satisfying the orphan.S-1-15-2-1(ALL APPLICATION PACKAGES) is the Program Files inheritance default and is not in an LPAC child's token, so it satisfies nothing. The verdict now requiresS-1-15-2-2specifically (hasRestrictedPackageGrant), and the breadcrumb reports both flags.BUILTINwas in the "this icacls output is English" check, but fr-FR and es-ES printBUILTIN\Administrateurs/BUILTIN\Administradoresverbatim while localizing the package names. It is evidence of nothing, so it's dropped — a localized icacls is now correctly reported as un-name-checkable.windows-install-dir-package-acl-repair.ts): two additiveicacls /grantpasses (never/grant:r) — an inheritable(OI)(CI)(RX)on the install root so a later update inherits it, then a flagless(RX)/T /Cpass over existing entries. Marker-guarded inuserDatakeyed on install dir + app version, so it runs at most once per install/version even when it fails.renderer-recovery-prompt.ts): when the ACL diagnosis exists it names the real cause, adds a Copy Commands button that does not dismiss the dialog (the window is blank — dismissing it leaves no way back), re-reads the diagnosis each pass so an in-flight repair's outcome shows up, and keeps the graphics-driver hint as a fallback.The repair is gated three ways: win32 only, exempt in serve mode, and only on the exact probe verdict (
matchesPoisonSignature === true && wellKnownNameCheckReliable !== false).Fix evidence
Gate correctness — before/after on the
S-1-15-2-1-is-not-enough bugThe old gate line was
(f) => f.orphanPackageSids.length > 0 && !f.hasWellKnownPackageGrant. Reverting only that line in the working tree and re-running the two suites:expected [] to have a length of 2 but got +0is the bug stated exactly: on the most common poisoned shape — a Program Files install that inheritsALL APPLICATION PACKAGES:(RX)plus an orphanS-1-15-2-<x>— zeroicaclscalls were made. With the fix restored, the same command:Locale heuristic — before/after on the
BUILTINfalse positiveRe-adding
BUILTINtoENGLISH_PRINCIPALand re-running the same two suites:expected [ { …(3) }, { …(3) } ] to have a length of +0 but got 2is the false positive: a healthy French install (which carriesTOUS LES PACKAGES D'APPLICATION RESTREINTS) got twoicaclswrites and the accusatory dialog copy. WithBUILTINdropped, both go to zero.Final full run of every affected suite
Named cases in the new suites (verbatim from
--reporter=verbose):Gates
What I could NOT obtain — stated plainly
I did not have a Windows host in this session. No
icaclswas executed against a real DACL, and no Windows exit code was captured by me. Specifically:0x80000003child-death signature, the "10/10 launches" reproduction, and the win32 10.0.26200 / Electron 43.4.1 environment are carried over from the six 1.4.184 crash reports and [Bug] Electron apps crash with exit_code=-2147483645 (GPU process sandbox crash) when zombie SIDs exist in DACL electron/electron#51761 that motivated the already-merged probe (feat(crash-reporting): read-only Windows install-dir DACL probe breadcrumb #15107). I did not re-run them.icacls <file> /grant "*S-1-15-2-2:(OI)(CI)(RX)"exits 0, printsFailed processing 0 files, and writes no ACE — the reason the/Tpass must use the flagless(RX)— is documented in the module header from the original investigation. I did not independently verify it in this session. Every exit code in the test evidence above (code: 5,code: 0) is a value injected by the fakerunProcess, not a value returned by a realicacls.exe./T /Cwalk duration on a real packaged Windows install tree was likewise not measured here (see Perf review).Everything I did run — the before/after gate flips, the 64 passing tests,
pnpm tc, and the quality gate — is quoted verbatim above with its real exit code.ELI5
Windows lets a folder carry a "permission slip" naming a specific sandboxed app-container account. Sometimes an install folder ends up with a leftover slip naming an account that no longer exists, and none naming the sandbox account Orca's own helper processes actually run as. Windows then refuses to let Orca's own sandboxed helpers read Orca's own files. They crash instantly, the window never paints, and the app just sits there blank.
Orca already had a detector for this that only wrote it into the crash report. Now Orca fixes it: it adds one extra permission slip for the right account (adding only — it never removes anyone's existing access), and if it can't (because the folder needs an administrator), the "Orca keeps failing to load" dialog stops guessing "probably your graphics driver" and instead tells you exactly what's wrong with a Copy Commands button for the two commands to paste into an admin prompt.
The bug fixed along the way: the detector was accepting the wrong permission slip.
ALL APPLICATION PACKAGESsounds like it covers everything, but Orca's helpers run in a restricted container whose token doesn't include it — so the detector was calling the single most common broken install "fine" and doing nothing.Trade-offs
1. The change writes an ACL grant on the install directory, widening read access to restricted app packages.
This is real and is the point of the PR. Two additive
icacls /grantpasses addALL RESTRICTED APPLICATION PACKAGES (S-1-15-2-2)with(RX)— read + execute, no write — to the install root (inheritable) and to every existing entry beneath it. After this, any LPAC-sandboxed process on the machine, not just Orca's, can read and execute the contents of Orca's install directory.Why that's acceptable:
%APPDATA%, which is untouched (and is separately handled by the pre-existingensureWindowsUserDataAclGrant).S-1-15-2-2is a reduction ofS-1-15-2-1, not an expansion of it. A default Program Files install already grantsALL APPLICATION PACKAGES (S-1-15-2-1)(RX)on the whole tree by inheritance; every AppContainer holds-1, while only the restricted subset holds-2. So on a Program Files install this grant reaches a strictly smaller set of principals than the grant Windows itself already put there. On a per-user%LOCALAPPDATA%\Programsinstall it is a genuine widening, but still read-only over public binaries./grant:r. Both passes are purely additive: SYSTEM, Administrators, the user's own ACE — and the orphan ACE itself — all survive untouched. Removing someone else's ACE is not this code's business, and the orphan is a fingerprint worth keeping for diagnosis.2. What happens on a Program Files install without elevation.
It fails, by design, and the failure is visible rather than silent:
icaclsreturns non-zero (Access is denied) and/orFailed processing N files.runGrantclassifies both as failure, and the parsedfailedFileCountgoes into thewindows_install_dir_acl_repairbreadcrumb.userDataeven on failure, keyed on install dir + app version. A standard user on a Program Files install can never win, so re-spawningicaclson every single launch forever buys nothing. An update or a reinstall elsewhere changes the key and retries.describeInstallDirAclPoison()flips to"Orca could not repair them, which usually means the folder needs an administrator."and the dialog shows the two exact commands plus a Copy Commands button that keeps the dialog open.3. Other regressions and behavior changes.
isInstallDirAclPoisonVerdictrefuses to act whenwellKnownNameCheckReliable === false, because a localizedicaclsprints the restricted grant under a translated name the probe cannot match. A genuinely poisoned French/Spanish/etc. install therefore gets neither the automatic fix nor the specific dialog copy — it still sees the old generic "graphics-driver or installation problem" text. This is the deliberate choice to under-trigger rather than tell a healthy user their permissions are broken, but it means the population this PR helps is English-locale-only for now.cancelIdmoves from1to2when a diagnosis exists, so Esc still maps to Quit. Covered by thequits on the third button once the diagnosis adds onetest.isQuitting()becomes true. AshowMessageBoximplementation that returned Copy Commands unconditionally would loop forever; in production the response comes from a real user click, and theisQuitting()guard is re-checked every pass.icaclson a huge or network-mounted install directory could take a while. Bounded at 15s (root) and 120s (tree), off the critical path viasetImmediate, and never blocking window creation. See the perf note below on the 120s cap.Adversarial review
Number of review rounds until clean: 3
Round 1 — [major]
src/main/index.ts: the "manual retry is refused by the open breaker" premise is false.The reviewer found that
loadMainWindow(src/main/window/createMainWindow.ts:36) is nothing butmainWindow.loadURL(...)/mainWindow.loadFile(...)— it never consults the circuit breaker. The breaker is only consulted insidescheduleRendererRecovery's 250ms timer inmain-window-focus-lifecycle.ts. So theresetRecoveryWindowplumbing that had been added to "un-block" the manual retry was fixing a non-bug, and its actual effect was to re-arm three more automatic crash-reload cycles on a machine that had already proven it could not load.Resolution: finding accepted, reviewer was correct. All
resetRecoveryWindowplumbing was deleted fromindex.ts. The Reload button now callsloadMainWindowdirectly and leaves the breaker open, so a re-crash re-raises the prompt instead of resuming the silent auto-reload loop. A regression test pins exactly this:serves a manual retry while the breaker stays open for the next crashasserts 1 initial load + 3 recoveries, the 4th crash refused,loadMainWindowtaking the count to 5, and the next crash still refused (count stays 5) whileonRendererRecoveryExhaustedfires a second time.Round 2 — three [major] findings, all accepted and fixed.
ALL APPLICATION PACKAGES(S-1-15-2-1) as satisfying the orphan. The single most common poisoned shape — a Program Files install, which inheritsALL APPLICATION PACKAGES:(RX)by Windows default, plus an orphanS-1-15-2-<x>— was judged clean and the repair never ran. Fixed:collectAclFactsnow trackshasRestrictedPackageGrant(S-1-15-2-2/ALL RESTRICTED APPLICATION PACKAGES) separately fromhasWellKnownPackageGrant, andmatchesPoisonSignaturerides on the restricted flag alone. Both flags are reported in the breadcrumb. Pinned by three tests; the before/after for this is quoted verbatim in Fix evidence.describeInstallDirAclPoisonwas replacing the generic text with "Windows permissions on Orca's install folder are blocking..." plus adminicaclsinstructions, while discarding the probe'swellKnownNameCheckReliablesignal that exists precisely to flag this case. Fixed:isInstallDirAclPoisonVerdictnow requireswellKnownNameCheckReliable !== false, andBUILTINwas removed fromENGLISH_PRINCIPALbecause fr-FR/es-ES print it verbatim. A French fixture (FRENCH_BASELINE_ACES,FRENCH_RESTRICTED_PACKAGES_ACE) drives the test; before/after quoted verbatim in Fix evidence.src/main/index.tsfully reverted. It exercised pre-existingcreateMainWindow/loadMainWindowand asserted nothing about the diff, leaving the dialog loop, the third button,describeInstallDirAclPoison, and the probe→repair wiring untested. Fixed: the dialog body was extracted intosrc/main/window/renderer-recovery-prompt.tsbehind an injectableRendererRecoveryPromptDeps, with 7 tests covering both button layouts,cancelId, the copy-without-dismiss loop, the re-read-diagnosis-per-pass behavior, and the already-quitting no-op.windows-install-dir-acl-recovery.test.tswas added to drive the real probe into the real gate with only the two process seams faked, proving end-to-end whenicaclsdoes and does not run.Round 3 — clean. No new findings.
Perf review
Result: one finding (F1), accepted as real, deliberately not fixed in this PR. No other perf issues.
Baseline: this change adds literally zero work on the overwhelming majority of launches. On non-win32, in serve mode, and on any win32 machine that does not match the poison signature, there are no new spawns, timers, listeners, or fs I/O. Everything below concerns only a machine that has already matched the poison signature — i.e. a machine that is currently unable to open its window at all.
F1 — the
/Tinstall-tree ACL rewrite is far larger than the code's stated cost model, and it runs alongside the very first renderer load.windows-install-dir-package-acl-repair.ts:46justifies its 120s cap with:The "~80 entries" figure does not survive contact with a real tree. Measured in this worktree:
585 entries for the bare Electron dist alone, before
resources/,app.asar.unpacked, and bundled native modules — the reviewer's "~40x larger than the stated cost model" is directionally confirmed.icacls /Tis a synchronous per-entrySetNamedSecurityInfo, so the real walk is materially longer than 45ms.Why it is not fixed here:
runGrantresolves as soon asicaclsexits.setImmediateafterrepairWindowsInstallDirPackageAclhas already returned, so it never blocksopenMainWindowor window creation.timeoutverdict on a slow or contended volume, which would mark the attempt failed and prevent the retry the user actually needs.What I did not do: I did not measure
icacls /Tagainst a real packaged Windows install (no Windows host, per Fix evidence), so the true wall-clock figure is unknown to me. The honest state is that the comment's cost model is wrong and should be corrected, and that aperf(windows)follow-up should replace the guessed constant with a measured one. That is a comment-accuracy defect on a non-blocking, once-per-version path — not a reason to hold this crash fix.