Skip to content

feat: support devcontainer agents in ui and unify backend #18332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
356 changes: 189 additions & 167 deletions agent/agentcontainers/api.go

Large diffs are not rendered by default.

180 changes: 112 additions & 68 deletions agent/agentcontainers/api_test.go

Large diffs are not rendered by default.

69 changes: 57 additions & 12 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 57 additions & 12 deletions coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 7 additions & 9 deletions coderd/workspaceagents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1403,15 +1403,13 @@ func TestWorkspaceAgentRecreateDevcontainer(t *testing.T) {
agentcontainers.DevcontainerConfigFileLabel: configFile,
}
devContainer = codersdk.WorkspaceAgentContainer{
ID: uuid.NewString(),
CreatedAt: dbtime.Now(),
FriendlyName: testutil.GetRandomName(t),
Image: "busybox:latest",
Labels: dcLabels,
Running: true,
Status: "running",
DevcontainerDirty: true,
DevcontainerStatus: codersdk.WorkspaceAgentDevcontainerStatusRunning,
ID: uuid.NewString(),
CreatedAt: dbtime.Now(),
FriendlyName: testutil.GetRandomName(t),
Image: "busybox:latest",
Labels: dcLabels,
Running: true,
Status: "running",
}
plainContainer = codersdk.WorkspaceAgentContainer{
ID: uuid.NewString(),
Expand Down
25 changes: 11 additions & 14 deletions codersdk/workspaceagents.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,6 @@ func (c *Client) WorkspaceAgentListeningPorts(ctx context.Context, agentID uuid.
return listeningPorts, json.NewDecoder(res.Body).Decode(&listeningPorts)
}

// WorkspaceAgentDevcontainersResponse is the response to the devcontainers
// request.
type WorkspaceAgentDevcontainersResponse struct {
Devcontainers []WorkspaceAgentDevcontainer `json:"devcontainers"`
}

// WorkspaceAgentDevcontainerStatus is the status of a devcontainer.
type WorkspaceAgentDevcontainerStatus string

Expand All @@ -422,6 +416,15 @@ type WorkspaceAgentDevcontainer struct {
Status WorkspaceAgentDevcontainerStatus `json:"status"`
Dirty bool `json:"dirty"`
Container *WorkspaceAgentContainer `json:"container,omitempty"`
Agent *WorkspaceAgentDevcontainerAgent `json:"agent,omitempty"`
}

// WorkspaceAgentDevcontainerAgent represents the sub agent for a
// devcontainer.
type WorkspaceAgentDevcontainerAgent struct {
ID uuid.UUID `json:"id" format:"uuid"`
Name string `json:"name"`
Directory string `json:"directory"`
}

// WorkspaceAgentContainer describes a devcontainer of some sort
Expand Down Expand Up @@ -450,14 +453,6 @@ type WorkspaceAgentContainer struct {
// Volumes is a map of "things" mounted into the container. Again, this
// is somewhat implementation-dependent.
Volumes map[string]string `json:"volumes"`
// DevcontainerStatus is the status of the devcontainer, if this
// container is a devcontainer. This is used to determine if the
// devcontainer is running, stopped, starting, or in an error state.
DevcontainerStatus WorkspaceAgentDevcontainerStatus `json:"devcontainer_status,omitempty"`
// DevcontainerDirty is true if the devcontainer configuration has changed
// since the container was created. This is used to determine if the
// container needs to be rebuilt.
DevcontainerDirty bool `json:"devcontainer_dirty"`
}

func (c *WorkspaceAgentContainer) Match(idOrName string) bool {
Expand Down Expand Up @@ -486,6 +481,8 @@ type WorkspaceAgentContainerPort struct {
// WorkspaceAgentListContainersResponse is the response to the list containers
// request.
type WorkspaceAgentListContainersResponse struct {
// Devcontainers is a list of devcontainers visible to the workspace agent.
Devcontainers []WorkspaceAgentDevcontainer `json:"devcontainers"`
// Containers is a list of containers visible to the workspace agent.
Containers []WorkspaceAgentContainer `json:"containers"`
// Warnings is a list of warnings that may have occurred during the
Expand Down
41 changes: 39 additions & 2 deletions docs/reference/api/agents.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading