Skip to content

fix(windows): ship the process-table addon to the relocated daemon host - #19525

Closed
OrcaWin wants to merge 1 commit into
mainfrom
OrcaWin/ship-process-table-addon-to-daemon-host
Closed

OrcaWin wants to merge 1 commit into
mainfrom
OrcaWin/ship-process-table-addon-to-daemon-host

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​193 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​186
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​206 $\color{#cf222e}{\Huge{\mathbf{−}}}$​119 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​87

Summary

The relocated daemon host never received @vscode/windows-process-tree, so readOneSnapshot took the absent-module branch inside the daemon and answered every process-table read by forking powershell.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 daemonLog at 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_QUERY in windows-process-table-cim-scan.ts — CommandLine,Name,ParentProcessId,ProcessId. The memory collector's query selects WorkingSetSize,KernelModeTime,UserModeTime,CreationDate,PageFileUsage and 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:

  1. buildDaemonHostManifest mirrored the install dir but copied only node-pty out of resources/node_modules.
  2. The addon is loaded with requireNative('@vscode/windows-process-tree') — the bare package — so resolution walks parent node_modules of the relocated daemon-entry.js. Nothing in the mirror provided it, and no NODE_PATH is set for the child.
  3. moduleLoader() returned null, and readOneSnapshot fell to projection.cimFallback().
  4. The daemon's foreground tracker refreshes on the renderer's agent-completion poll — 750 ms active, 2 s idle — throttled by a 1 s per-pane TTL. So roughly one powershell.exe per 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.exe spawns carrying exactly the issue's command line; with it resolvable, zero.

What changed

  • The copy — buildDaemonHostManifest gains a dir op for the addon's runtime surface (package.json, lib/, build/Release/windows_process_tree.node), filtered so the tarball's src/, deps/ and .pdb bulk stays behind. package.json and lib/ are load-bearing, not just the .node: the loader requires the bare package, so resolution runs through main.
  • Marker integrity — the addon's sha256 is recorded in .materialized.json, and getRelocatedDaemonHost refuses 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.
  • Pre-check before the copy — the marker hashes the addon, so without it a ~260 MB copy runs and is discarded when the hash throws, on every launch. Absence still fails open to the install-dir host, which does have the addon.
  • Daemon observability — daemon-entry logs { native: isWindowsProcessTableAvailable() } to daemonLog at startup, next to the macOS login preflight, which carries the same reasoning: the daemon's stderr is destroyed once it reports ready, so a console.warn from 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 of daemon-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. executeManifest now 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 the optional? vocabulary the manifest already had.

Deliberately not here

This supersedes the daemon half of #17115.

Verification

  • pnpm tc:node, pnpm tc:cli, oxlint (including max-lines), and the max-lines / ts-nocheck / reliability-gate ratchets: clean.
  • src/main/daemon/ + src/main/windows/ — 11 failed files / 17 failed tests, identical to origin/main on the same selector (pre-existing node-pty build failures in this environment), with 5 additional passing tests from this change.
  • Both new guards were mutation-tested: dropping package.json from 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 .node and lib/ while dropping src/; the mirror resolves the bare package to the copied lib/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 .node skips the discarded full copy; the fallback warns exactly once across repeated reads.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: be0f9dd2-0a9a-46f0-b1ac-0b88910a4eb7

📥 Commits

Reviewing files that changed from the base of the PR and between 3ed9f68775a053782877a73eda14b72978e7ca8b and 9641ac0d6d717df24aa6549deec0ac0d712ce4cc.

📒 Files selected for processing (2)
  • src/main/daemon/daemon-host-relocation.test.ts
  • src/main/daemon/daemon-host-relocation.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/daemon/daemon-host-relocation.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The 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 9641a

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)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR satisfies the relocated-daemon-host portion of [#16905] by making the native process-table addon available and preventing the daemon's CIM fallback. It does not address the issue's remaining re… Either implement the memory collector and identity-probe migrations required by [#16905], or link this PR to a child issue scoped specifically to relocated daemon-host addon resolution and leave [#16905] open for the remaining work.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the primary change: shipping the Windows process-table addon to the relocated daemon host.
Description check ✅ Passed The description provides detailed scope, root cause, implementation changes, linked issue, exclusions, and verification results. It omits several template headings and checklist items, including expli…
Out of Scope Changes check ✅ Passed The manifest extraction, addon integrity checks, fallback warning, startup capability log, and related tests support the relocated daemon-host fix and its observability. No unrelated code changes are …
Full details: Linked Issues check

Explanation

The PR satisfies the relocated-daemon-host portion of [#16905] by making the native process-table addon available and preventing the daemon's CIM fallback. It does not address the issue's remaining requirements for the memory collector and three identity probes, which the PR explicitly excludes.

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 — buildDaemonHostManifest gains a dir op for resources/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 — windowsProcessTreeSha256 is written into .materialized.json, and getRelocatedDaemonHost refuses 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 — materializeRelocatedDaemonHost bails 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.ts latches warnedAboutCimFallback and logs the first fallback engagement.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@OrcaWin
OrcaWin force-pushed the OrcaWin/ship-process-table-addon-to-daemon-host branch from abc666c to 4145417 Compare September 8, 2026 05:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts
  • src/main/daemon/daemon-host-copy-plan.ts
  • src/main/daemon/daemon-host-relocation.test.ts
  • src/main/daemon/daemon-host-relocation.ts
  • src/main/windows/windows-process-table.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@OrcaWin
OrcaWin force-pushed the OrcaWin/ship-process-table-addon-to-daemon-host branch from 4145417 to ecaf9fa Compare September 8, 2026 06:10

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts
  • src/main/daemon/daemon-host-manifest.ts
  • src/main/daemon/daemon-host-relocation.test.ts
  • src/main/daemon/daemon-host-relocation.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts logs windows-process-table with { native: isWindowsProcessTableAvailable() } at startup, and the warnedAboutCimFallback comment 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 createRequire and asserts it lands on the copied lib/index.js, so dropping package.json from the filter would fail it.
  • Consolidated the addon copy source — renamed daemon-host-copy-plan.ts to daemon-host-manifest.ts and replaced windowsProcessTreeAddonPath with windowsProcessTreeDir, deriving the .node path via the exported ADDON_REL_PATH.
  • Generalized the runtime filter — isRuntimeWindowsProcessTreePath now matches against a WINDOWS_PROCESS_TREE_RUNTIME allow-list rather than an explicit path list.
  • Moved required-input validation up-front — executeManifest now fails before copying anything when a required source is missing.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@OrcaWin
OrcaWin force-pushed the OrcaWin/ship-process-table-addon-to-daemon-host branch 2 times, most recently from 3ed9f68 to 9641ac0 Compare September 8, 2026 07:50

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one test-accuracy note inline.

Reviewed changes

  • Promoted the addon binary to a dedicated required copy op — buildDaemonHostManifest now emits a separate kind: 'file' op for build/Release/windows_process_tree.node (dropping it from the dir filter), so executeManifest's up-front required-input sweep fails a missing .node before any of the ~260 MB copy runs.
  • Shape-checked the marker hash — readMarker now rejects any windowsProcessTreeSha256 that 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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one completeness note inline.

Reviewed changes

  • Guarded package.json in the relocated mirror — getRelocatedDaemonHost now refuses a host whose package.json is missing, since bare-package resolution reads it before ever reaching the .node; relocatedAddonSha256 was simplified to take the relocated package dir directly.
  • Added a test for a mirror that lost the package.json its require() resolves through.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@OrcaWin
OrcaWin force-pushed the OrcaWin/ship-process-table-addon-to-daemon-host branch 3 times, most recently from ad5018d to af3d693 Compare September 8, 2026 09:51

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 getRelocatedDaemonHost to existence checks — the relocated package's package.json, lib/index.js, and .node must all exist, closing the prior lib/index.js gap and simplifying the pre-#16905 marker migration.
  • Moved executeManifest into 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 — executeManifest is 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.

Pullfrog  | Fix it ➔ | View workflow run | Using 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.
@OrcaWin
OrcaWin force-pushed the OrcaWin/ship-process-table-addon-to-daemon-host branch from af3d693 to d8375db Compare September 8, 2026 10:25

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_PATH and the WINDOWS_PROCESS_TREE_RUNTIME filter gave way to WINDOWS_PROCESS_TREE_REQUIRED, a single three-file list (package.json, lib/index.js, the .node) that materializeRelocatedDaemonHost checks against the source before the copy and getRelocatedDaemonHost checks against the mirror.
  • Copied the whole addon package instead of a filtered runtime surface — the dir op for @vscode/windows-process-tree lost its filter, so src/, deps/, and .pdb now ship in the mirror rather than being trimmed.
  • Moved the missing-addon guard from executeManifest to materializeRelocatedDaemonHost — executeManifest reverted 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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

}
)

it('rematerializes a host whose copied addon went missing', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@OrcaWin

OrcaWin commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

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.

OrcaWin added a commit that referenced this pull request Sep 26, 2026
…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]>
@OrcaWin

OrcaWin commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator Author

Closing as superseded by #22872, merged today. That PR carries this same fix, plus the installer process-check fix:

  • copies @vscode/windows-process-tree into the relocated daemon host
  • rebuilds the mirror when the addon is missing
  • logs once at startup whether the process-table addon is available

Thanks for tracking down the real root cause here. It's what showed #16905 wasn't the Resource Manager at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows relocated terminal daemon spawns powershell.exe every ~2s (native process-tree addon missing from daemon host)

1 participant