Prevent users from creating a new workspace with an unconnected agent
MR: Pending <!-- The first line of the MR must be one of the following: 1. `MR: Pending` 2. `MR: <MR link with trailing +>`, and the first description line of the MR should be `Issue: <Issue link with trailing +>` 3. `MR: No MR` For more context, see: https://about.gitlab.com/handbook/engineering/development/dev/create/ide/index.html#1-to-1-relationship-of-issues-to-mrs --> <!-- The following sections should be filled out as part of the refinement process before the issue is prioritized. For more context, see: https://about.gitlab.com/handbook/engineering/development/dev/create/ide/#2-pre-iteration-planning-meeting --> ## Description It's possible for users to create a workspace using an agent that's not connected. This results in a workspace that gets stuck showing the spinner icon in the UI with no terminate button. TODO: Update issue resulting from discussion slack [thread](https://gitlab.slack.com/archives/C07GXU7DW0H/p1728676333775669?thread_ts=1728590467.696569&cid=C07GXU7DW0H)/ pairing session For this issue an agent is unconnected if: - It's never been connected - It was previously connected but is unconnected at time of workspace creation ### Examples UI stuck on spinner: - <img src="/uploads/38b5035ec065d7f3649d5285423f61ce/workspace_stuck_example.gif" width="500" /> Workspace state: - ` desired_state: "Terminated", actual_state: "CreationRequested",` ## Acceptance Criteria - [ ] User can't create a workspace with an unconnected agent - [ ] User can understand why an unconnected agent can't be used - [ ] Messaging specific to unconnected agents isn't displayed for other error scenarios ## Technical Requirements TODO: Fill out or delete [If applicable, please list out any technical requirements for this feature/enhancement.] ## Design Requirements **Proposal:** On the `Create Workspace` page: - Disable the unconnected agent in the agent selector so user can't use it to create a workspace. - Append `(not connected)` to the unconnected agent's option text as a status message so the user can understand why the agent's disabled. Example: - <img src="/uploads/2119325efde94ec21a40873efe339e8e/disabledagent_example.png" width="500" /> **Additional considerations:** - Are there any additional invalid states for agents that we should consider and could apply the same fix for? - If feedback indicates users struggle with understanding what "not connected" means or how/where to fix unconnected agents then we could take a more heavy handed approach by allowing users to select unconnected agents in the selector but [flagging them as invalid](https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-form-form-select--invalid-state) and displaying an actionable message that explains the problem in more detail and directs them to the agent page/docs. ## Impact Assessment The workspace UX will be improved by preventing the user from the frustrating experience of creating workspaces that immediately get stuck in a loading state. ## User Story As a user I want to avoid creating invalid workspaces so that I don't waste time troubleshooting. <!-- Replace with other type, e.g. bug or maintenance, if appropriate --> <!-- Replace with other subtype if appropriate --> <!-- By default, all issues start in the unprioritized status. See https://about.gitlab.com/handbook/engineering/development/dev/create/ide/#-remote-development-planning-process --> <!-- For simplicity and to avoid triage bot warnings about missing workflow labels, we will default to issues starting at the refinement phase -->
issue