Skip to content

fix: prevent GalleryDetail browser-open failures from crashing TUI#27

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

fix: prevent GalleryDetail browser-open failures from crashing TUI#27
cursor[bot] wants to merge 1 commit intomainfrom
cursor/critical-bug-inspection-102b

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor bot commented Apr 1, 2026

Summary

  • fixes a high-severity TUI crash path introduced by the gallery "open in browser" behavior
  • wraps the async browser launch in a safe helper that catches launch failures and returns a typed result
  • updates GalleryDetail to handle failures by surfacing an error message instead of allowing an unhandled rejection
  • adds focused unit tests for success, Error rejection, and non-Error rejection paths

Bug and impact

Pressing o in gallery detail triggered open(...) without await or .catch(...). If browser launch fails (for example, missing/broken opener on headless/minimal environments), the promise rejects unhandled. In Node 22, unhandled rejections terminate the process, causing immediate TUI exit (significant user-facing breakage in a critical interaction path).

Root cause

A behavioral change switched gallery detail from synchronous navigation to async browser launch, but the new async call was fire-and-forget with no rejection handling.

Fix

  • Added safeOpen helper (src/core/safe-open.ts) to contain and normalize browser-launch errors.
  • Updated src/screens/GalleryDetail.tsx to call safeOpen and set screen error state on failure.
  • Added src/core/safe-open.test.ts to lock in rejection handling behavior.

Validation

  • pnpm test src/core/safe-open.test.ts
  • pnpm typecheck
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