Skip to content

fix: resolve macOS auto-update state regression and apply-update.sh hang#130

Merged
j4rviscmd merged 1 commit into
mainfrom
macos-update-diag
May 22, 2026
Merged

fix: resolve macOS auto-update state regression and apply-update.sh hang#130
j4rviscmd merged 1 commit into
mainfrom
macos-update-diag

Conversation

@j4rviscmd
Copy link
Copy Markdown
Owner

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

  • Production build (npx gulp vscode-darwin-arm64) で動作確認済み
  • Download → Install → Restart → Update applied の全フロー正常動作確認
  • ログセッション 20260522T172136/main.logupdate#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の一貫性修正)

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.
@j4rviscmd j4rviscmd merged commit 35d4bc6 into main May 22, 2026
2 checks passed
@j4rviscmd j4rviscmd deleted the macos-update-diag branch May 22, 2026 09:07
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.

1 participant