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: show devcontainer dirty status and allow recreate#17880

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

Merged

Conversation

mafredri
Copy link
Member

@mafredrimafredri commentedMay 16, 2025
edited
Loading

With this change, the backend portion of#16424 is done.

What remains is exposing a UI button if a devcontainer has changed (dirty) and allowing it to hit the new route. Logs will be streamed in agent logs.

Updates#16424

Copilot

This comment was marked as outdated.

@mafredrimafredri requested a review fromCopilotMay 16, 2025 11:53
Copilot

This comment was marked as outdated.

@mafredrimafredriforce-pushed themafredri/feat-agent-agentcontainers-dirty-status branch fromce63f79 toc8a5bb8CompareMay 16, 2025 11:59
@mafredrimafredriforce-pushed themafredri/feat-agent-agentcontainers-dirty-status branch fromc8a5bb8 to2e133c2CompareMay 16, 2025 11:59
@@ -146,6 +150,136 @@ func (w *fakeWatcher) sendEventWaitNextCalled(ctx context.Context, event fsnotif
func TestAPI(t *testing.T) {
t.Parallel()

// List tests the API.getContainers method using a mock
// implementation. It specifically tests caching behavior.
t.Run("List", func(t *testing.T) {
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This test was moved from internal to here. In the process we had to create WithCacheDuration and change the implementation from calling internalgetContainers to using the API endpoint (which seems reasonable). Otherwise the test remains unchanged.

@mafredrimafredri marked this pull request as ready for reviewMay 16, 2025 13:50
// 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"`
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: reduce stuttering in name

Suggested change
DevcontainerDirtybool`json:"devcontainer_dirty"`
Dirtybool`json:"dirty"`

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This is the container structure, so I wouldn’t consider this stutter. A container being dirty isn’t very informative. I’m sure we want to consolidate/simplify the API a bit down the line so this could change later.

johnstcn reacted with thumbs up emoji
Comment on lines +958 to +977
err = agentConn.RecreateDevcontainer(ctx, container)
if err != nil {
if errors.Is(err, context.Canceled) {
httpapi.Write(ctx, rw, http.StatusRequestTimeout, codersdk.Response{
Message: "Failed to recreate devcontainer from agent.",
Detail: "Request timed out.",
})
return
}
// If the agent returns a codersdk.Error, we can return that directly.
if cerr, ok := codersdk.AsError(err); ok {
httpapi.Write(ctx, rw, cerr.StatusCode(), cerr.Response)
return
}
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
Message: "Internal error recreating devcontainer.",
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.

What happens if we're halfway through recreating the devcontainer and the request gets canceled? Will the devcontainer eventually be in a running state, or will it be left in limbo?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Good observation, although this is not relevant to this endpoint, but rather the agentcontainers API. For now the devcontainer CLI command will be interrupted. I’m planning to change this behavior to be a ”job accepted” rather than request scoped. But this’ll come with refactoring the service to monitor (dev)containers and workers for asynchronous tasks.

johnstcn reacted with thumbs up emoji
@mafredrimafredri merged commit98e2ec4 intomainMay 19, 2025
39 of 41 checks passed
@mafredrimafredri deleted the mafredri/feat-agent-agentcontainers-dirty-status branchMay 19, 2025 09:56
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMay 19, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

Copilot code reviewCopilotCopilot left review comments

@johnstcnjohnstcnjohnstcn approved these changes

@DanielleMaywoodDanielleMaywoodDanielleMaywood approved these changes

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@mafredri@johnstcn@DanielleMaywood

[8]ページ先頭

©2009-2025 Movatter.jp