Skip to content

chore(desktop): preserve appearance during CDP diagnostics - #59681

Merged
usrnk1 merged 2 commits into
devfrom
preserve-cdp-theme
Oct 27, 2026
Merged

usrnk1 merged 2 commits into
devfrom
preserve-cdp-theme

Conversation

@usrnk1

@usrnk1 usrnk1 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Attach the desktop startup harness with Playwright's noDefaults: true so observing Electron preserves its native media and focus preferences.
  • Document the same requirement for agents attaching to a user's live desktop window.

Cause

Playwright applies light-mode media emulation by default when connectOverCDP attaches to an existing browser. A desktop app following the system theme immediately follows that override, then returns to dark when the connection closes.

The investigation captured a 23 ms dark → light → dark transition with two bright frames, coinciding with another agent's diagnostic attachment. No reload occurred. The fix belongs in the attachment, not in application theme handling; this PR does not change production theme code.

Verification

  • Three default Playwright attachments each forced light mode; three attachments with noDefaults: true preserved dark mode with zero media-query changes.
  • bun run check — passed (existing lint warnings).
  • bun typecheck in packages/app — passed.
  • bun test ./e2e/performance/unit/desktop-startup.test.ts in packages/app — 4 passed.
  • bun run lint:changed — passed.
  • Prettier check and git diff --check — passed.
  • bun run typecheck:e2e in packages/app — reports 11 existing errors in unrelated files; reproduced the identical errors on clean origin/dev at 432d870b02.

No investigation probes, screenshots, or other transient artifacts are committed.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The change looks sound: the startup harness already fails a run if the desktop theme changes during startup (requireStableTheme). Playwright's default attachment forces light mode, so the attachment itself could trip that check on a dark system. noDefaults: true is supported by the pinned Playwright 1.60.0. The harness doesn't use downloads, so turning off Playwright's other default overrides shouldn't affect it.

I couldn't run it myself, because the benchmark launches the real Electron app and this environment has no display for it. The desktop-startup unit tests pass (4 tests). typecheck:e2e reports 11 errors, none in the changed file, the same count you reported for clean dev.

Public API: unchanged (benchmark harness and AGENTS.md only).

No blocking concerns.

@usrnk1
usrnk1 enabled auto-merge (squash) October 27, 2026 18:13

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The new commit only merges dev into the branch and doesn't change this PR's diff, so my earlier review still applies. Public API: unchanged. No new concerns.

@usrnk1
usrnk1 merged commit b431db8 into dev Oct 27, 2026
20 checks passed
@usrnk1
usrnk1 deleted the preserve-cdp-theme branch October 27, 2026 19:46
alsuren pushed a commit to alsuren/opencode that referenced this pull request Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant