Skip to content

fix(server): remote updates no longer fail when the staged preflight is slow on a loaded host - #28201

Merged
juliusmarminge merged 2 commits into
mainfrom
fix/issue-28198
Nov 2, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
fix/issue-28198

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

Problem

A remote (boot-service) server update fails on a heavily loaded host: the staged runtime's __service-preflight is killed by a fixed 30 s timeout while it is still cold-starting, so the update ends with "Could not prepare t3@." and the host stays on the old version.

Reproduced on main with a real launcher-managed server paired as a remote environment in the web client, clicking "Update for ", with a staged runtime whose preflight takes 45 s (standing in for a cold start on a swapping host):

  • socket kept up: the preflight is killed at 30 000 ms and the client shows "Server update failed: Could not prepare [email protected].";
  • host frozen for 22 s once the preflight starts (like the reporter's event-loop stall, which drops the client socket): same server failure, PinnedRuntimeInstallError caused by ProcessTimeoutError ... timed out after 30000ms.

Change

PREFLIGHT_TIMEOUT in apps/server/src/cloud/selfUpdate.ts goes from 30 seconds to 3 minutes. The preflight only starts the new runtime and reads the database's migration head, so a slow host now gets time to finish its cold start. A preflight that hangs still fails, just after 3 minutes instead of 30 s.

Scope and approval

Fixes #28198

Triaged via the automated issue flow.

Verification

  • New test server self update > waits for a staged preflight that takes a minute on a loaded host in apps/server/src/cloud/selfUpdate.test.ts. Its fake preflight takes 60 s on the TestClock and enforces the caller's timeout the way ProcessRunner does. On main it fails with ServerSelfUpdateError: Server update failed: Could not prepare [email protected]. (cause: PinnedRuntimeInstallError ... (cause: ProcessTimeoutError: ... timed out after 30000ms)). On this branch all 10 tests in the file pass.
  • vp run check:changed: format, lint, knip, typecheck and tests all pass.
  • Runtime transcript from a real launcher-managed server (synthetic home, fake launcher parent over IPC, local release server; trace spans from server.trace.ndjson):
## main @15fe283272, run A (22 s host stall, client socket dropped) then run B (no stall)
ws.rpc.server.updateServerWithProgress 22586 ms Interrupted
processRunner.runProcessCore           30016 ms Interrupted
cloud.pinned_runtime.ensure_installed  30085 ms Failure  PinnedRuntimeInstallError: ... running the staged service preflight.
cloud.server_self_update.update        30088 ms Failure  ServerSelfUpdateError: Server update failed: Could not prepare [email protected].
processRunner.runProcessCore           30010 ms Interrupted
cloud.pinned_runtime.ensure_installed  30046 ms Failure  PinnedRuntimeInstallError: ... running the staged service preflight.
cloud.server_self_update.update        30047 ms Failure  ServerSelfUpdateError: Server update failed: Could not prepare [email protected].
ws.rpc.server.updateServerWithProgress 30048 ms Failure  ServerSelfUpdateError: Server update failed: Could not prepare [email protected].

## fix/issue-28198 @3c15d4700b, run A (same 22 s stall)
ws.rpc.server.updateServerWithProgress 22209 ms Interrupted
processRunner.runProcessCore           45017 ms Success
cloud.pinned_runtime.ensure_installed  45078 ms Success
[launcher] message {"type":"request-update","targetVersion":"0.1.6",...}
cloud.server_self_update.update        45085 ms Failure  ServerSelfUpdateError: Server update failed: fake launcher: not activating

The last failure is the scratch launcher refusing on purpose. A real boot-service launcher activates the staged runtime at that point. The driver scripts (fake launcher, release server, stall script) are scratch and not part of this PR.

Not checked: a real loaded host, the desktop app as the client, macOS and Windows hosts. A server-only fix has no render path, so there are no captures.

Model and harness: Claude Opus 5.5 (claude-opus-5-5) via Claude Code in T3 Code; reviews by Codex gpt-6.1-sol and Claude Opus 5.5.

🤖 Generated with Claude Code

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fix PR opened by an issue lead; enters the PR loop pr:ready Every gate passed; waits for Julius's land label size:XS 0-9 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote server update fails when the staged preflight exceeds 30 s on a loaded host, and the app shows only "SocketReadError"

1 participant