Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(agent): support deleting dev containers#21247

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
DanielleMaywood wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromdanielle/devcontainers/delete/agent

Conversation

@DanielleMaywood
Copy link
Contributor

@DanielleMaywoodDanielleMaywood commentedDec 12, 2025
edited
Loading

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

I did a quick review, didn't really dig into the tests yet.

return
}

// Check if the devcontainer is currently starting - if so, we can't delete it.
Copy link
Member

Choose a reason for hiding this comment

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

This should be rewritten and explain why we've decided to have this limitation. Technically there's nothing preventing us from implementing cancellation of create, etc.

PS. I see you-.

DanielleMaywood reacted with eyes emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Believe it or not, I think I wrote that 😂

mafredri reacted with laugh emoji
}

// Similarly, if already stopping, don't allow another delete.
ifdc.Status==codersdk.WorkspaceAgentDevcontainerStatusStopping {
Copy link
Member

Choose a reason for hiding this comment

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

Could we make this statedeleting instead? I would like to keepstopping as a separate state for the future, one that does not mean delete (i.e. start/stop/delete for the full suite).

Logically a delete could be a stop followed by a delete. I think both are valid use-cases (a user may want to just quickly restart the container to reset the processes, deletion will take potentially much longer).

Detail:err.Error(),
})
return
}
Copy link
Member

Choose a reason for hiding this comment

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

Error paths seem to be lacking state handling for the devcontainer. Should probably updatedc.Error, perhaps others?

delete(api.recreateSuccessTimes,workspaceFolder)
delete(api.recreateErrorTimes,workspaceFolder)
delete(api.usingWorkspaceFolderName,workspaceFolder)
delete(api.injectedSubAgentProcs,workspaceFolder)
Copy link
Member

Choose a reason for hiding this comment

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

Check: Will this leave the devcontainer available in the dashboard tostart, like we do for e.g. detected containers?

Just because the user deleted it, doesn't necessarily mean they won't want to start it again.

}

// Delete the subagent if it exists.
ifsubAgentID!=uuid.Nil {
Copy link
Member

Choose a reason for hiding this comment

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

Should we run this cleanup even if stop/remove fails?

httpapi.Write(ctx,w,http.StatusInternalServerError, codersdk.Response{
Message:"An internal error occurred deleting the agent",
Detail:err.Error(),
})
Copy link
Member

Choose a reason for hiding this comment

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

These failures leave the API in a weird state, we've entered a terminal state (stopping), and can't re-invoke delete even if the errors are ephemeral. The container will become immortal.

}
}
ifdc.ID==uuid.Nil {
dc,err:=api.devcontainerByIDLocked(devcontainerID)
Copy link
Member

Choose a reason for hiding this comment

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

Nice 👍🏻

returnnil,f.execErr
}

func (f*fakeContainerCLI)Stop(ctx context.Context,namestring)error {
Copy link
Member

Choose a reason for hiding this comment

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

Since we're introducing mutation, we'll need to add a mutex to these.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mafredrimafredrimafredri left review comments

At least 1 approving review is required to merge this pull request.

Assignees

@DanielleMaywoodDanielleMaywood

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@DanielleMaywood@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp