Skip to content

refactor(desktop): register startup tasks - #5414

Draft
colaforniaw wants to merge 5 commits into
apache:mainfrom
colaforniaw:refactor/desktop-startup-task-registry
Draft

colaforniaw wants to merge 5 commits into
apache:mainfrom
colaforniaw:refactor/desktop-startup-task-registry

Conversation

@colaforniaw

@colaforniaw colaforniaw commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Make the startup task graph the production scheduling authority for Desktop Runtime Host boot.

runtime-host-boot.ts now only supplies task implementations to the production registry and invokes one runAll() entry point. The runner validates the complete graph before execution, performs a deterministic topological sort with registration order as the tie-break for ready peers, and models fire-and-forget startup work explicitly as detached tasks.

The existing boot module has a large shared context, so this milestone uses the permitted migration slice: resolve-shell-env runs first, then a legacy-runtime-host-sequence placeholder dynamically imports the existing boot body, and the migrated post-render/background nodes run through the same production graph. This narrows the migration surface without restoring per-task production runTask calls. Every task still transitively depends on resolve-shell-env, preserving the #1316 requirement before store, tool, or child-process work.

The registry also records task start/completion timestamps, duration, phase, execution mode, and failure status through a diagnostic log observer. Measurement failures are isolated from startup behavior. This establishes the B-2 scheduling baseline without changing startup dispatch order or adding concurrency.

This is behavior-preserving: the effective startup dispatch order, synchronous throw timing, detached boundaries, and startupStep / updateDesktopStartupProgress cadence remain unchanged. main.ts startup gates and the public signatures of startup-presentation.ts and workhub-presentation.ts are unchanged.

Refs #5380

Manual orchestration removed

  • Removed the module-top-level chain of startupTasks.runTask(...) and runTaskSync(...) calls from runtime-host-boot.ts; production execution now has one registry.runAll() entry point.
  • Removed graph-external guest Session mount restoration and Local Runtime Host remote-access recovery kickoffs.
  • Removed graph-external enabled-profile autostart and unavailable-default recovery kickoffs.
  • Removed graph-external MCP readiness startup and interrupted MCP login resume kickoffs.
  • Removed graph-external Client Settings startup refresh.
  • Removed source-text indexOf(...) assertions that treated call position as a second startup sequence; the sequence test now imports the production registration seam, runs runAll(), and asserts execution events.

Verification

  • npm --workspace @maka/desktop run build:with-deps
  • npm run build:test
  • npm --workspace @maka/desktop run typecheck
  • npm run format:check
  • npm run lint
  • npm --workspace @maka/desktop run test:dist: 2695 passed across 193 suites.
  • npx playwright test --config e2e/playwright.config.ts e2e/workhub-reconstruction.spec.ts: 1 passed.
  • git diff --check

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex implemented the registry migration and tests, performed the fixed-snapshot review and rebase conflict audit, and ran verification. The commits include a Generated-by: Codex trailer.

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

@colaforniaw
colaforniaw marked this pull request as draft September 16, 2026 16:26
@github-actions github-actions Bot added the effort/L Under 1000 readable lines label Sep 16, 2026
@colaforniaw
colaforniaw force-pushed the refactor/desktop-startup-task-registry branch from aff66df to eb1a013 Compare September 17, 2026 07:54
@colaforniaw
colaforniaw force-pushed the refactor/desktop-startup-task-registry branch from f3eb13f to 0382f09 Compare September 17, 2026 08:23
colafornia added 2 commits September 17, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/L Under 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant