refactor(desktop): startup task registry

Open
#5,380 1 comment 0 reactions 1 assignee View on GitHub

@colaforniaw is already working on this.

Since Sep 16, 2026.

Assessment

This issue has not been assessed yet.

Description

enhancement

Problem

runtime-host-boot.ts is a ~2,290-line side-effect module whose startup work is ordered by implicit top-level awaits and scattered void-backgrounded promises (guest mounts, remote-access recovery, profile autostart, MCP readiness, settings effects). Ordering constraints live only in comments — #1316 deliberately resolves login-shell PATH before any store, tool, or child-process spawn — so a new startup task has no declared place to go, and an accidental reordering is only caught by runtime symptoms. The module keeps accreting: recent features (managed artifact preview, browser IPC wiring) added more awaits and quit hooks to the same file.

Desired outcome

Startup work registers as tasks with declared phases and dependencies, and the runner derives scheduling from the graph:

  • tasks without an ordering edge may run concurrently,
  • work not needed before the first frame can defer itself there,
  • hard constraints — single-instance lock and userData isolation first; login-shell PATH resolved before any child-process spawn (#1316) — are enforced edges in the declared graph rather than comment conventions.

#5296 already centralized startup-time value resolution (revealMode in startup-context.ts); this extends the same direction from values to tasks.

Non-goals

  • Weakening any existing mandatory ordering (lock/userData first; #1316 PATH-before-spawn).
  • Behavior-changing parallelism or deferral without measurement: land the registry reproducing today's effective ordering first, then flip scheduling as a separately measured change.
  • The module-top sequence in main.ts — dev/prod userData isolation, single-instance lock, dynamic import — is unchanged.

Acceptance

  • Phase/dependency registry exists; existing boot steps registered with phases and deps
  • #1316's PATH constraint encoded as a declared edge
  • Effective startup ordering unchanged (same-sequence test)
  • Follow-up: dependency-permitted concurrency/deferral landed as a separately measured change

Related work

  • #1316 — the PATH-before-spawn constraint any scheduling must preserve
  • #5296 — centralized startup-context values; precedent for this consolidation
  • #2913 — the startup data-flow wait ("startup waits for the complete snapshot before mounting React") is complementary and can later land on the same scheduler
Dominant language
TypeScript
Stars
5.6k
Forks
518
Avg merge
1d 3h
Merged PRs (30d)
684

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/maka

All issues in apache/maka

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.