Skip to content

fix(browser): skip Windows Electron signals without verified lineage - #1588

Merged
morluto merged 2 commits into
morluto:mainfrom
Adolanium:fix/windows-electron-cleanup
Oct 10, 2026
Merged

morluto merged 2 commits into
morluto:mainfrom
Adolanium:fix/windows-electron-cleanup

Conversation

@Adolanium

@Adolanium Adolanium commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #1589.

capture_electron_scenario on Windows force-kills the recorded Electron PID and then reports cleanup_failed. Related context: #288 tracks Job Object ownership for Ghidra and does not cover this Electron path.

Problem and expected behavior

On Windows, createSystemProcessOwnershipHost returns an empty process list, so Electron lineage stays unavailable. cleanupElectronProcesses still ran taskkill.exe /pid <leader> /t /f, then returned cleaned: false because lineage was not verified.

docs/electron-observation.md says cleanup uncertainty does not authorize signaling unrelated processes. A PID alone is not ownership after exit or reuse. POSIX cleanup revalidates the run before signaling. Windows should refuse the signal when lineage is unverified, and signal the leader and descendants only after lineage is verified.

An unverified Windows capture still ends as cleanup_failed with partial_observation. This change does not make that lane succeed, and it does not implement Job Object ownership.

Change and scope

The Windows branch now returns the existing unverified-cleanup failure before calling taskkill. Verified lineage still terminates the leader and each descendant. POSIX cleanup is unchanged.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Electron active-observation cleanup, after capture and application.close().
  • CLI and MCP/tool-catalog contract: none. capture_electron_scenario still returns cleanup_failed when Windows lineage cannot be verified.
  • Provider, bridge, target-format, or platform compatibility: Windows Electron cleanup no longer signals an unproven PID. Verified lineage behavior is unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: none. A failed cleanup still retains collected observations as partial_observation.
  • Process execution, authorization, cleanup, or containment impact: removes the PID taskkill that ran without lineage proof.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated: src/browser/PlaywrightElectronActiveProvider.test.ts covers unavailable lineage (no terminate call) and verified lineage (leader then descendant).
  • Base reproduction or other evidence: source path. On Windows the process table is empty, so observeOwnedProcessLineage returns unavailable before any signal. The previous branch called cleanupWindowsProcessTree first.
  • User-visible CLI/MCP output (if applicable): an unverified Windows capture still fails with cleanup_failed. It no longer runs taskkill first.
  • Remaining proof gaps: no live Electron process was launched. Job Object ownership that could let this lane succeed on Windows remains Own Windows Ghidra process trees with kill-on-close semantics #288.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- src/browser/PlaywrightElectronActiveProvider.test.ts — 3 tests passed.
  • npx tsc --noEmit --pretty false — no errors.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Windows captures that cannot prove lineage still fail closed, without the extra signal.
  • Real Hopper/Ghidra, browser, or OS coverage: not run. The regression injects the Windows platform and a terminate function.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: stops signaling a PID that the Windows process table cannot tie to this run.

Review checklist

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

capture_electron_scenario called taskkill on the recorded leader PID before lineage could be verified. On Windows the process table is empty, so that proof never arrives and the signal still ran. Refuse the cleanup without signaling. A verified lineage still terminates the leader and its descendants.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto
morluto merged commit 1a6ccec into morluto:main Oct 10, 2026
@morluto

morluto commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thanks for this contribution as well, @Adolanium. Checking lineage before signaling the Windows Electron tree preserves the ownership boundary when cleanup cannot be verified. I reconciled the tests with main and kept its partial-capture regression alongside your cases. All four source tests passed locally; native Windows remains unverified. Squash-merged.

@morluto morluto added the bug Something isn't working label Oct 14, 2026
@Adolanium
Adolanium deleted the fix/windows-electron-cleanup branch October 18, 2026 04:57
@morluto morluto added area: tests Test suite and verification provider: electron Analysis provider / engine: electron labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suite and verification bug Something isn't working provider: electron Analysis provider / engine: electron

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Windows Electron cleanup signals an unverified PID

2 participants