Open
Conversation
…alls
Replace the boolean firstConnect flag with a typed StartupMode
("prompt" | "start" | "update") so the extension can tell the
workspace state machine exactly what to do on reconnect. The
"Update Workspace" command now sets the mode to "update" and
reloads the window, letting the state machine handle the update
via `coder update` (or the REST fallback for older CLIs).
Also refactors workspace.ts to extract a shared runCliCommand
helper used by both startWorkspace and updateWorkspace.
"prompt" was ambiguous since it could imply prompting for both start and update. "none" makes it clear that no explicit intent was set, and the default behavior (asking) applies. Also bundles restClient and featureSet into CliContext so startWorkspace and updateWorkspace each take a single argument, removes redundant getWorkspace() API calls in favor of using the workspace already passed via context, replaces the cliContext getter with buildCliContext(workspace), and fixes a stale test description.
Make the stopped-workspace dialog offer "Update and Start" when the workspace is outdated, so users can update without going through a separate command. Inline the wantsUpdate getter since it was just hiding a simple equality check on startupMode. Rework the test file to use MockUserInteraction (instead of mocking vscodeProposed directly), MockTerminalSession with content capture, proper agent/resource factories from the shared workspace mock, and a setup() function that returns all test fixtures. Add getMessageCalls() to MockUserInteraction so tests can inspect which buttons were offered in dialogs. Add edge case coverage for agent timeout, created lifecycle, start_timeout, all shutdown states, and getAgentId.
1969cae to
fc263e7
Compare
code-asher
approved these changes
Apr 14, 2026
| const proc = spawn(cmd, { shell: true }); | ||
|
|
||
| proc.stdout.on("data", (data: Buffer) => { | ||
| for (const line of splitLines(data)) { |
Member
There was a problem hiding this comment.
Just occurred to me (not something introduced in this PR) that if we we ever got a chunk of data that ended in the middle of a line, we would end up emitting half that line on one line and then the other half of the line as a separate line in the next event.
Obviously not something we have to address now, but do we actually have to split into lines? Could we just write these bytes as they are directly to the terminal?
code-asher
reviewed
Apr 14, 2026
| // --reason flag for `coder start` | ||
| buildReason: versionAtLeast(version, "2.25.0"), | ||
| // `coder update` subcommand | ||
| cliUpdate: versionAtLeast(version, "2.25.0"), |
Member
There was a problem hiding this comment.
Oh wait forgot to ask why 2.25.0 specifically; update was in there before that I think? I was thinking maybe it was when a stop transition was added to update but it looks like that was 2.24.0.
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.
firstConnectflag with a typedStartupMode("none"|"start"|"update") so the extension knows exactly what to do on reconnect"update"and reloads the window, letting the workspace state machine handle the update viacoder update(or the REST API fallback for older CLIs)runCliCommandhelper and bundlerestClient/featureSetintoCliContextsostartWorkspaceandupdateWorkspaceeach take a single argumentcliUpdatefeature flag gated on CLI >= 2.25Closes #884