Skip to content

feat: use startup mode for workspace updates#886

Merged
EhabY merged 4 commits intomainfrom
feat/startup-mode-update-workspace
Apr 15, 2026
Merged

feat: use startup mode for workspace updates#886
EhabY merged 4 commits intomainfrom
feat/startup-mode-update-workspace

Conversation

@EhabY
Copy link
Copy Markdown
Collaborator

@EhabY EhabY commented Apr 14, 2026

  • Replace the boolean firstConnect flag with a typed StartupMode ("none" | "start" | "update") so the extension knows exactly what to do on reconnect
  • The "Update Workspace" command now sets the mode to "update" and reloads the window, letting the workspace state machine handle the update via coder update (or the REST API fallback for older CLIs)
  • When reconnecting to a stopped workspace without an explicit mode, the confirm dialog now offers both "Start" and "Update and Start" (the latter only when the workspace is outdated)
  • Extract a shared runCliCommand helper and bundle restClient/featureSet into CliContext so startWorkspace and updateWorkspace each take a single argument
  • Add the cliUpdate feature flag gated on CLI >= 2.25

Closes #884

EhabY added 3 commits April 14, 2026 13:00
…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.
@EhabY EhabY force-pushed the feat/startup-mode-update-workspace branch from 1969cae to fc263e7 Compare April 14, 2026 11:38
@EhabY EhabY requested a review from code-asher April 14, 2026 11:39
Copy link
Copy Markdown
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks good to me!

Comment thread src/api/workspace.ts Outdated
Comment thread src/featureSet.ts Outdated
The coder update subcommand gained its stop transition in 2.24.0, not
2.25.0. Also replace splitLines with direct line-ending normalization
to avoid emitting broken half-lines on chunk boundaries.
@EhabY EhabY force-pushed the feat/startup-mode-update-workspace branch from 0367253 to 4f4d868 Compare April 15, 2026 16:15
@EhabY EhabY merged commit 83a9ce1 into main Apr 15, 2026
12 checks passed
@EhabY EhabY deleted the feat/startup-mode-update-workspace branch April 15, 2026 21:02
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.

"Update workspace" command does not stop running workspace before updating

2 participants