Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 3ed9f68775a053782877a73eda14b72978e7ca8b and 9641ac0d6d717df24aa6549deec0ac0d712ce4cc. 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe daemon host relocation now copies the Windows process-tree native addon and records its SHA-256 hash. Relocated hosts reject missing or modified addons and trigger re-materialization. The copy plan now resides in a dedicated manifest module with runtime-file filters. Windows process-table fallback usage logs a warning once, and daemon startup logs native binding availability. Priority: ➖ Normal — Impact reflects medium issue severity. Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Relocated Windows daemon hosts now copy and validate the native process-tree addon, while missing source addon files avoid creating a relocation staging directory. No current merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation The PR satisfies the relocated-daemon-host portion of [ ✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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.
Important
The materialization fix itself is correct and well-tested, but the "warn once" observability it ships as a headline never lands in the daemon — the one process #16905 is about. Details inline.
Reviewed changes
- Copy the process-table addon into the daemon-host mirror —
buildDaemonHostManifestgains adirop forresources/node_modules/@vscode/windows-process-tree, filtered to the runtime surface (package.json,lib/,build/Release/windows_process_tree.node) so the relocated daemon resolves the native reader instead of CIM-falling-back. - Hash the addon into the materialization marker —
windowsProcessTreeSha256is written into.materialized.json, andgetRelocatedDaemonHostrefuses a host whose relocated addon no longer matches the install's, forcing re-materialization of stale, corrupt, or pre-fix hosts. - Pre-check before the copy —
materializeRelocatedDaemonHostbails before the ~260 MB copy when the source addon is absent, failing open to the install-dir host. - Warn once on CIM fallback —
windows-process-table.tslatcheswarnedAboutCimFallbackand logs the first fallback engagement.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
abc666c to
4145417
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: c71a24a9-4a32-40fa-bb5d-bce0425d44f0
📥 Commits
Reviewing files that changed from the base of the PR and between abc666c9155fa8526d0a8afaeed6b318a9a27dae and 41454170de5b46d8f0c59a0cd788adb9d53788e9.
📒 Files selected for processing (5)
src/main/daemon/daemon-entry.tssrc/main/daemon/daemon-host-copy-plan.tssrc/main/daemon/daemon-host-relocation.test.tssrc/main/daemon/daemon-host-relocation.tssrc/main/windows/windows-process-table.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
4145417 to
ecaf9fa
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: d1486d5a-7ac9-450e-a184-8569e30abb6f
📥 Commits
Reviewing files that changed from the base of the PR and between 41454170de5b46d8f0c59a0cd788adb9d53788e9 and ecaf9fa.
📒 Files selected for processing (4)
src/main/daemon/daemon-entry.tssrc/main/daemon/daemon-host-manifest.tssrc/main/daemon/daemon-host-relocation.test.tssrc/main/daemon/daemon-host-relocation.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
There was a problem hiding this comment.
Important
One regression in this delta: the .node-existence pre-check that guarded the ~260 MB copy was dropped, and its replacement in executeManifest only tests the package directory — so an install whose addon binary is missing (but whose package dir is present) still copies and discards the runtime on every launch, and the test that claims to prevent this now passes for the wrong reason.
Reviewed changes
- Routed daemon observability through
daemonLog—daemon-entry.tslogswindows-process-tablewith{ native: isWindowsProcessTableAvailable() }at startup, and thewarnedAboutCimFallbackcomment is now scoped to main + relay, resolving the prior "warn never lands in the daemon" finding. - Fixed the loader-resolution test — the test now resolves the bare package via
createRequireand asserts it lands on the copiedlib/index.js, so droppingpackage.jsonfrom the filter would fail it. - Consolidated the addon copy source — renamed
daemon-host-copy-plan.tstodaemon-host-manifest.tsand replacedwindowsProcessTreeAddonPathwithwindowsProcessTreeDir, deriving the.nodepath via the exportedADDON_REL_PATH. - Generalized the runtime filter —
isRuntimeWindowsProcessTreePathnow matches against aWINDOWS_PROCESS_TREE_RUNTIMEallow-list rather than an explicit path list. - Moved required-input validation up-front —
executeManifestnow fails before copying anything when a required source is missing.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
3ed9f68 to
9641ac0
Compare
There was a problem hiding this comment.
ℹ️ No critical issues — one test-accuracy note inline.
Reviewed changes
- Promoted the addon binary to a dedicated required copy op —
buildDaemonHostManifestnow emits a separatekind: 'file'op forbuild/Release/windows_process_tree.node(dropping it from the dir filter), soexecuteManifest's up-front required-input sweep fails a missing.nodebefore any of the ~260 MB copy runs. - Shape-checked the marker hash —
readMarkernow rejects anywindowsProcessTreeSha256that isn't 64 hex chars, closing the''-equals-''comparison hole when a relocated addon is unreadable. - Strengthened the missing-binary guard test — asserts the staging root stays empty, and adds a test refusing a marker whose recorded hash is not a hash.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No critical issues — one completeness note inline.
Reviewed changes
- Guarded
package.jsonin the relocated mirror —getRelocatedDaemonHostnow refuses a host whosepackage.jsonis missing, since bare-package resolution reads it before ever reaching the.node;relocatedAddonSha256was simplified to take the relocated package dir directly. - Added a test for a mirror that lost the
package.jsonitsrequire()resolves through.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
ad5018d to
af3d693
Compare
There was a problem hiding this comment.
Important
This delta removes the sha256 marker-integrity check that the PR body and commit message still describe, so a host whose addon is damaged in place is now handed out and silently CIM-falls-back — the exact #16905 failure this PR eliminates — until the next version bump.
Reviewed changes
- Switched
getRelocatedDaemonHostto existence checks — the relocated package'spackage.json,lib/index.js, and.nodemust all exist, closing the priorlib/index.jsgap and simplifying the pre-#16905 marker migration. - Moved
executeManifestinto the manifest module and hoisted its required-input sweep — a missing required source now throws before any of the ~260 MB copy, and a missing optional source is still skipped. - Rewrote the materialize-level tests —
executeManifestis now exercised directly (present op ordered before the missing required one), and the vacuous "copy never ran" assertion is renamed to what it actually proves.
⚠️ Damaged-in-place addons are no longer detected
getRelocatedDaemonHost previously compared the relocated .node's sha256 against a hash recorded in .materialized.json, so a host whose addon was modified (not just deleted) was refused and rebuilt. The delta drops the hash entirely and checks only that package.json, lib/index.js, and the .node exist. A host whose .node is present but corrupted — antivirus "repair", disk corruption, a partial write that survived a crash — now passes validation, the daemon require()s it, the load throws and is caught in loadWindowsProcessTree, and every snapshot silently forks powershell.exe from then on. That is #16905's symptom returning indefinitely, with only the daemonLog native: false record to notice it.
The PR body and the commit message both still promise this guarantee ("hash it into the materialization marker so a host whose copy is missing or damaged rebuilds"), and daemon-host-manifest.ts:21 still says "the lifecycle hashes this same file". Either restore the hash, or update the body, commit message, and that comment to state that only missing addons are detected and the damaged-in-place case is deliberately left to the atomic-publish rename.
Technical details
# Damaged-in-place addon is now undetected
## Affected sites
- src/main/daemon/daemon-host-relocation.ts:166-172 — existence checks replaced the `windowsProcessTreeSha256` comparison; `MaterializeMarker` (line 52) no longer carries the hash and `readMarker` no longer shape-checks it.
- src/main/daemon/daemon-host-manifest.ts:21 — stale comment: "the lifecycle hashes this same file" (it no longer does).
- PR body / commit message — still describe "missing or damaged … rebuilds".
## Required outcome
- Either restore the hash (record the addon's sha256 in the marker and compare it in `getRelocatedDaemonHost`), or update the PR body, commit message, and the manifest comment to drop the "damaged" claim and note the damaged-in-place gap is intentionally accepted.
## Open questions for the human
- Was the hash removal intentional, or a casualty of the squash onto main? The commit message was clearly written against the hashing version.DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
The relocated daemon host mirrors the install dir, but the manifest copied only node-pty out of resources/node_modules. `@vscode/windows-process-tree` was never copied, so `require` failed inside orca-terminal-daemon.exe, `readOneSnapshot` took the absent-module branch, and every process-table read fell through to `powershell.exe Get-CimInstance Win32_Process`. That is #16905. The transcript pasted in the issue is byte-identical to POWERSHELL_PROCESS_QUERY, not to the memory collector's query -- which is also why toggling Resource Manager off changed nothing. The foreground tracker refreshes on the renderer's 2s agent-completion poll, so it ran about once per agent pane per two seconds, indefinitely. Copy the addon's runtime surface (package.json, lib/, the .node) into the mirror, and hash the addon into the materialization marker so a host missing or carrying a stale one is re-materialized rather than used: a host that cannot load it still runs, and silently forks a shell per snapshot, which is the failure this is fixing. Check the addon exists before the copy, not after -- the marker hashes it, so otherwise a ~260MB copy runs and is discarded when the hash throws, on every launch. Absence still fails open to the install-dir host, which has it. Finally, warn once when the CIM fallback engages. Absence is legitimate on a relay; being quiet about it is how this lasted months. Fixes #16905. Related to #15209 and #15749.
af3d693 to
d8375db
Compare
There was a problem hiding this comment.
Important
The code in this commit is correct and well-tested, but the PR body and the commit message still describe the hashing marker, the filtered copy, and the up-front executeManifest validation that this commit removes — the description of record now contradicts the implementation.
Reviewed changes
- Replaced hash-based marker integrity with a shared existence list —
ADDON_REL_PATHand theWINDOWS_PROCESS_TREE_RUNTIMEfilter gave way toWINDOWS_PROCESS_TREE_REQUIRED, a single three-file list (package.json,lib/index.js, the.node) thatmaterializeRelocatedDaemonHostchecks against the source before the copy andgetRelocatedDaemonHostchecks against the mirror. - Copied the whole addon package instead of a filtered runtime surface — the
dirop for@vscode/windows-process-treelost its filter, sosrc/,deps/, and.pdbnow ship in the mirror rather than being trimmed. - Moved the missing-addon guard from
executeManifesttomaterializeRelocatedDaemonHost—executeManifestreverted to an in-loop required-input check (its up-front sweep and direct unit tests were removed), and the pre-copy source check now owns the fail-before-copy guarantee for the process-tree files. - Strengthened the warn-once test — re-injecting the loader resets the latch, so the next read warns again, closing the "passes via an earlier test's warn" hole.
⚠️ PR body and commit message still describe hashing and a filtered copy
The decision to drop the sha256 marker in favour of existence checks is sound and was justified in a thread reply: existence alone retires every pre-fix host, and the hash only bought detection of a torn copy, which staging-plus-atomic-rename already excludes. But the two places that record that decision — the PR body and the commit message — were never updated, and this commit made them more stale, not less.
The body's "Marker integrity" bullet still claims "the addon's sha256 is recorded in .materialized.json"; its "Pre-check" bullet still says "the marker hashes the addon"; its "The copy" bullet still says the copy is "filtered so the tarball's src/, deps/ and .pdb bulk stays behind" and describes a dedicated .node op; and its daemon-host-manifest.ts bullet still claims "executeManifest now validates every required input before copying anything". The commit message likewise still says "hash the addon into the materialization marker". None of that is true of the code anymore.
Technical details
# Sync the PR description to the existence-check design
## Affected sites
- PR body "What changed" — `Marker integrity`, `The copy`, `Pre-check`, and `daemon-host-manifest.ts` bullets describe hashing, a filtered copy, and up-front validation.
- Commit message (d8375db) — "hash the addon into the materialization marker", "the marker hashes it".
## Required outcome
- Rewrite the body and commit message to state that validity is established by the three-file existence check (`WINDOWS_PROCESS_TREE_REQUIRED`) against the mirror, that the whole package is copied, and that the pre-copy source check (not `executeManifest`) owns the fail-before-copy guarantee — and note the damaged-in-place case is deliberately left to the `daemonLog` `native: false` record.
## Open questions for the human
- None: the hash removal is a settled decision; this is purely a documentation sync.DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| } | ||
| ) | ||
|
|
||
| it('rematerializes a host whose copied addon went missing', () => { |
There was a problem hiding this comment.
Duplicated test blocks — likely a squash artifact. rematerializes a host whose copied addon went missing appears twice (here and lines 283–296), and does not read the install dir to decide an existing host is still good appears twice (lines 298–315 and 348–365); the single refuses a mirror that lost the addon, so a stale host is never handed out (lines 270–281) is also subsumed by the it.each at lines 318–331. Deduplicate to one copy of each.
|
Revived and finished on current main in #22872, which keeps this PR's approach, filters the addon copy down to the runtime files and adds regression tests. It was re-reported from the field on v1.4.211 (the daemon keeps spawning PowerShell and consoles flash; the user confirmed that copying the addon in by hand fixes it). #22872 supersedes this PR. |
…22872) * fix(windows): ship the process-table addon to the relocated daemon host The Windows terminal daemon runs from a copy of the app under %LOCALAPPDATA%\Orca\daemon-host\<version>. That copy took node-pty but not @vscode/windows-process-tree, so the daemon's bare require of the addon found nothing and every process-table read (foreground tracking, descendant sweeps) fell back to a powershell.exe Get-CimInstance scan (#16905). - Copy the addon's runtime files (package.json, lib/, the .node binary) into the host; the ~25MB of gyp intermediates beside them are filtered out. - Treat a host missing those files as unmaterialized, so hosts built before this are rebuilt, and skip relocation if the install itself lacks them. - Log the daemon's native/CIM capability at startup and warn once when the process table falls back to CIM. Revives #19525 on current main. * test(windows): locate update-survival loss before relaunch * test(windows): preserve daemon tree before update-survival proof * test(windows): distinguish Electron exit from launcher close timeout * test(windows): verify process exit when inherited pipes delay close * test(windows): trace installer process checks in isolated survival runs * fix(windows): probe process-query capability before installer sweep * fix(windows): match installer probe and process-check profile behavior * fix(windows): use NSIS separators for the process-check include * test(windows): dismiss session-search overlay in survival harness --------- Co-authored-by: m4air <[email protected]>
|
Closing as superseded by #22872, merged today. That PR carries this same fix, plus the installer process-check fix:
Thanks for tracking down the real root cause here. It's what showed #16905 wasn't the Resource Manager at all. |

Summary
The relocated daemon host never received
@vscode/windows-process-tree, soreadOneSnapshottook the absent-module branch inside the daemon and answered every process-table read by forkingpowershell.exe Get-CimInstance Win32_Process. That is #16905.Copy the addon into the mirror, hash it into the materialization marker so a host whose copy is missing or damaged rebuilds rather than being used, and record the daemon's process-table capability in
daemonLogat startup.Fixes #16905. Related to #15209, #15749.
Root cause
The issue, and its first comment, both name the memory collector and three identity probes. That is not what reproduces.
The transcript pasted in the issue is byte-identical to
POWERSHELL_PROCESS_QUERYinwindows-process-table-cim-scan.ts—CommandLine,Name,ParentProcessId,ProcessId. The memory collector's query selectsWorkingSetSize,KernelModeTime,UserModeTime,CreationDate,PageFileUsageand is not it. The reporter also noted the rate was unchanged with Resource Manager toggled off, which independently rules the collector out: it only polls while that popover is open.The chain is:
buildDaemonHostManifestmirrored the install dir but copied onlynode-ptyout ofresources/node_modules.requireNative('@vscode/windows-process-tree')— the bare package — so resolution walks parentnode_modulesof the relocateddaemon-entry.js. Nothing in the mirror provided it, and noNODE_PATHis set for the child.moduleLoader()returned null, andreadOneSnapshotfell toprojection.cimFallback().powershell.exeper agent pane per two seconds, indefinitely, matching the reported ~2.2 s cadence.Reproduced locally against the real module graph: with the addon unresolvable, five reads produce five
powershell.exespawns carrying exactly the issue's command line; with it resolvable, zero.What changed
buildDaemonHostManifestgains adirop for the addon's runtime surface (package.json,lib/,build/Release/windows_process_tree.node), filtered so the tarball'ssrc/,deps/and.pdbbulk stays behind.package.jsonandlib/are load-bearing, not just the.node: the loader requires the bare package, so resolution runs throughmain..materialized.json, andgetRelocatedDaemonHostrefuses a host whose copy no longer matches it. A host that cannot load the addon still runs; it just silently forks a shell per snapshot, so refusing it is the point. Verified against the marker and not against the install dir: that directory is the thing relocation exists to outlive, so reading it here would let an updater mid-copy condemn an intact host. A real upgrade changes the version keying the directory, which already forces a rebuild, and nothing else in the mirror is source-verified either.daemon-entrylogs{ native: isWindowsProcessTableAvailable() }todaemonLogat startup, next to the macOS login preflight, which carries the same reasoning: the daemon's stderr is destroyed once it reports ready, so aconsole.warnfrom the shared module never lands there. The module also warns once for the main and relay processes, whose console is real.daemon-host-manifest.ts— a pure move of the copy plan (CopyOp, the path helpers, both filters,buildDaemonHostManifest,executeManifest) out ofdaemon-host-relocation.ts, which kept the lifecycle: when to materialize, what keeps a host valid, and pruning. The addition pushed that file to 359 lines against a 300 limit, and AGENTS.md forbids a disable or a bump.executeManifestnow validates every required input before copying anything, so a missing one costs nothing rather than a discarded ~260 MB copy — replacing a special-case pre-check with theoptional?vocabulary the manifest already had.Deliberately not here
powershell.exe(with atypeperffallback), but only while the Resource Manager popover is open. Real, lower severity, and now wants building on perf(windows): split the process table into two flag sets #17866's projection model. Separate change.FILETIMEsession identity. fix(windows): unblock structured native chat by exposing process creation time #18986 has since landed a realCreationTimeflag withsupportedProcessDataFlagsself-reporting, which supersedes how fix(windows): eliminate recurring PowerShell process polling #17115 approached this..nodebinaries and a required/hashed relay artifact, both proposed in fix(windows): eliminate recurring PowerShell process polling #17115. Not needed here, and requiring an artifact only a Windows build machine can emit is whatrelay-optional-artifacts.test.tsexists to prevent.This supersedes the daemon half of #17115.
Verification
pnpm tc:node,pnpm tc:cli,oxlint(includingmax-lines), and the max-lines / ts-nocheck / reliability-gate ratchets: clean.src/main/daemon/+src/main/windows/— 11 failed files / 17 failed tests, identical toorigin/mainon the same selector (pre-existing node-pty build failures in this environment), with 5 additional passing tests from this change.package.jsonfrom the filter fails the resolve assertion, and disabling the marker check fails two tests.New coverage: the addon is in the copy manifest and its filter keeps the
.nodeandlib/while droppingsrc/; the mirror resolves the bare package to the copiedlib/index.js;getRelocatedDaemonHost()returns null for a deleted, corrupted, or unrecorded addon; a host whose copy went missing rebuilds; deleting the install's addon does not invalidate an intact host; a missing.nodeskips the discarded full copy; the fallback warns exactly once across repeated reads.