← Back to Pull requests

feat(desktop): decouple first paint from Runtime Host readiness #5494

Closed
unknown closed this pull request without merging on Sep 21, 2026 10:48 UTC
View on GitHub
unknown unknown commented on Sep 18, 2026 15:58 UTC
Author

Summary

Runtime Host readiness used to be a startup precondition: boot awaited connect → handoff → managed update before creating the main window, and a separate StartupProgressWindow carried all progress and attention UI. A stuck handoff (the staging → retry_required loop in #5476) therefore blocked the entire app behind a modal window whose only remaining action was cancel.

This PR makes first paint independent of Host readiness, per the direction agreed in #5488:

  • main.ts creates the main window and registers all IPC first; startLocalRuntimeHostManager still launches immediately, but in a fire-and-forget continuation.

  • The reconnectable IPC gate keeps its existing per-epoch wait (up to 15 s), so Host-dependent operations wait for the ready target instead of blocking window creation.

  • Handoff attention views — the only states that need a user decision — surface inside the main window through a new runtimeHostHandoff preload bridge and RuntimeHostHandoffOverlay. Progress views stay silent; there is no separate window.

  • The renderer mounts immediately; the pre-mount onboarding snapshot prefetch is deleted and useOnboardingSnapshot hydrates asynchronously behind the existing preload skeleton.

  • Session data already degrades correctly: the session-local catalog returns cached entries while authority is unavailable, and sends go through the durable outbox, which delivers once a ready target appears.
  • Removals in the same change: StartupProgressWindow + startup-presentation.ts, prefetchOnboardingSnapshot + initialOnboardingSnapshot plumbing, stale attention fields leaking into progress handoff views (the view is now a discriminated union — also the source of #5476's misleading reason display), and the pre-dev.9 file-lock compatibility half-layer.

    Fixes #5488

    Breaking change

    Runtime Host builds older than dev.9 are no longer a supported update source. The legacy dir-lock / inherited-fd operator lease interop (withLegacyFileUpdateLockLease, withRuntimeHostManagedServiceLegacyOperatorLeases, and the process-lifetime-lock-v1 capability probe in the update path) is removed. Current process-lifetime locking, stale .supervised marker recovery, and the .lock directory wait are unchanged.

    Verification

  • npm run build:workspace-deps; npm --workspace @maka/desktop run build:main and build:renderer — pass

  • node --test --test-concurrency=4 on the affected desktop suite — 117/117; onboarding snapshot suite 35/35; cli + runtime-host suites 63/63

  • npm --workspace @maka/desktop run typecheck:stories, build-storybook, smoke:storybook — pass (380 stories / 409 theme renders, including 3 new overlay stories)

  • npm run format, npm run lint — clean
  • The surface this replaces — BEFORE rendered from main's renderStartupProgressHtml with the same attention view, AFTER is the new overlay story:

    Light:

    !handoff light comparison

    Dark:

    !handoff dark comparison

    AI use

    Select exactly one:

  • No generative tool made a substantive contribution

  • Generative tooling made a substantive contribution
  • Tool(s) and scope: Devin — root-cause investigation, implementation, tests, stories, verification, and this PR description.

    Checklist

  • Tests cover the change and fail without it

  • Lint, format, typecheck and the affected suites pass locally
  • Does this PR entail a change in behavior?

  • Yes — described under Summary above

  • No
  • Diff: 454 lines (+340 / -114) across 5 files Reviewer: M4n5ter Review duration: 4010m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 454 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.366
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5494"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.5% (MEDIUM) · Higher = larger blast radius
    45.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.0% · Safe to merge
    18.0%
    Repository