Skip to content

Conversation

EhabY
Copy link
Collaborator

@EhabY EhabY commented Sep 12, 2025

Closes #582

Now it'll attempt to start the workspace when clicking on the "play" button or reloading a window that is already connected.

Currently when building we show a terminal with the build progress, this is good, but we can potentially also show a progress indicator between the different steps.

@mtojek mtojek self-requested a review September 15, 2025 07:54
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

I presume it will be hard to cover with unit tests since it is mainly in remote.ts?

@EhabY
Copy link
Collaborator Author

EhabY commented Sep 15, 2025

I presume it will be hard to cover with unit tests since it is mainly in remote.ts?

Indeed, and this is heavily using the VS Code API where there are no existing tests for (yet). Currently working a design that would allows us to mock this for tests :)

@EhabY EhabY force-pushed the automatic-start-workspace-when-starting branch from 97c6288 to 96109ed Compare September 15, 2025 08:22
@EhabY EhabY merged commit 9ff3cb6 into coder:main Sep 15, 2025
2 checks passed
@code-asher
Copy link
Member

code-asher commented Sep 15, 2025

Ah wait we added this dialog because VS Code was starting user's workspaces automatically on reconnect which users did not want, since it continually kept their workspace up without asking. It basically bypasses cost controls by circumventing auto-stop.

We should only automatically start the workspace if the connection is explicitly started by user action (rather than automatic reconnect).

@code-asher
Copy link
Member

BTW there is an issue for this: #331

@code-asher
Copy link
Member

code-asher commented Sep 15, 2025

And the original issue for adding the dialog: #309

An alternative (and more ideal) fix to the "start workspace?" dialog would be if we could make VS Code ask before reconnecting if the workspace is off, but not sure if that is possible so we went with the "start workspace?" dialog instead.

@EhabY
Copy link
Collaborator Author

EhabY commented Sep 15, 2025

Oh nice catch, I wasn't sure if we wanted to reconnect on explicit actions only. I think I can potentially make it automatically only using the "play" button. We can use some memento trickery to detect if this is a "first connect" so that when users press "play" it's automatic, but I am not sure if we can fix it for the recents menu..

@code-asher
Copy link
Member

Yeah the recents menu might be a bust, I think we would have to replace the remote extension with our own so we fully control the whole lifecycle.

Memento is a neat idea!

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.

Automatically start workplace if started and not currently running
3 participants