fix: resolve macOS auto-update state regression and apply-update.sh hang#130
Merged
Conversation
Three bugs fixed in the Coderm update service: 1. State guard in doCheckForUpdates: If the user already downloaded/installed an update while a background check was in-flight, the stale response would overwrite the advanced state (Downloaded/Ready) back to Idle. Added a guard to skip setState when state has moved past CheckingForUpdates. 2. Disable supportsUpdateOverwrite: The overwrite check mechanism calls isLatestVersion() which expects a VSCode update server (204 for up-to-date). Coderm's GitHub Releases URL always returns 200 HTML, causing false positives that reset Ready state back to AvailableForDownload. 3. PID-based wait in apply-update.sh: The script used pgrep -f "Coderm" which matched dev tools (esbuild, tmux, crashpad, node watchers), causing an infinite loop. Changed to kill -0 $PID to wait only for the specific spawning Coderm process. Also improved logging throughout (trace/info/error levels with detailed context) for easier future debugging.
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.
Summary
macOS自動アップデートで3つのバグを修正:
Bug 1: State guard in doCheckForUpdates
バックグラウンドのアップデートチェック応答が遅延して戻ってきた場合、既にDownloaded/Ready状態に進んでいるにもかかわらず、古い応答がIdle状態に戻してしまう問題。CheckingForUpdates以外の状態ではsetStateをスキップするガードを追加。
Bug 2: supportsUpdateOverwrite を無効化
overwriteチェックは
isLatestVersion()を呼び出し、VSCodeのアップデートサーバー(最新なら204を返す)を期待する。CodermのGitHub Releases URLは常に200 HTMLを返すため、誤検知でReady状態がAvailableForDownloadにリセットされてしまう。Bug 3: apply-update.sh のPIDベース待機
スクリプトが
pgrep -f "Coderm"を使用していたため、esbuild/tmux/crashpad/node watcherなど関係ないプロセスにマッチし、無限ループを引き起こしていた。kill -0 $PIDに変更し、起動元のCodermプロセスのみを待機するよう修正。Additional
ロギングを本番品質に改善(trace/info/errorレベルに整理、詳細コンテキスト付与)
Testing
npx gulp vscode-darwin-arm64) で動作確認済み20260522T172136/main.logでupdate#setState readyが最終ステートであることを確認Files Changed
src/vs/platform/update/electron-main/codermUpdateService.darwin.ts(3修正 + ログ改善)src/vs/platform/update/electron-main/codermUpdateService.win32.ts(Bug 1 & 2の一貫性修正)