fix(coderd): reject redundant SSH autostarts of running workspaces - #29246
Draft
ezhang-figma wants to merge 1 commit into
Draft
fix(coderd): reject redundant SSH autostarts of running workspaces#29246ezhang-figma wants to merge 1 commit into
ezhang-figma wants to merge 1 commit into
Conversation
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
recheck |
cdrci2
added a commit
to coder/cla
that referenced
this pull request
Sep 11, 2026
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.
Written with AI
An SSH client can read a workspace as stopped, then submit its autostart request after another client has already finished starting that workspace. The server rejects starts while a provisioning job is active, but accepts this delayed request once the previous start has succeeded. That creates an unnecessary new build and invalidates agent connections belonging to the previous build. Managed devcontainers can consequently lose connectivity or authorization even though the underlying workspace machine is still running.
Reject SSH autostart requests with HTTP 409 when the latest build is already a successful start. The existing SSH client's conflict handler refreshes the workspace and connects without requesting another start, preserving the running build and its agents. Normal autostarts of stopped workspaces and explicit starts or rebuilds remain available. This server-side change protects clients that already send the SSH connection build reason; it does not require a client upgrade or a per-workspace repair script, and it does not repair agents invalidated by earlier builds.
The regression test reproduces the delayed request deterministically and verifies that the latest build stays unchanged, while stopped-workspace autostarts and explicit starts still succeed. The running-workspace case fails before the fix on v2.37.0. The new regression, workspace builder tests, and existing SSH conflict-recovery tests pass with the fix on both v2.37.0 and upstream base 5e058aa.
Verification evidence (commands executed by Codex)
An isolated PostgreSQL instance was used for the API and CLI tests. A local Go overlay redirected the test database port to avoid touching an existing development database; neither the overlay nor the harness is part of this change.
Before the fix, running the new regression test on v2.37.0 produced this failure (excerpt):
With the fix on v2.37.0:
With the fix on upstream base 5e058aa, the regression and builder tests passed:
The existing SSH autostart and conflict-recovery tests also passed on that base:
The regression verifies HTTP 409 and an unchanged latest-build ID for a redundant SSH autostart, and successful builds for a stopped-workspace autostart and an explicit dashboard start.
gofmtandgit diff --checkpassed. Full repository lint and tests have not been run locally; CI results are separate from the targeted checks above.