Skip to content

Hide managed Chrome windows on Windows - #21

Merged
JJLiebig merged 1 commit into
mainfrom
fix/windows-dwm-parking
Aug 29, 2026
Merged

JJLiebig merged 1 commit into
mainfrom
fix/windows-dwm-parking

Conversation

@JJLiebig

@JJLiebig JJLiebig commented Aug 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • hide ordinary managed Chrome with native SW_HIDE after every isolated-tab setup
  • mark native SW_RESTORE transitions so concurrent unattended runs preserve only intentional login/challenge/recovery visibility
  • replace repeated DevTools minimize/restore composition transitions without adding settings or browser flags

Root cause

PR #19 changed Windows process brokering and priority, but parking still depended on PR #18's DevTools minimize transition. Live probing with two concurrent leases showed the managed Chrome_WidgetWin_1 window was visible, normal, and uncloaked. A first native-hide attempt also proved that creating a later isolated tab can make the HWND visible again, so each ordinary setup must re-hide it while preserving explicitly restored human-recovery windows.

Validation

  • plugin validator
  • pnpm run build
  • pnpm run lint
  • pnpm test (19 files, 281 tests)
  • pnpm run format:check
  • pnpm pack --dry-run
  • Review Suite fast: one verified peer-recovery finding fixed; second round and closure clean. A subsequent live-only HWND re-show finding produced the final native-property delta; the owner explicitly waived a third round to enforce the two-round cap.
  • controlled 3-run Windows dogfood on exact head: all three logs reached Clicked send button; all three harvested their exact responses; each setup logged native hide; live HWND probe after concurrent tab creation showed Visible=false, Minimized=false; first completion left two leases and shared Chrome alive; final completion left zero leases and zero managed descendants
  • DWM before exact-head run: 2199.4 MB private, 1429.4 MB working set, 4676 handles, 40.8% one core. During: 2186.4 MB, 1405.4 MB, 4684 handles, 27.1%. Settled after without DWM restart: 2197.2 MB, 1419.4 MB, 4691 handles, 45.2%.

Summary by CodeRabbit

  • New Features

    • Managed Chrome windows on Windows are now hidden after isolated-tab setup to reduce desktop clutter.
    • Windows automatically reappear when human interaction is needed, including login, recovery, visible challenges, or retained debug sessions.
    • Reattach and relaunch flows now restore Chrome windows more reliably.
  • Documentation

    • Updated Windows behavior documentation and changelog notes.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 50a05812-908d-467d-81f1-ec79fafbb1f4

📥 Commits

Reviewing files that changed from the base of the PR and between b2c5ff5 and 787ee35.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • docs/windows-work.md
  • src/browser/chromeLifecycle.ts
  • src/browser/index.ts
  • src/browser/reattach.ts
  • tests/browser/chromeLifecycle.test.ts

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


📝 Walkthrough

Walkthrough

Managed Windows Chrome now hides ordinary windows after isolated-tab setup. Human authentication, challenge, and recovery flows restore windows through PID-based control, with CDP fallback behavior retained.

Changes

Windows Chrome visibility

Layer / File(s) Summary
PID-based Chrome visibility control
src/browser/chromeLifecycle.ts, tests/browser/chromeLifecycle.test.ts
hideChromeWindow now supports Windows and macOS, accepts injectable dependencies, and returns a success boolean. Shared Windows PowerShell/User32 logic hides or restores matching Chrome windows while preserving human-recovery windows. Tests cover both operations and their commands.
Managed window recovery flow
src/browser/index.ts, src/browser/reattach.ts, docs/windows-work.md, CHANGELOG.md
Browser setup, authentication, reattach, and relaunch flows now prefer PID-based restoration and use CDP normalization as fallback. Documentation records minimized-then-hidden startup and the restoration exceptions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 787ee

The change hides managed Chrome windows while preserving intentional recovery visibility, with validation and Windows dogfood completed; no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant BrowserOrchestration
  participant ChromeLifecycle
  participant PowerShellUser32
  participant CDPFallback
  BrowserOrchestration->>ChromeLifecycle: hide managed Chrome by PID
  ChromeLifecycle->>PowerShellUser32: hide matching Chrome windows
  PowerShellUser32-->>ChromeLifecycle: return visibility result
  ChromeLifecycle-->>BrowserOrchestration: return success boolean
  BrowserOrchestration->>ChromeLifecycle: restore Chrome by PID
  ChromeLifecycle->>PowerShellUser32: restore matching Chrome windows
  PowerShellUser32-->>ChromeLifecycle: return restoration result
  BrowserOrchestration->>CDPFallback: normalize target when PID restoration fails
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: hiding managed Chrome windows on Windows.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/windows-dwm-parking

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

@JJLiebig
JJLiebig merged commit 19bdbb8 into main Aug 29, 2026
4 checks passed
@JJLiebig
JJLiebig deleted the fix/windows-dwm-parking branch August 29, 2026 20:14
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.

1 participant