Repository navigation
fix(crash-reporting): sample system memory before the process is gone - #18356
Conversation
…t present Round-1 review said the shipped field set could not decide G4-oom. Fixed. Decisive field (blocking #1). The investigation's own win-lowspec repro falsified "low available commit kills": at a 127 MB commit floor Windows grew the pagefile to 2029 MB and nothing died, and it named the missing datum — pagefile-growth headroom / system-drive free space. `getSystemMemoryInfo()` gives neither. Added `swap-volume-free-space.ts`: one `fs.statfs` on the volume backing the pagefile (SystemRoot on Windows, the root fs elsewhere, resolved via `path.parse().root`), published as `systemMemoryPreGoneSwapVolumeFreeMB`. Together with the already-emitted commit limit that separates "commit was low" from "commit was refused". Pagefile *max* size needs a registry read; skipped deliberately — per-operation interpreter spawning is exactly what docs/reference/windows-edr-posture.md says not to add for telemetry. Darwin honesty (blocking #2). Every reading now carries `systemMemoryPressureSignal`: `available-commit` on Windows (swapFree is ullAvailPageFile), `mem-available` on Linux when MemAvailable is present, `none` otherwise — which is always on darwin. A future analyst cannot now table `freeMB: 272` from a healthy Mac as evidence of exhaustion, because the same record says the platform gave no pressure verdict. Partial rebuttal on the suggested reuse: `host-memory.ts:86` was considered and rejected as a periodic source. It spawns `/usr/bin/memory_pressure` per call, and the sampler this PR needs runs every 10 s for the app's lifetime; a subprocess at that cadence is worse than the gap it closes. The reviewer conceded this tradeoff is arguable — what was not acceptable was shipping the darwin gap silently, so it is now in the data, not only in a comment. Staleness (blocking #3). Confirmed the measurement: four of five G4 reports carried a ~37 s-old sample (4872/36796/37332/38017/39715 ms). Host memory no longer rides the 60 s process-metrics sweep; `pre-gone-host-memory.ts` samples it on its own 10 s timer with its own `systemMemoryPreGoneSampleAgeMs`. One GlobalMemoryStatusEx-class call plus one statfs is cheap enough at that rate. A refusal shorter than the interval stays invisible and the module comment says so — no polling cadence fixes that. Non-blocking, all taken: renamed `gone-time-system-memory.ts` -> `system-memory-details.ts` with the now-false "reads AFTER the crash" framing scoped to the gone-time caller; pre-gone host keys moved out of the `processMetrics` namespace to `systemMemoryPreGone*`, so the string-surgery `preGoneDetailKey` helper is gone and a `systemMemory` prefix scan sees both reads; the bare catch no longer spans both halves of the sample, and a test pins that a throwing host read leaves the process-metric sample intact; the inert second test is replaced by three that go red without this change (verified: swap-volume, pressure-signal and cadence assertions all fail when the production hunks are reverted). Rebuttal, non-blocking #5 (duplicated electron mock across two test files): declined. `vi.mock` is hoisted per file, so the mock cannot be shared without a setup module, and this directory already has 26 focused test files that each re-declare it. Splitting by concern is the local convention. `startPreGoneProcessMetricsSampling` is renamed `startPreGoneCrashSampling` since it now starts two samplers.
…the host read Round-2 review blocked on four items. All four addressed. WHAT THIS BRANCH ACTUALLY DOES, AT HEAD (blocking #4). The commit-1 message ("13 lines, 1 production file, no new module, new optional numeric fields only", `processMetricsPreGoneSystemMemory*` keys, a `preGoneDetailKey` helper, a `pre-gone-system-memory.test.ts`) describes a superseded revision; every one of those claims is false now, so it must not be used as the PR description. The change against origin/main is: 3 new production modules (`pre-gone-host-memory.ts`, `system-memory-details.ts`, `swap-volume-free-space.ts`), 1 deleted (`gone-time-system-memory.ts`), plus edits to `process-gone-diagnostics.ts` and `main-process-ready-runtime.ts` and 2 test files. It adds a second main-process interval timer that runs for the life of the app: every 10 s one synchronous GlobalMemoryStatusEx-class read, and on win32/darwin one `fs.statfs` on the swap-backing volume. Details are `systemMemoryPreGone*`, and two of them are STRINGS, not numbers: `systemMemoryPreGonePressureSignal` (enum) and `systemMemoryPreGoneSwapVolume` (a drive label, separator-trimmed so it is not a path). Both are assigned after `sanitizeCrashReportDetails`; neither carries user content. Arming is now tested (blocking #1). The reviewer deleted `startPreGoneSystemMemorySampling(...)` from `startPreGoneCrashSampling` and all 264 tests stayed green — confirmed and fixed. `pre-gone-host-memory.test.ts` now calls `startPreGoneCrashSampling()` with production defaults and asserts both `setInterval` calls, their literal periods `[60_000, 10_000]`, that both timers are unref'd, and that advancing 10 s takes a fresh host sample that reaches `buildProcessGoneCrashDetails` with `SampleAgeMs: 0`. Verified red on revert: deleting the arming line -> 1 failure; changing the interval constant to 30_000 -> 1 failure (the old assertion compared the constant to itself and caught neither). The tautological `10_000 < 60_000 / 2` test is gone, superseded by this one. Swap volume is win32/darwin only (blocking #2). On Linux swap is a fixed partition, a fixed-size swapfile, or zram; none grow into root-fs free space, so `SwapVolumeFreeMB: 380000` beside `SwapFreeMB: 0` would have invited exactly the wrong verdict on the two Linux cluster members. `swapVolumeAnchor` returns undefined off win32/darwin, so no field and no statfs at all. The comment claiming "elsewhere swap is on the root fs" was wrong and is gone. The Windows anchor is still the DEFAULT pagefile volume, so the measured volume now ships with the number (`systemMemoryPreGoneSwapVolume: 'C:'`) instead of being implied. The honesty label covers it: win32 reads `available-commit` only when the volume datum is present, and `available-commit-unqualified` otherwise — which also fixes non-blocking #5, where the synchronous gone-time read claimed a verdict its own fields could not support. Host read no longer waits on statfs (blocking #3). `samplePreGoneSystemMemory` now commits the synchronous memory reading first and merges volume free space in afterwards, so the cadence is 10 s regardless of disk-metadata latency and a hung volume can no longer stop host sampling — precisely the paging-storm case this exists for. The in-flight latch now guards only the statfs. Verified red on revert to the serialized shape (2 failures). A stale-but-slow-moving volume value merging into a newer memory sample is deliberate and commented. Non-blocking #3 (reset does not invalidate an in-flight sample): fixed with a generation counter bumped by `resetPreGoneSystemMemorySamplingForTest`, so a late statfs cannot repopulate a reset sample. Separately, the volume read now only runs after a host sample committed, which removes the real `statfs('/')` side effect from `process-gone-diagnostics.test.ts` entirely. REBUTTAL, darwin `memory_pressure` reuse (non-blocking #2): declined, with evidence. `readDarwinAvailableMemory` at src/main/memory/host-memory.ts:87 is reached only via `collectHostMemory` <- `runSnapshot` <- `collectMemorySnapshot`, whose only callers are the `memory:getSnapshot` IPC handler and orca-runtime-pty-foreground-process-reads.ts:170 — both on demand. There is no periodic snapshot, so there is no cached reading to reuse for free; adopting it means spawning `/usr/bin/memory_pressure` on a main-process timer for the life of the app, and its module-global `darwinAvailabilitySupported` latch is shared with the memory UI. The gap is not hidden: darwin ships `PressureSignal: 'none'` in the data, and the module comment now cites the existing reader and why it is not used here rather than claiming Orca lacks one. Verified: `vitest src/main/crash-reporting src/main/startup src/main/memory` = 769 passed / 6 skipped (crash-reporting re-run 5x, no flake); `tsc --noEmit -p config/tsconfig.node.json` 0; `oxlint` 0; `oxfmt --check` 0.
📝 WalkthroughWalkthroughThe change replaces gone-time system memory capture with pre-gone host sampling. It adds platform-aware system memory details and swap-volume free-space reporting. A separate 10-second sampler caches host readings and asynchronously enriches them with volume data. Process-gone crash details now include current and pre-gone memory data. Startup uses the renamed sampling API. Tests cover platform signals, timer behavior, asynchronous reads, failure handling, and detail-key isolation. Merge Risk: 🔵 Low · up to This diagnostic change adds pre-exit host memory data to crash reports, but Windows reports may overstate available commit capacity when a pagefile is located on another volume. The impact is limited to crash-diagnostic interpretation. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description provides detailed ELI5, change rationale, testing evidence, trade-offs, limitations, and follow-ups. However, it omits required template items, including a linked issue under "Linked Issue", the exact Resolution Add a valid linked issue after
✨ 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 |
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: 1964b8a9-eb9a-472d-9e31-645ba9c3ca80
📒 Files selected for processing (8)
src/main/crash-reporting/gone-time-system-memory.tssrc/main/crash-reporting/pre-gone-host-memory.test.tssrc/main/crash-reporting/pre-gone-host-memory.tssrc/main/crash-reporting/process-gone-diagnostics.test.tssrc/main/crash-reporting/process-gone-diagnostics.tssrc/main/crash-reporting/swap-volume-free-space.tssrc/main/crash-reporting/system-memory-details.tssrc/main/startup/main-process-ready-runtime.ts
💤 Files with no reviewable changes (1)
- src/main/crash-reporting/gone-time-system-memory.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| [`${SYSTEM_MEMORY_KEY_PREFIX}SwapVolumeFreeMB`]: volume.freeMB, | ||
| [`${SYSTEM_MEMORY_KEY_PREFIX}SwapVolume`]: volume.volume | ||
| } | ||
| merged[`${SYSTEM_MEMORY_KEY_PREFIX}PressureSignal`] = pressureSignal(platform, merged) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Keep the Windows pressure signal unqualified until the pagefile volume is known.
Line 129 sets available-commit when the sampler measures SystemRoot or SystemDrive. That is only the default pagefile volume. A relocated pagefile can lack growth space while the measured volume has free space. This makes systemMemoryPressureSignal assert a qualified condition that was not established.
Keep available-commit-unqualified unless the reader identifies an active growable pagefile volume. Update the related assertion in src/main/crash-reporting/pre-gone-host-memory.test.ts.
Proposed fix
- merged[`${SYSTEM_MEMORY_KEY_PREFIX}PressureSignal`] = pressureSignal(platform, merged)
+ // The measured default volume does not prove the active pagefile location.
+ merged[`${SYSTEM_MEMORY_KEY_PREFIX}PressureSignal`] = pressureSignal(platform, details)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| merged[`${SYSTEM_MEMORY_KEY_PREFIX}PressureSignal`] = pressureSignal(platform, merged) | |
| // The measured default volume does not prove the active pagefile location. | |
| merged[`${SYSTEM_MEMORY_KEY_PREFIX}PressureSignal`] = pressureSignal(platform, details) |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Live pre-gone host-memory sampler —
pre-gone-host-memory.tsadds anunref'd 10 s interval that commits the synchronousprocess.getSystemMemoryInfo()read before awaiting the volume statfs, publishingsystemMemoryPreGone*details plus a sample-age field. The in-flight latch andsamplingGenerationguard keep a slow/hungstatfsfrom stalling or corrupting the cheap host read. - Swap-volume free space —
swap-volume-free-space.tsmeasures the volume the pagefile/swapfile grows into (win32 viaSystemRoot/SystemDriveroot, darwin via/), emitted assystemMemoryPreGoneSwapVolumeFreeMB+ the measured drive label. Linux is deliberately excluded. - Pressure-signal taxonomy —
system-memory-details.ts(renamed fromgone-time-system-memory.ts) tags every reading withsystemMemoryPressureSignal(available-commit/available-commit-unqualified/mem-available/none), upgraded from-unqualifiedonce the volume datum merges in. - Startup arming —
startPreGoneProcessMetricsSamplingbecomesstartPreGoneCrashSampling, arming both samplers;buildProcessGoneCrashDetailsappends the pre-gone host details.
The rename is clean (no stale references to getSystemMemoryAtGoneDetails, startPreGoneProcessMetricsSampling, or gone-time-system-memory), the platform semantics match Electron's SystemMemoryInfo surface (swapTotal/swapFree win32/linux only, available linux, fileBacked/purgeable darwin), the new string fields are fixed-enum or drive-label values with no user content, and the tests assert literal interval values and exact counts (not tautologies). Verified: 690 tests pass across src/main/crash-reporting/ and src/main/startup/; oxlint clean.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Round-3 adversarial review, 2 blocking. Both fixed with mutation-verified
tests.
1. `mergeSwapVolumeFreeSpace` merged the volume reading into whatever sample
was current at RESOLUTION time, and `pressureSignal` then upgraded win32
from `available-commit-unqualified` to the decisive `available-commit` on
the strength of it. The `swapVolumeReadInFlight` latch makes every
intervening tick skip the merge, so the lag is as old as the last STARTED
statfs, not the last tick — and no age field exposed it, because
`systemMemoryPreGoneSampleAgeMs` describes only the synchronous memory read.
Reviewer's executed scenario: a statfs issued at t=0 on a healthy host
(40 GB free) resolving at t=20 s of commit pressure emitted
`SwapFreeMB: 200` beside `SwapVolumeFreeMB: 40000`, labelled
`available-commit`, with `SampleAgeMs: 0`. That reads as "the pagefile had
room, so this was not a commit refusal" — the opposite conclusion, wearing
the branch's highest-confidence label, on exactly the win32 G4-oom reports
this exists to decide.
The datum still ships (it is the only pagefile-expandability signal there
is), but now:
- the sample carries `swapVolumeSampledAtMs` — the tick that ISSUED the
statfs, never the one it resolved on — surfaced as
`systemMemoryPreGoneSwapVolumeAgeMs`;
- only a statfs that answers on its own tick may qualify the verdict.
`withSwapVolumeFreeSpace` takes `coTimed`; false keeps
`available-commit-unqualified`.
The next tick issues a fresh statfs, so the verdict recovers on its own.
2. The branch's sole production entry point — `startPreGoneCrashSampling()` at
main-process-ready-runtime.ts:128 — was untested. Deleting it left 691
tests across crash-reporting/ and startup/ green, while a comment in the
new test file claimed that gap was why the test was written. This is pure
instrumentation, so that one line is the whole of its value in the shipped
app. Added a source-level wiring test (the pattern this repo already uses
for arm-once ready-phase lines) that pins the import, exactly one call, the
call at statement indent, and that `main-process-ready.ts` awaits the
function it lives in. The misleading comment is gone.
Mutation-verified — each goes red alone:
coTimed -> always true 1 failed (verdict)
drop swapVolumeSampledAtMs age 1 failed (verdict test)
delete startPreGoneCrashSampling() 1 failed (wiring)
wrap it in `if (!is.dev) { ... }` 1 failed (wiring)
Verified: tsc -p config/tsconfig.node.json exit 0; oxlint
src/main/crash-reporting src/main/startup exit 0; 268 tests in
crash-reporting/ pass. Across crash-reporting/ + startup/ + memory/: 769
passed, 2 failed — both environment-dependent and failing identically on the
unmodified tree (Xvfb rebind, and a whole-repo glob census that times out).
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Co-timed verdict gating —
mergeSwapVolumeFreeSpacenow capturesissuedFor = preGoneSamplebefore theawait, then computescoTimed = preGoneSample === issuedFor, so astatfsthat outlived the tick that issued it can no longer promote the win32 verdict pastavailable-commit-unqualified. - Per-sample volume age — the sample now stamps
swapVolumeSampledAtMs(the tick that issued the statfs, never the one it resolved on) andpreGoneSystemMemoryDetailspublishessystemMemoryPreGoneSwapVolumeAgeMs, so an out-of-band volume read carries its own staleness instead of masquerading as fresh. - Regression coverage — a new test drives a hung statfs across two ticks, asserts the stale volume ships with its own age and an unqualified verdict, then asserts the next tick's co-timed read recovers to
available-commit; a source-level test pins the singlestartPreGoneCrashSampling()arming call and its import in the ready-phase composition.
The object-identity comparison is the right tool here: commitHostMemorySample allocates a fresh sample object per successful tick, so identity change is exactly "a newer memory reading displaced the one the statfs was issued for". The stale-merge path still ships the volume datum but degrades the verdict rather than inverting it, matching the fail-safe intent from round 3. Verified: src/main/crash-reporting/ 268 tests pass, oxlint clean on the touched files.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…lity The win32 reading was promoted to the decisive `available-commit` whenever a co-timed volume number merely existed, which the data cannot support: a fixed or disabled pagefile grows into no amount of empty disk, its maximum is unreadable here, and the measured volume is only the DEFAULT pagefile drive. A host with 180 MB of available commit, a commit limit at RAM and 812 GB free read as "the pagefile had room" — the opposite conclusion, under the branch's most confident label. The volume datum is now named for what it is (`available-commit-volume-cotimed`, context beside the commit number), and the one decisive win32 case — a commit limit at or below RAM, i.e. no pagefile behind it — gets its own label. Also: carry the last volume reading onto the sample that replaces it, aged and non-qualifying, so a statfs slower than one tick no longer makes the field vanish from the reports it exists for; don't commit a reading whose every memory field failed, which shipped an age and a disk-free number with no host memory beside them; and move the startup wiring test beside the file it pins, scoped to the ready-phase entry's own body so the call cannot satisfy it from a sibling export nothing calls.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Split the win32 pressure signal — the single
available-commitverdict is now two values:available-commit-hard-capped(commit limit at or below RAM, so no pagefile exists to grow into — the one decisive case) andavailable-commit-volume-cotimed(a co-timed volume datum that is context beside the commit number, never a verdict), with a newpagefileBacksCommithelper comparingswapTotal > total. - Carried swap-volume reading —
withCarriedSwapVolumekeeps a slow/hungstatfsfrom making the swap-volume field vanish on the tick that replaces the sample: the last reading rides forward at its trueswapVolumeSampledAtMs, and because it merges withcoTimed = falseit can never re-qualify the label. - Empty-reading guard —
commitHostMemorySamplenow rejects a reading whose only key is the unconditionally-appendedsystemMemoryPressureSignal, so a field-less read no longer ships an age plus a disk-free figure with no memory numbers beside them. - Wiring test relocated and scoped — moved to
src/main/startup/pre-gone-crash-sampling-wiring.test.tsbeside its target, asserting the singlestartPreGoneCrashSampling()call inside theinitializeReadyRuntimeServicesbody rather than a whole-file grep.
The swapTotal <= total ⟹ "no pagefile" inference matches ullTotalPageFile = RAM + pagefile semantics, degrades safely to available-commit-unqualified when either field is absent, and stays conservative the other way (a pagefile that is merely fixed-size and full still reads as unqualified, not hard-capped). Verified: 271 tests pass across src/main/crash-reporting/ plus the wiring test.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
A tick whose host read fails leaves the pre-gone sample object in place, so the identity check still read a 25 s-late statfs as co-timed.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the single commit since the last review tightens the statfs co-timing guard.
- Tick-based co-timing —
mergeSwapVolumeFreeSpacenow compares the statfs's issuing tick against a monotonicsampleTick(incremented on everysamplePreGoneSystemMemorycall, including ones whose host read fails) instead of sample-object identity. A stale statfs can no longer read asavailable-commit-volume-cotimedwhen intervening ticks left the sample object untouched. - Regression test — a new test drives a hung statfs across two failed host reads and asserts the verdict degrades to
available-commit-unqualifiedwith the volume's true 25 s age.
The fix is correct and matches its stated intent: sampleTick advances on every sampling call, so issuedOnTick === sampleTick holds only when the statfs resolved with no intervening tick. The resetPreGoneSystemMemorySamplingForTest path correctly leaves the counter untouched (the generation guard already blocks cross-reset merges, and monotonicity is exactly what makes the equality test sound). Verified pre-gone-host-memory.test.ts passes (12 tests).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…stablyai#18356) * fix(crash-reporting): sample system memory before the renderer dies * fix(crash-reporting): make the pre-gone host sample decisive, not just present Round-1 review said the shipped field set could not decide G4-oom. Fixed. Decisive field (blocking stablyai#1). The investigation's own win-lowspec repro falsified "low available commit kills": at a 127 MB commit floor Windows grew the pagefile to 2029 MB and nothing died, and it named the missing datum — pagefile-growth headroom / system-drive free space. `getSystemMemoryInfo()` gives neither. Added `swap-volume-free-space.ts`: one `fs.statfs` on the volume backing the pagefile (SystemRoot on Windows, the root fs elsewhere, resolved via `path.parse().root`), published as `systemMemoryPreGoneSwapVolumeFreeMB`. Together with the already-emitted commit limit that separates "commit was low" from "commit was refused". Pagefile *max* size needs a registry read; skipped deliberately — per-operation interpreter spawning is exactly what docs/reference/windows-edr-posture.md says not to add for telemetry. Darwin honesty (blocking stablyai#2). Every reading now carries `systemMemoryPressureSignal`: `available-commit` on Windows (swapFree is ullAvailPageFile), `mem-available` on Linux when MemAvailable is present, `none` otherwise — which is always on darwin. A future analyst cannot now table `freeMB: 272` from a healthy Mac as evidence of exhaustion, because the same record says the platform gave no pressure verdict. Partial rebuttal on the suggested reuse: `host-memory.ts:86` was considered and rejected as a periodic source. It spawns `/usr/bin/memory_pressure` per call, and the sampler this PR needs runs every 10 s for the app's lifetime; a subprocess at that cadence is worse than the gap it closes. The reviewer conceded this tradeoff is arguable — what was not acceptable was shipping the darwin gap silently, so it is now in the data, not only in a comment. Staleness (blocking stablyai#3). Confirmed the measurement: four of five G4 reports carried a ~37 s-old sample (4872/36796/37332/38017/39715 ms). Host memory no longer rides the 60 s process-metrics sweep; `pre-gone-host-memory.ts` samples it on its own 10 s timer with its own `systemMemoryPreGoneSampleAgeMs`. One GlobalMemoryStatusEx-class call plus one statfs is cheap enough at that rate. A refusal shorter than the interval stays invisible and the module comment says so — no polling cadence fixes that. Non-blocking, all taken: renamed `gone-time-system-memory.ts` -> `system-memory-details.ts` with the now-false "reads AFTER the crash" framing scoped to the gone-time caller; pre-gone host keys moved out of the `processMetrics` namespace to `systemMemoryPreGone*`, so the string-surgery `preGoneDetailKey` helper is gone and a `systemMemory` prefix scan sees both reads; the bare catch no longer spans both halves of the sample, and a test pins that a throwing host read leaves the process-metric sample intact; the inert second test is replaced by three that go red without this change (verified: swap-volume, pressure-signal and cadence assertions all fail when the production hunks are reverted). Rebuttal, non-blocking stablyai#5 (duplicated electron mock across two test files): declined. `vi.mock` is hoisted per file, so the mock cannot be shared without a setup module, and this directory already has 26 focused test files that each re-declare it. Splitting by concern is the local convention. `startPreGoneProcessMetricsSampling` is renamed `startPreGoneCrashSampling` since it now starts two samplers. * fix(crash-reporting): test the arming, gate the swap volume, unblock the host read Round-2 review blocked on four items. All four addressed. WHAT THIS BRANCH ACTUALLY DOES, AT HEAD (blocking stablyai#4). The commit-1 message ("13 lines, 1 production file, no new module, new optional numeric fields only", `processMetricsPreGoneSystemMemory*` keys, a `preGoneDetailKey` helper, a `pre-gone-system-memory.test.ts`) describes a superseded revision; every one of those claims is false now, so it must not be used as the PR description. The change against origin/main is: 3 new production modules (`pre-gone-host-memory.ts`, `system-memory-details.ts`, `swap-volume-free-space.ts`), 1 deleted (`gone-time-system-memory.ts`), plus edits to `process-gone-diagnostics.ts` and `main-process-ready-runtime.ts` and 2 test files. It adds a second main-process interval timer that runs for the life of the app: every 10 s one synchronous GlobalMemoryStatusEx-class read, and on win32/darwin one `fs.statfs` on the swap-backing volume. Details are `systemMemoryPreGone*`, and two of them are STRINGS, not numbers: `systemMemoryPreGonePressureSignal` (enum) and `systemMemoryPreGoneSwapVolume` (a drive label, separator-trimmed so it is not a path). Both are assigned after `sanitizeCrashReportDetails`; neither carries user content. Arming is now tested (blocking stablyai#1). The reviewer deleted `startPreGoneSystemMemorySampling(...)` from `startPreGoneCrashSampling` and all 264 tests stayed green — confirmed and fixed. `pre-gone-host-memory.test.ts` now calls `startPreGoneCrashSampling()` with production defaults and asserts both `setInterval` calls, their literal periods `[60_000, 10_000]`, that both timers are unref'd, and that advancing 10 s takes a fresh host sample that reaches `buildProcessGoneCrashDetails` with `SampleAgeMs: 0`. Verified red on revert: deleting the arming line -> 1 failure; changing the interval constant to 30_000 -> 1 failure (the old assertion compared the constant to itself and caught neither). The tautological `10_000 < 60_000 / 2` test is gone, superseded by this one. Swap volume is win32/darwin only (blocking stablyai#2). On Linux swap is a fixed partition, a fixed-size swapfile, or zram; none grow into root-fs free space, so `SwapVolumeFreeMB: 380000` beside `SwapFreeMB: 0` would have invited exactly the wrong verdict on the two Linux cluster members. `swapVolumeAnchor` returns undefined off win32/darwin, so no field and no statfs at all. The comment claiming "elsewhere swap is on the root fs" was wrong and is gone. The Windows anchor is still the DEFAULT pagefile volume, so the measured volume now ships with the number (`systemMemoryPreGoneSwapVolume: 'C:'`) instead of being implied. The honesty label covers it: win32 reads `available-commit` only when the volume datum is present, and `available-commit-unqualified` otherwise — which also fixes non-blocking stablyai#5, where the synchronous gone-time read claimed a verdict its own fields could not support. Host read no longer waits on statfs (blocking stablyai#3). `samplePreGoneSystemMemory` now commits the synchronous memory reading first and merges volume free space in afterwards, so the cadence is 10 s regardless of disk-metadata latency and a hung volume can no longer stop host sampling — precisely the paging-storm case this exists for. The in-flight latch now guards only the statfs. Verified red on revert to the serialized shape (2 failures). A stale-but-slow-moving volume value merging into a newer memory sample is deliberate and commented. Non-blocking stablyai#3 (reset does not invalidate an in-flight sample): fixed with a generation counter bumped by `resetPreGoneSystemMemorySamplingForTest`, so a late statfs cannot repopulate a reset sample. Separately, the volume read now only runs after a host sample committed, which removes the real `statfs('/')` side effect from `process-gone-diagnostics.test.ts` entirely. REBUTTAL, darwin `memory_pressure` reuse (non-blocking stablyai#2): declined, with evidence. `readDarwinAvailableMemory` at src/main/memory/host-memory.ts:87 is reached only via `collectHostMemory` <- `runSnapshot` <- `collectMemorySnapshot`, whose only callers are the `memory:getSnapshot` IPC handler and orca-runtime-pty-foreground-process-reads.ts:170 — both on demand. There is no periodic snapshot, so there is no cached reading to reuse for free; adopting it means spawning `/usr/bin/memory_pressure` on a main-process timer for the life of the app, and its module-global `darwinAvailabilitySupported` latch is shared with the memory UI. The gap is not hidden: darwin ships `PressureSignal: 'none'` in the data, and the module comment now cites the existing reader and why it is not used here rather than claiming Orca lacks one. Verified: `vitest src/main/crash-reporting src/main/startup src/main/memory` = 769 passed / 6 skipped (crash-reporting re-run 5x, no flake); `tsc --noEmit -p config/tsconfig.node.json` 0; `oxlint` 0; `oxfmt --check` 0. * fix(crash-reporting): stop a stale statfs qualifying the commit verdict Round-3 adversarial review, 2 blocking. Both fixed with mutation-verified tests. 1. `mergeSwapVolumeFreeSpace` merged the volume reading into whatever sample was current at RESOLUTION time, and `pressureSignal` then upgraded win32 from `available-commit-unqualified` to the decisive `available-commit` on the strength of it. The `swapVolumeReadInFlight` latch makes every intervening tick skip the merge, so the lag is as old as the last STARTED statfs, not the last tick — and no age field exposed it, because `systemMemoryPreGoneSampleAgeMs` describes only the synchronous memory read. Reviewer's executed scenario: a statfs issued at t=0 on a healthy host (40 GB free) resolving at t=20 s of commit pressure emitted `SwapFreeMB: 200` beside `SwapVolumeFreeMB: 40000`, labelled `available-commit`, with `SampleAgeMs: 0`. That reads as "the pagefile had room, so this was not a commit refusal" — the opposite conclusion, wearing the branch's highest-confidence label, on exactly the win32 G4-oom reports this exists to decide. The datum still ships (it is the only pagefile-expandability signal there is), but now: - the sample carries `swapVolumeSampledAtMs` — the tick that ISSUED the statfs, never the one it resolved on — surfaced as `systemMemoryPreGoneSwapVolumeAgeMs`; - only a statfs that answers on its own tick may qualify the verdict. `withSwapVolumeFreeSpace` takes `coTimed`; false keeps `available-commit-unqualified`. The next tick issues a fresh statfs, so the verdict recovers on its own. 2. The branch's sole production entry point — `startPreGoneCrashSampling()` at main-process-ready-runtime.ts:128 — was untested. Deleting it left 691 tests across crash-reporting/ and startup/ green, while a comment in the new test file claimed that gap was why the test was written. This is pure instrumentation, so that one line is the whole of its value in the shipped app. Added a source-level wiring test (the pattern this repo already uses for arm-once ready-phase lines) that pins the import, exactly one call, the call at statement indent, and that `main-process-ready.ts` awaits the function it lives in. The misleading comment is gone. Mutation-verified — each goes red alone: coTimed -> always true 1 failed (verdict) drop swapVolumeSampledAtMs age 1 failed (verdict test) delete startPreGoneCrashSampling() 1 failed (wiring) wrap it in `if (!is.dev) { ... }` 1 failed (wiring) Verified: tsc -p config/tsconfig.node.json exit 0; oxlint src/main/crash-reporting src/main/startup exit 0; 268 tests in crash-reporting/ pass. Across crash-reporting/ + startup/ + memory/: 769 passed, 2 failed — both environment-dependent and failing identically on the unmodified tree (Xvfb rebind, and a whole-repo glob census that times out). * fix(crash-reporting): stop free disk standing in for pagefile growability The win32 reading was promoted to the decisive `available-commit` whenever a co-timed volume number merely existed, which the data cannot support: a fixed or disabled pagefile grows into no amount of empty disk, its maximum is unreadable here, and the measured volume is only the DEFAULT pagefile drive. A host with 180 MB of available commit, a commit limit at RAM and 812 GB free read as "the pagefile had room" — the opposite conclusion, under the branch's most confident label. The volume datum is now named for what it is (`available-commit-volume-cotimed`, context beside the commit number), and the one decisive win32 case — a commit limit at or below RAM, i.e. no pagefile behind it — gets its own label. Also: carry the last volume reading onto the sample that replaces it, aged and non-qualifying, so a statfs slower than one tick no longer makes the field vanish from the reports it exists for; don't commit a reading whose every memory field failed, which shipped an age and a disk-free number with no host memory beside them; and move the startup wiring test beside the file it pins, scoped to the ready-phase entry's own body so the call cannot satisfy it from a sibling export nothing calls. * fix(crash-reporting): co-time the statfs by tick, not sample identity A tick whose host read fails leaves the pre-gone sample object in place, so the identity check still read a 25 s-late statfs as co-timed.

What
Five field crash reports form cluster G4-oom: Windows renderer OOM, exit
-536870904/0xE0000008. Real app-version distribution is 3× 1.4.194, 1× 1.4.195, 1× 1.4.188 (1.4.195_ffe54f6dself-reportsApp version: 1.4.188— the filename carries the reporting version, not the crashing one). All five are win32. Widening to the reports that share the shape — host reading at or near exhaustion with a normally-sized renderer — pulls in 5 more from G2-killed and G8-misc-crashed, spanning win32, darwin and linux/arm, so 10 reports across 3 OSes.None of them can be decided, and the reason is a diagnostic gap, not a missing counter:
src/main/crash-reporting/process-gone-diagnostics.ts:274(onmain) —getSystemMemoryAtGoneDetails()is the only system-memory read, and it fires inside theprocess-gonehandler, i.e. after the corpse returned its pages.src/main/crash-reporting/gone-time-system-memory.ts:7-8(onmain) admits it in the repo's own words: "this reads AFTER the crashed process's memory returned to the OS, so free/swapFree can look healthier than they were at kill time."src/main/crash-reporting/process-gone-diagnostics.ts:194-205(onmain) — the existing 60 s pre-gone sampler recordsapp.getAppMetrics()only. No host memory.That matters here because the dead renderer returns 240-642 MB to the OS, which is the same order of magnitude as the entire remaining host headroom in 9 of the 10 reports. "The machine had 300 MB left while we were alive" and "the machine had 900 MB left and we died for another reason" produce an identical crash report today.
The change adds a second pre-gone sampler that carries a live host reading into the crash report:
src/main/crash-reporting/pre-gone-host-memory.ts(new) — its own 10 ssetInterval,unref'd, armed at startup. PublishessystemMemoryPreGone*alongside its ownsystemMemoryPreGoneSampleAgeMs. 10 s and not the 60 s metric sweep because the sweep is measurably too stale:processMetricsPreGoneSampleAgeMsin the five G4 reports is 4872 / 36796 / 37332 / 38017 / 39715 ms — four of five carry a ~37 s-old sample, which cannot see a transient allocation refusal.src/main/crash-reporting/swap-volume-free-space.ts(new) — onefs.statfson the volume backing the pagefile/swapfile, published assystemMemoryPreGoneSwapVolumeFreeMB, the volume that was measured, andsystemMemoryPreGoneSwapVolumeAgeMs(its own age — it resolves out of band, so it can be older than the memory numbers beside it, and the last reading is carried onto later samples rather than dropped). It is a necessary condition the investigation named — at a 127 MB available-commit floor on a Windows VM, Windows grew the pagefile to 2029 MB and nothing died — but it is not sufficient, and round 4 stopped it being labelled as if it were: a fixed-size or disabled pagefile grows into no amount of empty disk. win32 and darwin only — Linux swap is a fixed partition, a fixed-size swapfile, or zram, none of which grow into root-fs free space. It is context, not a verdict, and round 5 measured what that is worth: across all 30 win32 reports in/tmp/ct/clusters(G4-oom + G2-killed + G8-misc-crashed)swapTotal/totalruns 1.06x-3.02x, never at or below 1.0 — so the one decisive label this PR can emit,available-commit-hard-capped, would have fired on zero of the machines this PR was built from. What the statfs buys is therefore narrower than 'decide the cluster': it is (a) the falsifier — a low-commit report that also shows a nearly-full pagefile volume is the one shape that survives the failed repro, and nothing in today's reports can show it; (b) the hard-capped case, rare in this sample but the only unambiguous refusal Windows exposes without a registry read; and (c) the number an analyst needs to rule out disk exhaustion, which today they must guess at. If the next batch shows the same 1.06x-3.02x band with roomy volumes, that is itself the answer — commit refusal is not the mechanism — and the statfs should then be removed rather than kept.src/main/crash-reporting/system-memory-details.ts(renamed fromgone-time-system-memory.ts) — every reading now carriessystemMemoryPressureSignal, which never claims more than the platform's data supports:available-commit-hard-capped(win32 whose commit limit is at or below RAM, i.e. no pagefile behind it, so the floor cannot heal — the one decisive win32 case, and not expected to fire on the observed fleet: all 30 win32 field reports sit atswapTotal1.06x-3.02xtotal. Its arithmetic is also slightly loose —totalisullTotalPhyswhile the commit limit's RAM contribution is 1-2% lower for kernel reserve, so a fixed pagefile smaller than that gap also gets the label; the downstream reading, 'this floor cannot heal', holds for a fixed pagefile too, so it is naming imprecision, not a wrong verdict),available-commit-volume-cotimed(win32 with a volume datum read on the same tick as the commit number — context beside it, not proof the pagefile could grow; see round 4),available-commit-unqualified(win32 with no co-timed volume datum),mem-available(linux with MemAvailable),noneotherwise — which is always on darwin, wherefree/fileBacked/purgeableanswer reclaimability and never pressure.process-gone-diagnostics.ts/main-process-ready-runtime.ts—startPreGoneProcessMetricsSamplingbecomesstartPreGoneCrashSamplingand arms both samplers.This PR does not fix a leak and does not prevent a crash. It is a decidability change: the next batch of these reports carries a host reading taken while the renderer was alive, plus a same-tick reading of the volume the pagefile lives on. That volume number is context, not a verdict (round 4), and the only growability verdict the branch emits,
available-commit-hard-capped, matches none of the 30 win32 reports on hand (round 5). So the honest claim is narrower than "separates low commit from refused commit": the reports become falsifiable — a live host reading, its true age, and enough disk context to rule commit refusal in or out by hand — not automatically decidable. Host pressure remains a hypothesis — the live repro below failed to reproduce the kill.Fix evidence
Every revert below was re-run against HEAD (
7cd14bdbedf) for this description. Rounds 3-5 moved the code and renamed the enum, so the counts and messages recorded when each mutation was first written no longer matched the tree; the outputs here are from the current run, one mutation at a time,git statusclean before and after each. Targets:src/main/crash-reporting/pre-gone-host-memory.test.ts(12 tests) for A-I and K,src/main/startup/pre-gone-crash-sampling-wiring.test.ts(1 test) for the four wiring mutations in J.RED — production hunks reverted one at a time, tests kept
A. Drop the detail assembly (
Object.assign(crashDetails, preGoneSystemMemoryDetails(nowMs))inprocess-gone-diagnostics.ts:306) — nothing the sampler collects reaches a crash report:B. Drop the one line that arms the host sampler (
startPreGoneSystemMemorySampling(systemMemoryIntervalMs)inprocess-gone-diagnostics.ts:223) — this is the revert that was green across all 264 crash-reporting tests before round 2:C. Serialize the statfs ahead of the host read (
await mergeSwapVolumeFreeSpace(tick)moved beforecommitHostMemorySample) — the shape round 2 blocked on: a cheap host reading held hostage to a filesystem syscall, with a hung volume able to stop sampling permanently:D. Ungate the swap volume on Linux (
return path.sepfor every non-win32 platform) — the realstatfs('/')on this machine returns 226 GB of root-fs free space, which is exactly the number that would sit next toSwapFreeMB: 0in the two Linux cluster members and invite the wrong verdict:E. Round 3 — force
coTimed = true(the pre-fix behaviour: any resolved statfs qualifies the verdict):F. Round 4 — drop the hard-capped gate (a commit limit at or below RAM stops being decisive):
G. Round 4 — let any resolved statfs name the label again (
pressureSignal(platform, merged, true)inwithSwapVolumeFreeSpace, i.e. the round-3 regression re-verified against the renamed enum):H. Round 4 — drop the volume carry-forward (
withCarriedSwapVolumereturns its argument unchanged, so the next tick's sample loses the field):I. Round 4 — restore the
Object.keys(details).length === 0guard (an all-failed reading commits again, shipping disk numbers with no host memory beside them):J. Rounds 3-4 — the startup wiring, four mutations, each run alone against
src/main/startup/pre-gone-crash-sampling-wiring.test.ts. DeletingstartPreGoneCrashSampling()frommain-process-ready-runtime.ts:128was green across 691 tests before round 3; moving it to a never-called sibling export in the same file was green across all 9 before round 4.K. Round 5 — restore sample-identity co-timing (
const coTimed = preGoneSample === issuedFor, the exact pre-fix line) — a statfs issued at t=0 and resolving at t=25 s across two ticks whose host read returnednullis named co-timed again:GREEN — production restored,
git statuscleanThe one failure is environment-dependent and re-verified as failing identically on
origin/main's copies of both directories:src/main/startup/ensure-virtual-display.test.ts > reports failure when a stale socket blocks the Xvfb rebindtimes out at 5000 ms with this branch'ssrc/main/startupandsrc/main/crash-reportingchecked out fromorigin/main(Tests 1 failed | 32 passed (33)). It needs a working Xvfb rebind. Scoped to what this PR touches:The round-5 fleet measurement, re-run for this description over
/tmp/ct/clusters/{G4-oom,G2-killed,G8-misc-crashed}, every win32 report carrying bothsystemMemoryTotalMBandsystemMemorySwapTotalMB— 30 reports,swapTotal/totalfrom 1.063x (3bcc649069065/64969 and5f2c575434492/32444) to 3.021x (ffe54f6d47836/15836), zero at or below 1.0. This is the number that saysavailable-commit-hard-cappedwould have fired on none of them.Live reproduction — it FAILED, and that failure is why the swap-volume field exists
A Windows VM (
win-lowspec) was driven to 127 MB available commit for 25 s with the renderer actively parsing terminal output. It did not die. Windows grew the pagefile mid-hold: 127 → 2029 MB available commit with nothing released.So "low available commit kills Orca" is falsified as stated. The field mechanism needs commit refusal — a machine whose pagefile cannot expand (fixed-size pagefile, or a full system drive). That is precisely why this PR ships
systemMemoryPreGoneSwapVolumeFreeMBrather than onlygetSystemMemoryInfo().Claims NOT proven — stated explicitly rather than padded
estBufferKB) = −0.08; r(domNodes) = −0.03, r(managers) = +0.12, r(blinkMB) = −0.27. Subtracting every Orca-attributable counter fromoutsideHeapMBleaves median 532 MB unattributed (median 67% of privateMB). Nothing the renderer can count explains it. That work is not in this PR.renderer-heap-headroom.ts(RENDERER_HEAP_CAP_MB = 4096, thetotalmem()gate) is unchanged: the highestusedHeapMBin any pre-crash sample across the 5 G4 bundles is 164 MB, i.e. 3.9% of the limit. The prior round's ceiling hypothesis is falsified by the artifacts.4d7e28eeis probably misfiled. Network Service + GPU dead within 24 ms and the main process replaced 78 s later reads as a whole-tree external kill, not a renderer OOM. It is the one report in the table with healthy host memory.ELI5
When Orca's window process gets killed for running out of memory, we write down how much memory the whole computer had left — but we write it down after the dead process has already handed its memory back. That is like checking whether a car park is full only after the crashed car has been towed away: there is always a space now, so the note is useless.
To the user this looked like Orca's window suddenly going blank and reloading, on machines that were low on memory. When we read the reports afterwards we could not tell whether the computer had genuinely run dry or something else killed us, because every report said the machine looked fine.
This change takes the same reading every 10 seconds while Orca is still alive, so the crash report carries a snapshot from just before the death as well as the one after. On Windows and Mac it also records how much free disk the swap file could grow into, because "low memory" only actually kills you when the swap file has nowhere left to expand — that disk number is a clue for a human reading the report, not something the report decides on its own. It fixes no bug by itself — it means the next round of these reports will actually be readable.
Trade-offs
Not none. Three real costs, all borne by every user on every platform:
process.getSystemMemoryInfo()(aGlobalMemoryStatusEx//proc/meminfo-class read). The timer isunref'd so it never holds the process open. This is a permanent, if small, background cost that did not exist before — the previous sampler ran at 60 s.fs.statfssyscall on win32 and darwin (not Linux), also every 10 s. It isawaited off the critical path — the memory reading is committed first and the volume value merges in afterwards — so a slow or hung volume cannot stall or skip host sampling. But it is a new periodic filesystem call, on a laptop, forever. A hungstatfsleaks one pending promise and suppresses further volume reads for the life of the process — the latch that guards re-entry has no timeout and nothing outside test reset clears it. That fails safe (the verdict degrades toavailable-commit-unqualified, it does not go wrong), and the memory reading keeps updating regardless, but volume sampling cannot recover without an app restart.systemMemoryPreGoneSwapVolumeAgeMs, and only a statfs that answers before the next sampling tick is named in the label (available-commit-volume-cotimed); otherwise the reading staysavailable-commit-unqualified. Round 5 found that guarantee was not absolute as first written — it compared sample object identity, and a tick whose host read fails leaves the sample in place, so a statfs resolving 25 s and two failed ticks later still read as co-timed. It is now a monotonic tick counter, which those ticks bump regardless (revert K above). Round 4 added carry-forward, so the field no longer disappears from the ticks in between — the last reading rides along at its true age, never re-qualifying the label. The cost is that during a storm the label says less exactly when the read is slowest — a smaller claim rather than a wrong one.Newly swallowed errors: three, all bounded.
commitHostMemorySamplecatches so a failed read cannot erase the last good sample (a test pins that a throwing host read leaves the process-metric sample intact);mergeSwapVolumeFreeSpacecatches so astatfsfailure cannot take down a reading that is already committed;statfsSwapVolumeFreeSpacecatches thestatfsitself. A fourth catch (readElectronSystemMemoryInfo) is pre-existing, relocated fromgone-time-system-memory.ts. None can suppress a crash report, but the third is not cosmetic: a persistentstatfsrefusal (locked-down ACL, AppLocker/EDR policy onC:\, a UNCSystemRoot) yieldsundefinedforever, so the label sits atavailable-commit-unqualifiedfor the app's life with nothing in the report saying why the volume datum is missing.No user-facing behaviour change, no UI, no new IPC, no renderer code, no wire opcode. The new details are additive optional fields on an existing crash-report payload, so old servers ignore them and old clients never see them. Two of the new details are strings, not numbers —
systemMemoryPreGonePressureSignal(a fixed enum) andsystemMemoryPreGoneSwapVolume(a drive label, separator-trimmed so redaction sees no path). Both are assigned aftersanitizeCrashReportDetails; neither carries user content.Adversarial review
6 rounds. Rounds 1-5 each returned blocking findings; round 6 re-reviewed HEAD (
7cd14bdbedf) and returned clean. So it did converge, but only on the sixth pass, and three findings were closed by disclosure rather than by code — they are listed as such below, with the residual risk and who carries it. Nothing unresolved has been moved into "Follow-ups".Round 1 — 3 blocking, all fixed in
17a50c18a53:getSystemMemoryInfo()gives the current commit limit but not pagefile expandability, and the investigation's own repro showed the pagefile growing 127 → 2029 MB mid-hold. Fixed: addedswap-volume-free-space.ts.freeMB: 272from a healthy Mac as evidence of exhaustion. Fixed: every reading now shipssystemMemoryPressureSignal, which isnoneon darwin.Round 2 — 4 blocking, all fixed in
9105ba1c7df:unref, and an end-to-end 10 s tick.SwapVolumeFreeMBwas published on Linux, where swap cannot grow into root-fs free space. Fixed: win32/darwin only; revert D above pins it.statfs— worst case exactly during the paging storm this targets. Fixed: commit-then-merge; revert C above pins it.Round 3 — 2 blocking, both fixed in
7f186c4ed40:available-commit. The volume reading merged into whatever sample was current at resolution time, and no age field exposed the gap. Executed: a statfs issued at t=0 on a healthy host resolving at t=20 s of pressure emittedSwapFreeMB: 200besideSwapVolumeFreeMB: 40000, labelledavailable-commit,SampleAgeMs: 0— which reads as "the pagefile had room, so this was not a commit refusal", the opposite conclusion, on exactly the win32 G4-oom reports this PR exists to decide. Fixed: the sample now stamps the tick that issued the statfs, published assystemMemoryPreGoneSwapVolumeAgeMs, and only a statfs answering on its own tick may qualify the verdict. Revert E above.startPreGoneCrashSampling()frommain-process-ready-runtime.ts:128left 691 tests acrosscrash-reporting/andstartup/green — while a comment in the new test file told the next reader that case was covered. Fixed: a source-level wiring test (the pattern this repo already uses for arm-once ready-phase lines). The misleading comment is deleted. Revert J above.Round 4 — 1 blocking, fixed in
815a0f3dd5f:pressureSignal()promoted the win32 reading to the decisiveavailable-commiton the mere presence of a co-timed volume number. Round 3 had closed only the time axis; growability stayed open, and the branch concedes both ways it fails — a fixed-size or disabled pagefile grows into no amount of empty disk (the live repro names exactly that as one of the two refusal mechanisms, and the pagefile maximum is unread), andswapVolumeAnchormeasuresSystemRoot's volume, which a relocated pagefile does not live on. Executed on7f186c4ed40: a host withtotal 16000/swapTotal 16100(commit limit ≈ RAM), 180 MB available commit and 812 GB free disk emittedPressureSignal: 'available-commit'withSwapVolumeAgeMs: 0. Fixed: the volume datum is renamed for what it is —available-commit-volume-cotimed, context beside the commit number, asserting no verdict. The one growability fact this API can establish takes the decisive label instead: Windows' commit limit is RAM + pagefile, soswapTotal <= totalmeans no pagefile exists to grow →available-commit-hard-capped. Reverts F and G above.Round 4 non-blocking — 3 fixed, 2 answered:
commitHostMemorySamplereplaces the sample wholesale — so during a storm (statfs slower than 10 s) the field was present roughly half the ticks. Fixed: carry-forward at its trueSwapVolumeAgeMs, never re-qualifying the label. Revert H above.SampleAgeMs+PressureSignal+ the volume fields with no host memory numbers beside them. Fixed: the guard now ignores the unconditionally-appended label. Revert I above. (Low field probability —getSystemMemoryInfo()does not return non-finite fields.)startPreGoneCrashSampling()into a never-called sibling export in the same file left all assertions green while the branch went inert. A behavioural test would have to mock ~15 ready-phase collaborators (state.store,RpcDispatcher,browserManager, the plugin/automation initializers…) to reach one line. Fixed within the pattern instead: assertions are now scoped to the body ofinitializeReadyRuntimeServicesitself, and the test moved tosrc/main/startup/pre-gone-crash-sampling-wiring.test.ts, beside the file it pins, matching the 4 existing*-wiring.test.tsprecedents.statfscatch was uncounted, and a persistent refusal is not cosmetic. Both now stated in Trade-offs.statfsfor a datum no verdict reads. Accepted and disclosed, not removed — see the disclosed-limitation list below.Round 5 — 1 blocking, and it was a description defect, not a code defect. Fixed in this description:
available-commit-hard-cappedas the only growability verdict, and that label requiresswapTotal <= total. Re-measured for this description across all three clusters: 30 win32 field reports,swapTotal/totalbetween 1.063x and 3.021x, zero at or below 1.0 — the decisive label fires on none of the machines this PR was built from, while a permanent 10 sstatfson every win32 and darwin user was being justified by it. Fixed in the description, not by dropping the syscall: the What section now states that the volume number is context only, thathard-cappedis the sole verdict and is not expected to fire on this fleet, and re-justifies the statfs on the three things it can honestly buy — the falsifier shape (low commit plus a nearly-full volume, invisible today), the rare hard-capped case, and letting an analyst rule disk exhaustion out by hand. It also commits to a kill criterion: if the next batch shows the same band with roomy volumes, commit refusal is not the mechanism and the statfs should be removed.Round 5 non-blocking — 1 fixed in
7cd14bdbedf, the rest carried into the disclosed list:commitHostMemorySamplereturnsfalsewithout replacingpreGoneSamplewhen the host read fails, so the sample's object identity was frozen andpreGoneSample === issuedForstill held after intervening ticks — a statfs issued at t=0 and resolving at t=25 s shippedavailable-commit-volume-cotimedbesideSwapVolumeAgeMs: 25000. Bounded (that label asserts no verdict since round 4) and near-zero field probability (GlobalMemoryStatusExeffectively never fails), but the invariant was wrong. Fixed rather than disclosed, because it is four lines: co-timing is now a monotonic tick counter bumped by every call tosamplePreGoneSystemMemory. Revert K above.oxfmt --check <the four changed files>while the diff has 8. Fixed; all 8 are clean.Round 6 — clean. Re-reviewed HEAD (
7cd14bdbedf) with no new blocking findings, which is what "converged" means here. No commit followed it; the only change since round 5 is this description.Accepted as disclosed limitations — NOT fixed
These are open in the shipped code. They were judged not worth the change they would cost, and each is stated in Trade-offs or the What section as well.
statfsdisables volume sampling for the process lifetime.swapVolumeReadInFlighthas no timeout and is cleared only by the test-reset helper. Who carries it: any win32 or darwin user whose swap volume hangs (dead network mount asSystemRoot, a wedged filer). Residual risk: their crash reports lose the volume field entirely and sit atavailable-commit-unqualifieduntil they restart Orca. It fails safe — the verdict degrades, it does not go wrong, and the host memory reading keeps updating — but it cannot self-heal.statfsrefusal is silent.statfsSwapVolumeFreeSpaceswallows the error and returnsundefinedforever. Who carries it: win32 users behind a locked-down ACL, AppLocker/EDR policy onC:\, or a UNCSystemRoot. Residual risk: the report shows no volume field and nothing explaining why it is missing, so an analyst cannot distinguish "not measured" from "not applicable".statfsfor a datum no verdict reads.swapVolumeAnchorreturnspath.sepon darwin, so a realstatfs('/')runs every 10 s for the life of the app and publishesSwapVolumeFreeMB+SwapVolume: "/", yetpressureSignalis hardcodednoneon darwin and can never be upgraded by it. Who carries it: every Mac user. Residual risk: a permanent background syscall bought for human-readable context only. Kept because macOS swapfiles genuinely do grow into/, so the number is honest context for a darwin OOM; dropping it would remove data, not a wrong claim.available-commit-hard-cappedinfers "no pagefile" fromswapTotal <= total, wheretotalisullTotalPhyswhile the commit limit's RAM contribution is ~1-2% lower for kernel reserve. A small fixed pagefile inside that gap also gets the label. The downstream conclusion ("this floor cannot heal") holds for a fixed pagefile too, so it is naming imprecision, not a wrong verdict. Tightening it needs the pagefile maximum — follow-up 4.if (is.dev) { return }immediately before the call keeps it green (deletion,if (!is.dev)-guarding, commenting out, and sibling-export moves in both placements all go red — revert J above). Closing it needs a source-grep for preceding early returns, which would fire on unrelated refactors. Residual risk: a future refactor could add an early return above the arm point and ship an inert sampler.startPreGoneCrashSampling()sits after severalawaits ininitializeReadyRuntimeServices(main-process-ready-runtime.ts:128), so a rejection anywhere earlier leaves the sampler unarmed and every crash report loses its only live host reading. This is the exact position the pre-existingstartPreGoneProcessMetricsSampling()already occupied, so moving it is a change to shared startup ordering rather than a fix to this branch, and it is not a regression. Left alone deliberately.SystemRootunset,swapVolumeAnchorfalls back toSystemDriveandpath.win32.parse('C:').rootis'C:', sostatfs('C:')resolves against the current directory on that drive.SystemRootis normally set and failure degrades toundefined; impact is low. Relatedly,volumeLabel('/')returns"/", which reads oddly against that field's own "separator-trimmed so redaction sees no path" comment (harmless — a bare separator is not a path).Rebutted, not fixed (2)
host-memory.ts:86'smemory_pressure -Qto close the darwin gap." Declined with evidence. That reader is reached only through on-demand paths (memory:getSnapshotIPC and one PTY foreground-process read); there is no periodic snapshot, so there is no cached value to reuse for free (grep setInterval src/main/memory/*.tsis empty — the reviewer verified this half of the rebuttal independently). Adopting it means spawning/usr/bin/memory_pressureon a main-process timer for the app's lifetime, and its module-global support latch is shared with the memory UI. Onestatfsper 10 s is microseconds and no process; a subprocess spawn per tick is not. The reviewer conceded the tradeoff is arguable; what was not acceptable was shipping the gap silently, so darwin now shipsPressureSignal: 'none'in the data itself.vi.mockis hoisted per file and cannot be shared without a setup module; this directory already has 26 focused test files that each re-declare it.Follow-ups
terminals.estBufferKBis refuted as the grower (r = −0.08; the profile with 74.5 MB of buffers sits 12th of 19 on outside-heap, while the largest at 1178 MB holds 4.6 MB). Closing this needs something the renderer does not have today —performance.measureUserAgentSpecificMemory()breakdown, or GPU/canvas-mapped accounting.renderer-memory-sampling.ts:18arms at 60%/80% of the heap limit and:27at 600/1000 MB private, while these sessions peak at 3.9% and 475 MB.emittedPrivateHighwaterMarksis also a session-lifetime one-shot, so a mark crossed hours earlier is spent and the crash-adjacent state is never profiled.outsideHeapMBis systematically over-reported.renderer-memory-sampling.ts:134-145excludes V8's committed-but-unused reserve (totalHeap − usedHeap), median 53 MB here, ~9% of the reported figure. Also, theprivateMB ≥ 600trigger guarantees outside-heap looks like most of privateMB in any profile that fires with a small heap — a property of the trigger, not only of the leak.docs/reference/windows-edr-posture.mdrules out per-operation interpreter spawning for telemetry. Needs a native or non-spawning path.fbccd7fbshows a 180 s gap with norenderer_memorysample from either renderer 38 s before the OOM;4d7e28eeshows a 242 s gap with no spans of any kind. A stalled main thread immediately before the kill appears in 2 of 5 — it may be the same event seen from two angles.4d7e28eeas an external tree-kill, not a renderer OOM, once the "record our own tree-kill invocations" follow-up lands. External vs self tree-kill is byte-identical in the reports today.