Skip to content

fix: show progress for workspace actions - #361

Open
fioan89 wants to merge 4 commits into
mainfrom
fix/environment-action-progress
Open

fioan89 wants to merge 4 commits into
mainfrom
fix/environment-action-progress

Conversation

@fioan89

@fioan89 fioan89 commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Workspace actions could appear idle while blocking operations were still running. In particular, the Coder CLI start command can wait for external authentication, while its detached coroutine returned immediately and separated the command from the action's progress and error handling. This was especially confusing when a workspace start paused for external authentication or when an update, restart, or stop continued after the initial request had completed.

Toolbox now keeps the environment description in sync with the active workspace action. Workspace starts display live output from the Coder CLI, while other ongoing builds use the status and latest provisioner output retrieved during workspace polling. Once the build finishes, the normal environment description is restored.

Failures while retrieving progress are recorded without interrupting workspace monitoring. They retain the SSH session correlation when a session is available and remain ordinary logs when the workspace has no active session.

Workspace actions could appear idle while blocking operations were still running. In particular, the Coder CLI start command can wait for external authentication, while its detached coroutine returned immediately and separated the command from the action's progress and error handling.

Workspace actions now publish indeterminate progress for as long as their CLI or REST work is running. The blocking start command remains within the existing action lifecycle while executing on the IO dispatcher, which keeps progress and error handling active and allows the previous description and workspace state to be restored when appropriate; tests cover both execution paths.
Workspace starts can spend time waiting for provisioning or external authentication, while Toolbox previously displayed only a static message. Stream Coder CLI output into the environment progress so users can see what the start command is doing without changing the complete output retained for logs and failures.
Workspace update, update-and-restart, and stop requests can return before their builds finish, leaving Toolbox without useful progress while it waits for another workspace refresh.

Keep the environment description aligned with pending, starting, and stopping build states reported by the poller. This preserves progress across environment replacement and restores the normal description when the build finishes.
Workspace actions can continue provisioning after their initial request returns, leaving Toolbox with only a generic build status while it waits for the workspace to become ready.

Use each poll update to display the latest provisioner output for active builds. Progress lookup failures keep the SSH session correlation when one exists and remain ordinary logs when no session is available.
@fioan89
fioan89 marked this pull request as ready for review September 15, 2026 19:36
@linear-code

linear-code Bot commented Sep 15, 2026

Copy link
Copy Markdown

JET-1

@fioan89

fioan89 commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author
demo-progress-tracking-1.mp4
demo-progress-tracking-2.mp4

@matifali matifali left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice addition.

@fioan89

fioan89 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

If you don't mind I'll leave this open for a bit, in the hope that @code-asher or @jeremyruppel will also take a look over the implementation and how we stream build data.

@code-asher code-asher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very cool!!

.exitValues(0)

showTextProgress?.let { reportProgress ->
processExecutor.redirectOutput(reportProgress::invoke)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably not something we have to actually worry about, but do you know if this buffers by newline or anything like that? Thinking it could be weird (although unlikely) if half a sentence appears, then is replaced by the next half, just depending on how the output happens to be buffered.

fun update(newWorkspace: Workspace, newAgent: WorkspaceAgent?) {
suspend fun update(newWorkspace: Workspace, newAgent: WorkspaceAgent?) {
applyWorkspaceSnapshot(newWorkspace, newAgent)
updateBuildProgress(newWorkspace)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if we should add follow=true to the build log request? That turns it into a web socket and lets us watch the logs.

Otherwise we may be sitting there without more logs unless/until update runs again.

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.

3 participants