Repository navigation
fix(desktop): recover failed beta servers and clean unused CLI stages - #57321
Open
kitlangton wants to merge 1 commit into
Open
kitlangton wants to merge 1 commit into
kitlangton wants to merge 1 commit into
Conversation
kitlangton
force-pushed
the
beta-adopt-server
branch
from
October 20, 2026 07:02
a0d2916 to
ad558a9
Compare
kitlangton
force-pushed
the
beta-adopt-server
branch
from
October 20, 2026 07:20
ad558a9 to
a8d6b60
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Follow-up to #57309 based on review findings:
version: undefinedonbeta,decide()in@opencode/client/servicenever replaced a failed (500) or timed-out (503) server from an older beta build.cleanStageswhen adopting an existing server left older ~200 MB staged CLI directories accumulating underuserData/cli/<version>-<arch>.What Changes
Service.ensureonce withversion: cli.versionwhen an unpinned betaensurefails with"Background service failed to start"or"Timed out waiting for the background service to start", while keeping404protocol incompatibility as a startup error.cleanStageson initial launch when the running server's version is known fromfile ?? client.fallback(), passingkeep: keptStages(cli.version, runningVersion)so both the bundled stage and the running server's stage stay on disk while older stages are removed. If reading the registry fails (runningVersionundefined), skip stage cleanup so an adopted server's stage is never deleted.reconnectusingserviceVersion(...)(undefined) so auto-reconnects (for example after sleep/wake or SSE drop) never replace a healthy adopted server. Follow-up: add an explicit in-app restart button and an API revision handshake on/api/infoto detect protocol skew directly.sidecar-probe.tstoconst version = CHANNEL === "beta" ? undefined : bundledVersion(); if (version === "") return. Note for rebasing with feat(desktop): preserve Drive-managed development state #57112:background-service.tsshould usedrive ? undefined : serviceVersion(...)when those lines meet.cli-version.test.tsto 33 lines (serviceVersion,keptStages, andshouldRetryEnsuretables).Decision Table
/api/info)beta200,{ version, pid })reuse), keep bundled + running stages, clean older stagesbeta503,{ version, pid })wait), then adopt; if startup times out, retry withcli.version(replace)beta500,{ version, pid })failretries once withcli.version→ replace (clear)betareplace/ spawn) and clean unused stagesbeta404on/api/info)localServerStartup)prod(stable)200,{ version, pid })reuse)prod(stable)404replace)Scope
packages/client/src/promise/service.tspackages/desktop/src/main/service/cli-version.tspackages/desktop/src/main/service/cli-version.test.tspackages/desktop/src/main/service/cli-stages.tspackages/desktop/src/main/service/cli-stages.test.tspackages/desktop/src/main/service/desktop-cli.tspackages/desktop/src/main/service/sidecar-probe.tspackages/desktop/src/main/service/background-service.tsVerification
bun test src/main/service/cli-version.test.ts src/main/service/cli-stages.test.ts src/main/service/background-service-state.test.tsinpackages/desktopbun run typecheckinpackages/desktopandpackages/clientbun run lint:changed origin/beta