Skip to content

[codex] Structure Electron window failures#3276

Merged
juliusmarminge merged 2 commits into
mainfrom
codex/desktop-electron-window-errors
Jun 20, 2026
Merged

[codex] Structure Electron window failures#3276
juliusmarminge merged 2 commits into
mainfrom
codex/desktop-electron-window-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • attach a schema-safe diagnostic snapshot of BrowserWindow constructor inputs while preserving the exact native creation cause
  • structure native list, focus, inspection, reveal, renderer-send, and destroy failures with operation, platform, window, channel, and exact cause context
  • preserve the existing defect semantics for lifecycle operations while making those defects observable and correlated
  • construct errors directly; keep messages derived from structural fields and independent from cause text
  • cover creation, enumeration, reveal, message delivery, destroy, and destroyed-window filtering

Validation

  • vp test apps/desktop/src/electron/ElectronWindow.test.ts
  • vp check (0 errors; existing unrelated warnings only)
  • vp run typecheck

Note

Medium Risk
Touches core desktop window lifecycle (create, enumerate, reveal, broadcast, destroy); failures now die via orDie, so upstream fiber handling matters for stability.

Overview
Electron window failures now surface as schema-backed errors instead of bare defects or generic messages.

ElectronWindowCreateError carries a sanitized snapshot of the requested BrowserWindow options (title, size, frame, and selected webPreferences only—no icon or spellcheck), keeps the original native cause, and builds a stable message from title/dimensions without echoing cause text. isElectronWindowCreateError is added for typed handling.

A new ElectronWindowOperationError wraps list/focus/inspect/reveal/send/destroy paths with operation, platform, optional windowId and channel, and cause; native throws are caught and propagated via Effect.orDie. Window enumeration and destroyed checks go through shared listWindows / isWindowDestroyed helpers so currentMainOrFirst, focusedMainOrFirst, sendAll, destroyAll, and syncAllAppearance share the same failure shape.

Tests mock BrowserWindow construction and IPC operations to assert option redaction, cause preservation, and operation metadata across create, enumerate, reveal, send, and destroy failures.

Reviewed by Cursor Bugbot for commit 2effa73. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Structure Electron window operation failures as typed errors with diagnostic context

  • Adds ElectronWindowOperationError, a tagged error carrying operation, platform, windowId, and channel fields, surfaced as defects from reveal, sendAll, destroyAll, and window enumeration.
  • Extends ElectronWindowCreateError with a sanitized snapshot of BrowserWindow constructor options and a descriptive message including optional title and dimensions.
  • Refactors internal helpers listWindows and isWindowDestroyed in ElectronWindow.ts to wrap Electron API calls in Effect.try, mapping exceptions to structured errors before dying.
  • sendAll and syncAllAppearance now skip destroyed windows using the safe isWindowDestroyed helper.
  • Expands the test suite in ElectronWindow.test.ts to cover error propagation for all affected operations.

Macroscope summarized 2effa73.

Capture a schema-safe BrowserWindow request snapshot while preserving the exact native constructor failure.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5e41ee74-719f-4471-a5ad-f0acb034e718

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/desktop-electron-window-errors

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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds structured error types for Electron window operations without changing runtime behavior. It's a self-contained error handling improvement with comprehensive test coverage for all new error paths.

You can customize Macroscope's approvability policy. Learn more.

Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 11:59

Dismissing prior approval to re-evaluate 2effa73

@juliusmarminge juliusmarminge changed the title [codex] Structure Electron window creation errors [codex] Structure Electron window failures Jun 20, 2026
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Jun 20, 2026
@juliusmarminge
juliusmarminge merged commit c7b375e into main Jun 20, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the codex/desktop-electron-window-errors branch June 20, 2026 19:23
aaditagrawal added a commit to aaditagrawal/t3code that referenced this pull request Jun 24, 2026
…ime-diagnostics

[codex] Structure Electron window failures (pingdotgg#3276)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant