Skip to content

feat(startup): log a single launch phase timeline per launch (#843) - #849

Merged
h4yfans merged 3 commits into
mainfrom
startup-launch-phase-timing
Jul 22, 2026
Merged

feat(startup): log a single launch phase timeline per launch (#843)#849
h4yfans merged 3 commits into
mainfrom
startup-launch-phase-timing

Conversation

@h4yfans

@h4yfans h4yfans commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #843.

Why

Prod installs hit the 10s ready-to-show fallback (×6 / 4 installs, linux + win32, v2026.719.2) and the only log line said the deadline was missed — never which phase ate the time. Instrumentation-first: this makes the next triage round attributable.

What

apps/desktop/src/main/launch-timeline.ts stamps each startup milestone's offset from process start and emits them as one structured line, launch timeline, when the window is revealed:

Field Meaning
appReadyMs app.whenReady() startup work finished
windowCreatedMs main BrowserWindow constructed
vaultOpenStartMs / vaultOpenReadyMs vault restore started / reached isOpen
rendererLoadedMs renderer did-finish-load
readyToShowMs first ready-to-show (absent when it never fired)
shownMs window actually revealed
reason ready-to-show, fallback-timeout, or did-fail-load
fallback true when the 10s fallback fired
vaultOpenPending vault open still running at reveal — the prime suspect

Notes on the choices:

  • Vault timing stops at isOpen, not at the autoOpenLastVault() promise, which also waits on the first full sync. isOpen is the main-process work (migrations, indexing) that can actually block the reveal. A launch onto the picker records no vault phase at all, so it can't report a forever-pending open.
  • warn when the reveal came from the fallback or took ≥5s, info otherwise. Only warn/error reach the diagnostic log sink, so pathological launches ship and healthy ones stay local.
  • recordLaunchPhase() still forwards every phase to the existing app_launch_phase_completed telemetry event — those dashboards are unchanged, and the existing "did not fire within 10s" warn line stays put.
  • The seven *Ms fields are allowlisted as numerics in shared redaction, otherwise they'd ship as scrubbed text instead of numbers.

Verification

  • vitest --project main — 4017 pass, 0 fail (5 new launch-timeline tests + fallback-reveal wiring assertion in index.phase2.test.ts)
  • @memry/contracts — 1524 pass, 0 fail (new redaction passthrough test)
  • typecheck (desktop node + web, contracts), lint (0 errors), ipc:check, contract + architecture boundary checks
  • docs:impact --base origin/main --strict → covered; docs:build clean

Follow-up

Re-triage prod logs once a release carrying this is out — the slow phase names the real issue. Note #821 (embeddings off the vault-open blocking path) is merged but unreleased and is one of the candidate causes; if it lands in the same release, vaultOpenReadyMs should show it.

🤖 Generated with Claude Code

h4yfans added 2 commits July 22, 2026 17:35
Prod installs hit the 10s 'ready-to-show' fallback and the logs only said
the deadline was missed, never which phase ate the time. Stamp each startup
phase's offset from process start and emit them as one structured line when
the window is revealed, so a slow launch is attributable from one record.

- new launch-timeline.ts owns the marks, forwards each to the existing
  per-phase telemetry event, and emits the summary once
- adds vault open start -> isOpen timing (the main-process work that is the
  prime suspect); reported as vaultOpenPending when still running at reveal
- warn level on a fallback or >=5s reveal so it ships to the log sink, info
  otherwise so healthy launches stay local
- allowlists the phase offset fields as numerics in shared redaction
Copilot AI review requested due to automatic review settings July 22, 2026 14:38
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
memry-docs Ignored Ignored Preview Jul 22, 2026 4:25pm
memrynote-landing Ignored Ignored Preview Jul 22, 2026 4:25pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit b1a53b7.

@github-actions github-actions Bot added documentation Improvements or additions to documentation enhancement New feature or request test labels Jul 22, 2026
Copilot AI review requested due to automatic review settings July 22, 2026 16:22
@h4yfans
h4yfans marked this pull request as ready for review July 22, 2026 16:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@h4yfans
h4yfans merged commit d94242f into main Jul 22, 2026
15 of 19 checks passed
@h4yfans
h4yfans deleted the startup-launch-phase-timing branch July 22, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Startup: ready-to-show 10s fallback firing — add launch phase timing instrumentation

2 participants