Skip to content

desktop start: the Cloud account is restored while this computer's server starts, so the first screen no longer waits for both in turn - #482

Merged
SiddDevZ merged 7 commits into
DuskBotAI:devfrom
Yabuku-xD:desktop-cold-start
Dec 3, 2026

Conversation

@Yabuku-xD

@Yabuku-xD Yabuku-xD commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What and why

On a desktop signed in to a dusk Cloud, the window showed about 1.8 s after its page had loaded. A packaged 0.2.38 app on a Mac logged, over four launches:

startup: … server 1161–1471ms, window 1217–1518ms, loaded 1731–2108ms, shown 3595–3864ms

The first screen waits on the Cloud account's restore: accountGate.state() awaits restored() while the client still says "restoring". The restore (ensureCloudAccount().start(), which reads the saved grant and calls GET /api/cloud/desktop/session, 586 ms in that log) started only after the local server was ready. So the account service's round trip came after the server's boot, not beside it.

The restore now starts before the server is awaited. What an account state changes on this computer asks the local server: enrollment, included services, the home window, the page. So onState now hands states to a holder (electron/held-until-released.mjs). The holder keeps them until the server is up, then applies them in order, and later states apply at once, as before. The post-restore steps (oneHome.kick, homeWindow.refresh, …) still run after the server.

How it was checked

  • electron/held-until-released.node-test.mjs:
    • States delivered before the release wait and then apply in order; later ones apply at once.
    • A source check in the style of saved-vps-startup.node-test.mjs: the restore starts once, before startPackagedAlongsideVps is awaited, and states are released after the server mark. It fails on dev's main.mjs.
  • All Electron node tests (2,283), pnpm check:electron, pnpm typecheck, pnpm lint and the CI source guards pass. electron/main.mjs stays at its 3,800-line ratchet.
  • pnpm typecheck, pnpm lint and pnpm test pass (typecheck, lint and the Electron tests pass; the whole pnpm test was not run locally)
  • New behaviour has a test
  • No secrets, personal data or local paths in the diff or screenshots

Not covered: a packaged launch with a real Cloud account. The time saved is expected to be up to the restore's round trip; I estimated it from the log, I did not measure it. scripts/verify-cloud-account.mjs uses its own harness, not this launch path.

This branch also carries the commits of #483: the fix for two tests red on dev (the find_tool ranking and the guest skill card), the flaky-test retry list for tests that failed at random in CI on Dec 1, and the link chaos fix, so this PR's CI can pass. They drop out of the diff once #483 merges.

…rver starts, not after it

The first screen waits on the account's restore (the account gate asks for it), and the restore started only once the
local server was up, so the account service's round trip (about 600 ms in a 0.2.38 log) came after the server's boot
instead of beside it. The restore now starts before the server is awaited. What an account state changes here
(enrollment, included services, the home window, the page) asks that server, so the states are held and applied in
order once it is up, as before.
… and the guest skill card test stages four kinds of work

bacb532 left two tests red on dev. Its new skill_manage description dropped the word reusable, so find_tool ranked
skills_list first for "save this procedure as a reusable skill"; the description says reusable SKILL.md again (a skill
is recurring work, which that change keeps). Its duplicate check turns away a create that covers an existing skill, and
the guest skill card test staged four skills with one description, the same as an earlier test's: each now has its own
kind of work.

(cherry picked from commit 78889fc)
…list's two retries

Fifteen tests failed in CI on Dec 1 in runs of main, a release and PRs DuskBotAI#477-DuskBotAI#483 whose changes do not reach them, a
different set each run, and pass locally. Each entry names the runs it failed in. vps-routing's 'reuses the existing
VPS with $settings' failed too (PR DuskBotAI#477, run 46623618361) but is left out: its name is made per case, and the list
matches names written in the file.

(cherry picked from commit 54f5c51)
…s 60 servers link from their own addresses

Every link chaos run since the per-address limit on new links (adc99d7, Nov 14) was cancelled at CI's 60-minute
limit, on main pushes, the weekly run and every PR that touches the link service: the scenarios finished in about five
minutes and printed their table, but a socket or timer a scenario left open held the process. The run now exits once its
results are written. The storm's 60 servers set up their links over one connection, so the node's front gave them one
address, which the limit refused after 30 (Too many new links from here); each now uses its own connection, as 60
machines would. Locally, --quick passes all 12 scenarios and exits in 5.6 minutes.

(cherry picked from commit 83ab615)
…y list's retries

chat-mcp-tools' shutdown verdict, memory-order and the encrypted workspace restore failed in PR DuskBotAI#479's run 46740020170,
whose change does not reach them, and pass locally.

(cherry picked from commit c47197f)
…os job installs no packages

The job runs `node apps/link-service/chaos/run.mjs` straight after checkout, so the undici import failed
with ERR_MODULE_NOT_FOUND before any scenario ran.
…ds nothing for 8 s, as the app does

src/lib/live-events.ts gives up on a dial that sends nothing in LIVE_EVENTS_OPEN_MS (8 s) and dials again. The probe
dropped a quiet stream only after it had sent something, so one silent dial after node-5xx's 502s held it down until
the relay closed it, about 90 s, and failed the scenario in CI on five of seven runs.
@SiddDevZ
SiddDevZ merged commit 8acb0df into DuskBotAI:dev Dec 3, 2026
33 checks passed
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.

2 participants