Skip to content

fix(site): use server-side workspace restart orchestration - #28034

Open
ibetitsmike wants to merge 12 commits into
mainfrom
mike/eng-3020-ui-restart-on-success
Open

fix(site): use server-side workspace restart orchestration#28034
ibetitsmike wants to merge 12 commits into
mainfrom
mike/eng-3020-ui-restart-on-success

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Migrates the web UI restart flow to the server-side restart orchestration API added in #25757-#25759 (#5800). Closes DEVEX-758.

Changes

API.restartWorkspace previously orchestrated a restart client-side: POST a stop build, poll it to completion, then POST a start build pinned to the previous template version and poll that too. If the browser tab went away mid-restart, the workspace stayed stopped.

Now it sends a single build request: transition: "stop", reason: "dashboard", and on_success: { transition: "start", rich_parameter_values }. The server persists the follow-up start intent atomically with the stop build and creates the start build after the stop succeeds, so the restart survives the client. The client keeps waiting for display only (the React Query mutation still spans the whole cycle, preserving the "Restarting" button state): it waits for the stop build, then discovers the server-created child build at build_number + 1 (tolerating 404s for up to 60s), then waits for it.

Behavior change: the request omits on_success.template_version_id because pinning requires template-update permission, so the follow-up start uses the template's active version at start time. Restarting an outdated workspace therefore also updates it; the restart confirmation dialog now says so when the workspace is outdated.

Testing

  • New restartWorkspace unit tests: single POST shape with on_success, canceled-stop bail, 404-tolerant child discovery, 60s timeout with in-flight request cancellation (red-green verified against the old implementation).
  • Remote dogfood UAT passed on this exact head: one build POST per restart (payload verified via devtools), stop then orchestrator-created start in build history, "Restarting" state through the full cycle, and schedule-page apply-now restart.

Known follow-ups (out of scope):

  • WorkspaceParametersPage still uses its own client-side stop-then-start flow when saving parameter changes on a running workspace; it can migrate to on_success.rich_parameter_values in a separate PR.
  • The API does not expose orchestration status, so when the server permanently fails to create the follow-up start build (for example, stored parameters that are invalid for the active template version), the UI can only report an actionable timeout after the discovery deadline. Exposing the orchestration's terminal error is a backend change that would let the dashboard fail fast.
  • The same missing surface means the client discovers the child build by number (stop.build_number + 1) for display. If another client creates a build in the window between stop success and orchestrator processing, the display wait can track that unrelated build. The wait is display-only (workspace state stays correct); exposing the orchestration's child build ID would remove the heuristic.

Mux acted on Mike's behalf to create this PR.

@linear-code

linear-code Bot commented Aug 11, 2026

Copy link
Copy Markdown

ENG-3020

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 808615d910

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx Outdated
Comment thread site/src/api/api.ts Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e48ac6910b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/api/api.ts
Comment thread site/src/pages/WorkspacePage/WorkspaceReadyPage.stories.tsx Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f6addc443d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/api/api.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f6addc443d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/api/api.ts Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0fd39e2ce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce1bf50f4f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/pages/WorkspacePage/WorkspacePage.test.tsx Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25db1730e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/api/api.ts Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25db1730e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/pages/WorkspacePage/WorkspaceReadyPage.stories.tsx Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd72398fa2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/api/api.ts Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 568ac3ddb7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: f3321207d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike marked this pull request as ready for review August 11, 2026 19:27
@coder-tasks

coder-tasks Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

This PR changes user-facing restart behavior: a dashboard/schedule-page restart now starts the workspace on the template's active version instead of pinning the workspace's current version. As a result, restarting an outdated workspace also updates it. The confirmation dialogs are updated to say so, but the user guides that describe restarting and updating workspaces don't mention this.

Updates Needed

  • docs/user-guides/workspace-management.md - The "Updating workspaces" / "Starting and stopping workspaces" sections describe update as an explicit action and don't mention that a restart now applies a pending template update. Add a note that restarting a workspace (dashboard or schedule "apply now") uses the template's active version and can update an outdated workspace.
  • docs/user-guides/workspace-lifecycle.md - The lifecycle page discusses restart only in terms of ephemeral resource recreation. Consider noting that a restart brings the workspace up on the template's active version.

Automated review via Coder Agents

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