Skip to content

fix(electron): keep the backup-on-quit notification on screen before exit - #387

Merged
EraPartner merged 1 commit into
mainfrom
claude/project-thread-nn0swc
Oct 29, 2026
Merged

EraPartner merged 1 commit into
mainfrom
claude/project-thread-nn0swc

Conversation

@EraPartner

Copy link
Copy Markdown
Owner

Requested by EraPartner · project thread

Summary

After ⌘Q, the "backup done" notification no longer appears, though the backup runs. Tor's main.log has no quit timeout or failure after 2026-10-19, and encrypted .visionbak files were written on 2026-10-28. The launch notification ("Vision is running") still shows, so macOS permission is not the cause.

Cause (partly inference): on macOS, Electron removes the notifications a process delivered when that process exits. The quit path posts the backup notification and then exits (packaging/electron/main.ts, will-quit handler), so the notification can disappear before anyone sees it. Evidence that Electron does this:

  • On Electron main, CocoaNotification::~CocoaNotification calls removeDeliveredNotificationsWithIdentifiers, and the presenter deletes its live notifications when it is destroyed.
  • Unverified: that Electron 44.9.1 does the same, and that the 43 → 44 bump (chore(deps): bundle Dependabot JS and Electron 44 bumps #300, 2026-10-19) is when the notification stopped showing. The dates match, but I have not confirmed it in the 44 source.

Fix:

  • notify() now returns the Notification it posts.
  • New whenNotificationSeen() waits until the notification's show event plus 4 s, or 4 s if show never fires.
  • app.exit waits for that after a backup-on-quit result. The runtime shutdown runs during the wait.
  • The 45 s hard quit timeout still applies.

Type of change

  • fix — bug fix

Checklist

  • Types check (bun run typecheck:electron, bun run typecheck)
  • Conventional Commit title
  • No leftover debug code
  • No docs change: the quit-time notification timing isn't documented.
  • No i18n change

Architecture & data

  • No architectural change
  • No API change
  • No schema change

Verification

  • bun run typecheck:electron: clean.
  • eslint -c eslint.projects.config.mjs packaging/electron/main.ts: clean.
  • bun run test:electron: 213 tests, 211 pass, 0 fail.
  • Not run on a Mac. Tor confirms by quitting with backup-on-quit enabled.

Residual risk & follow-ups

  • When backup-on-quit runs and shutdown is fast, quit now takes up to about 4 s longer.
  • The "Vision stopped" notification is still posted right before exit, so it probably still vanishes. Making it visible would add another wait on every quit, so this PR leaves it alone.

Generated by Claude Code

…exit

Electron removes a process's delivered notifications from Notification
Center when the app exits, so the backup done/failed notification posted
during quit could vanish before it was seen. Hold app.exit until the
backup result has been shown for 4 s (overlapping the runtime shutdown),
still bounded by the 45 s hard quit timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018QJtaJyUDKFXsJBGWyqGCE
@EraPartner EraPartner self-assigned this Oct 29, 2026
@github-actions

Copy link
Copy Markdown

Coverage Report for backend

Status Category Percentage Covered / Total
🟢 Lines 91.06% (🎯 80%) 23170 / 25443
🟢 Statements 89.33% (🎯 78%) 24933 / 27910
🟢 Functions 91.44% (🎯 76%) 5004 / 5472
🟢 Branches 81.61% (🎯 68%) 17481 / 21419
File CoverageNo changed files found.
Generated in workflow #1960 for commit 6dd8fb6 by the Vitest Coverage Report Action

@EraPartner
EraPartner marked this pull request as ready for review October 29, 2026 19:45
@EraPartner
EraPartner merged commit 4072152 into main Oct 29, 2026
11 checks passed
@EraPartner
EraPartner deleted the claude/project-thread-nn0swc branch October 29, 2026 19:45
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.

2 participants