Skip to content

feat(workspaces): add workspace lifecycle actions behind the panel IPC - #1168

Open
EhabY wants to merge 3 commits into
mainfrom
feat/vsc-1-workspace-actions
Open

EhabY wants to merge 3 commits into
mainfrom
feat/vsc-1-workspace-actions

Conversation

@EhabY

@EhabY EhabY commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Extension side of workspace lifecycle actions in the Workspaces panel: Start, Stop, Restart, Update, Delete and Share for listed workspaces. The UI is in #1184.

  • WorkspaceActionRunner runs each action over the REST API, with no CLI. It asks first where it must, re-reads the workspace, and explains when the action no longer applies. Each action gets an AbortSignal that aborts when the session changes; the signal is checked before every request and also ends any wait, because the API client is shared across sessions. Commands only gains the dashboard sharing path.
  • Every action goes through one runBuild helper that queues the build with the vscode_connection reason, waits for it as coder does, streams its logs to the Coder output, warns when no provisioner can take it, and fails the action with its workspace named. When the request carries on_success, it also waits for the start the server queues after the stop.
  • waitForBuild polls /api/v2/workspacebuilds/{id}, as coder delete does. The by-name read 404s once a delete completes, so a Delete always reported failure. It polls through up to 3 network failures or 5xx responses in a row and fails at once on a client error. The action returns once its build settles, without waiting for a stalled log stream.
  • Start matches coder start: it activates a dormant workspace, cleans up a failed start, and uses the active version when the workspace auto-updates or the template requires it.
  • Restart starts on the build's template version, and refuses to start if another build replaced its stop.
  • Update asks for any parameters the new template version adds, then re-reads the workspace and refuses if start versus restart or the template version changed; telemetry records the refusal as aborted. The connected workspace still updates through a reload; the re-check covers it too, which is the one user-visible change. On Coder 2.36+ it updates in one build. Before 2.36, the panel restarts a running workspace itself, while the connected window keeps coder update.
  • workspaceActions (shared) decides which actions a workspace allows. The store tracks pending actions per workspace, so actions on different workspaces run in parallel. When an action ends, the store re-reads just that workspace (the All and Shared filters don't poll), after any list already in flight, so a stale list can't undo it.
  • Extension tests fake node:timers/promises through vitest's fakeNodeBuiltins.

Not covered

Generated by Coder Agents for @EhabY.

@linear-code

linear-code Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

VSC-1

VSC-45

@EhabY
EhabY added this pull request to stack #1169 October 29, 2026 13:55
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch 2 times, most recently from af31d97 to fda9174 Compare October 29, 2026 14:44
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch 3 times, most recently from 2db0f3d to 20f2f4e Compare October 30, 2026 08:15
@EhabY EhabY changed the title feat(workspaces): add workspace and agent actions to the workspaces panel feat(workspaces): add resilient workspace lifecycle actions Oct 30, 2026
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch from 20f2f4e to 106d17a Compare October 30, 2026 13:00
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch from 106d17a to d55b43c Compare October 30, 2026 13:45
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch from d55b43c to 1f071dd Compare October 30, 2026 21:54
Base automatically changed from feat/vsc-1-workspaces-panel to main November 9, 2026 09:19
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch 2 times, most recently from 1c02870 to 5be65f8 Compare November 9, 2026 10:21
@EhabY
EhabY removed this pull request from stack #1169 November 9, 2026 12:01
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch from 5be65f8 to fb9684b Compare November 9, 2026 12:18
@EhabY EhabY changed the title feat(workspaces): add resilient workspace lifecycle actions feat(workspaces): add workspace lifecycle actions to the panel Nov 9, 2026
@EhabY
EhabY changed the base branch from main to fix/workspace-session-isolation November 9, 2026 12:19
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch from fb9684b to 5a0015e Compare November 9, 2026 12:20
@EhabY EhabY changed the title feat(workspaces): add workspace lifecycle actions to the panel feat(workspaces): add workspace lifecycle commands and panel IPC Nov 9, 2026
@EhabY
EhabY added this pull request to stack #1185 November 9, 2026 12:24
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch 2 times, most recently from fe43d98 to 37f9ed0 Compare November 9, 2026 12:58
@EhabY EhabY changed the title feat(workspaces): add workspace lifecycle commands and panel IPC feat(workspaces): add workspace lifecycle actions behind the panel IPC Nov 9, 2026
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch 3 times, most recently from 697479d to 19e373d Compare November 9, 2026 13:59
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch from 19e373d to 064615b Compare November 12, 2026 15:07
Base automatically changed from fix/workspace-session-isolation to main November 13, 2026 14:12
EhabY added a commit that referenced this pull request Nov 13, 2026
Rebinding the API client to another deployment or account cancels its
pending requests, while token refreshes for the same account keep them,
in both the local client and remote windows.

- `CoderApi.setCredentials` and `dispose` abort pending requests;
`setSessionToken` keeps them.
- `DeploymentManager` treats a token change as a refresh only when the
user ID and URL match, and clears the client before announcing sign-out.
- Remote windows verify the user behind a new token before keeping
requests, and reset OAuth on an account change.
- The auth interceptor does not refresh, prompt or retry for a canceled
request.
- An OAuth refresh canceled midway never overwrites the credentials that
replaced it.

Required by #1168.
@EhabY
EhabY force-pushed the feat/vsc-1-workspace-actions branch 3 times, most recently from b1c5924 to 49134c2 Compare November 13, 2026 15:57
@EhabY
EhabY marked this pull request as ready for review November 13, 2026 17:51
@EhabY
EhabY requested a review from aqandrew November 13, 2026 17:51
EhabY and others added 2 commits November 13, 2026 21:29
Run Start, Stop, Restart, Update and Delete for listed workspaces over
the REST API, and open the dashboard sharing page.

- Each action is tied to an AbortSignal aborted on session change, so no
  request or wait outlives the session it started under.
- runBuild queues a build with the vscode_connection reason, waits for
  it, streams its logs, and follows an on_success start.
- waitForBuild polls the build by ID, so a delete can finish, and polls
  through up to 3 transient failures in a row.
- Start activates dormant workspaces and cleans up failed starts; Restart
  refuses to start over a build that replaced its stop; Update re-reads
  and refuses when the workspace changed since it was confirmed.
- The store tracks pending actions per workspace and re-reads just that
  workspace once its action ends.

This branch has not been deployed

No deployments
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