Skip to content

fix: prevent GalleryDetail crash when browser launch fails#25

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/critical-bug-inspection-c23a
Draft

fix: prevent GalleryDetail crash when browser launch fails#25
cursor[bot] wants to merge 1 commit intomainfrom
cursor/critical-bug-inspection-c23a

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor bot commented Mar 30, 2026

Summary

  • Fix a critical TUI crash in GalleryDetail when pressing [o] to open a generation and system browser launch fails
  • Add a small safe helper (openGenerationInBrowser) that catches launch errors and returns a typed message
  • Update GalleryDetail to call the helper with void ...then(...) and surface a non-fatal warning in the UI instead of crashing
  • Add focused tests for browser open success/failure behavior

Bug and impact

Pressing [o] open in browser in GalleryDetail could terminate the entire CLI/TUI session in headless or unsupported environments (or when no browser handler is available). This is a high-severity user-facing breakage because a single keypress exits the app unexpectedly.

Root cause

open(...) was called in an Ink useInput handler without awaiting or catching rejection. In Node, unhandled promise rejections terminate the process, so browser-launch failure crashed the app.

Fix and validation

  • Wrapped browser launching in a helper that always catches errors and returns string | null
  • GalleryDetail now handles failures by showing Could not open browser: ... and keeps the app running
  • Validation performed:
    • pnpm typecheck
    • pnpm test src/core/browser.test.ts
    • pnpm test src/core/clipboard.test.ts
Open in Web View Automation 

Co-authored-by: Dylan Boudro <starmorph@users.noreply.github.com>
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