Skip to content

fix: queue workspace updates as one build and stop autostart races - #1115

Draft
EhabY wants to merge 2 commits into
mainfrom
fix/1095-update-reconnect-race
Draft

EhabY wants to merge 2 commits into
mainfrom
fix/1095-update-reconnect-race

Conversation

@EhabY

@EhabY EhabY commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Problem

coder update runs a stop build and then a start build. Between the two, the extension's own coder ssh reconnect autostarts the workspace on the old template version, so the update's start build is rejected:

stopped → starting   reason: ssh_connection
"A workspace build is already active"

The workspace restarts on the version it already had, and the extension logs a warning and connects anyway.

Changes

  • Servers from 2.36: post a single build that carries the start in on_success, so nothing can take the build slot in between. template_version_id stays unset on the follow-up build, because pinning it requires template update permission and the update targets the active version anyway.
  • Servers before 2.36: unchanged. coder update, or REST on CLIs before 2.24.
  • Every path: --disable-autostart becomes an internal SSH flag, so a custom coder.sshFlags value cannot drop it.
  • On failure: a modal offers Connect Anyway rather than falling back to the old version silently.

The state machine ignores monitor events older than the accepted build and waits for the server to create the start build instead of racing it.

Validation

pnpm lint, pnpm typecheck, pnpm format:check, and pnpm test (2,691 passed, 1 skipped). No live SSH-race reproduction or Windows smoke test.

Fixes #1095.

🤖 Generated with Claude Code

@EhabY
EhabY force-pushed the fix/1095-update-reconnect-race branch from 492f431 to 668ce42 Compare September 17, 2026 16:43
`coder update` runs a stop build and then a start build. Between the
two, the extension's own `coder ssh` reconnect autostarts the workspace
on the old template version, so the update's start build is rejected
with "A workspace build is already active" and the workspace comes back
unchanged.

On servers from 2.36, post a single build that carries the start in
`on_success`, so nothing can take the build slot in between. Leave
`template_version_id` unset on the follow-up build, because pinning it
requires template update permission and the update targets the active
version anyway. Servers before 2.36 keep the `coder update` path, and
CLIs before 2.24 keep the REST path.

Pass `--disable-autostart` as an internal SSH flag so a custom
`coder.sshFlags` value cannot drop it, and ask before connecting to the
existing version when an update fails instead of falling back silently.

Fixes #1095
@EhabY
EhabY force-pushed the fix/1095-update-reconnect-race branch from 668ce42 to bf287af Compare September 17, 2026 17:11
@EhabY EhabY changed the title fix: coordinate workspace updates and prevent SSH autostart races fix: queue workspace updates as one build and stop autostart races Sep 17, 2026
The ProxyCommand expectations hardcoded POSIX separators, so they failed
on Windows, where the paths are joined with backslashes and then quoted.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

Updating workspace via VS Code fails

1 participant