Skip to content

feat(observability): file logging, crash handlers, per-run script logs, toast queue#51

Merged
thisiscsim merged 1 commit into
mainfrom
feat/observability
Jul 19, 2026
Merged

feat(observability): file logging, crash handlers, per-run script logs, toast queue#51
thisiscsim merged 1 commit into
mainfrom
feat/observability

Conversation

@thisiscsim

Copy link
Copy Markdown
Owner

Summary

Audit roadmap Phase 5 (observability foundation). Before this, the main process logged nothing, had no crash/rejection handlers, and engine-script stdout/stderr was parsed then discarded — when something broke, a user could send us a screenshot of an 8-second toast and nothing else. This is also Stage 1 of the debug-console recommendation: the logging/version substrate a report bundle or command palette would build on.

Main process

  • logger.ts: leveled file logger at userData/logs/main.log (rotated at 2 MB, one backup), mirrored to the dev console.
  • installCrashHandlers() for uncaughtException/unhandledRejection; render-process-gone + unresponsive logged on the window.
  • runScriptArgs tees each script run's full stdout+stderr to userData/logs/scripts/<prefix>-<ts>.log and logs start/exit.
  • app:info IPC (version / electron / chrome / node / platform / logsDir) so a report can be correlated to a build; log:renderer IPC.

Renderer

  • window.onerror / onunhandledrejection and the ErrorBoundary now persist to the shared log via log:renderer (previously only a usually-closed DevTools console saw them).
  • Toast is now a queue (notices[]): concurrent operations no longer overwrite each other's messages; errors persist until dismissed (close button, role="alert") while info auto-dismisses. Fixes the bug where the dismiss timer restarted on every App re-render (so an error toast shown mid-edit never cleared) by keying per notice id.
  • Replaced the raw #c0392b toast hex with --foreground-danger (token).

Main-process + preload change — restart npm run dev.

Test plan

  • Store autosave-failure test updated for the queue; 101 tests green
  • typecheck / lint / format / build green
  • Manual (post-merge): trigger a failed generate → error toast persists with a close button + a line in userData/logs/scripts/…; main.log records startup + script runs

Made with Cursor

…s, toast queue

Before this the main process logged nothing, had no crash/rejection
handlers, and script stdout/stderr was parsed then discarded — a user
hitting a bug could send us a screenshot of an 8s toast and nothing else.

Main process:
- logger.ts: leveled file logger at userData/logs/main.log (rotated at
  2MB, one backup), mirrored to the dev console.
- installCrashHandlers() for uncaughtException/unhandledRejection;
  render-process-gone + unresponsive logging on the window.
- runScriptArgs tees each engine-script run's full stdout+stderr to
  userData/logs/scripts/<prefix>-<ts>.log and logs start/exit.
- app:info IPC (version/electron/chrome/node/platform/logsDir) so a report
  can be correlated to a build; log:renderer IPC.

Renderer:
- window.onerror / onunhandledrejection and the ErrorBoundary now persist
  to the shared log via log:renderer (previously only a closed DevTools).
- Toast is now a queue (notices[]): concurrent operations no longer
  overwrite each other's messages; errors persist until dismissed (with a
  close button + role=alert) while info auto-dismisses. Fixes the
  dismiss-timer-resets-on-every-App-render bug by keying per notice id.
- Replaced the raw #c0392b toast hex with --foreground-danger.

Co-authored-by: Cursor <cursoragent@cursor.com>
@thisiscsim
thisiscsim merged commit b9cac60 into main Jul 19, 2026
1 check passed
@thisiscsim
thisiscsim deleted the feat/observability branch July 19, 2026 23:24
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