Skip to content

feat(agent): implement recreate for devcontainers #17308

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 13 commits into from
Apr 10, 2025

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Apr 9, 2025

This change implements an interface for running @devcontainers/cli up and an API endpoint on the agent for triggering recreate for a running devcontainer.

A couple of limitations:

  1. Synchronous HTTP request, meaning the browser might choose to time it out before it's done => no result/error (and devcontainer cli command probably gets killed via ctx cancel).
  2. Logs are only written to agent logs via slog, not as a "script" in the UI.

Both 1 and 2 will be improved in future refactors.

Fixes coder/internal#481
Fixes coder/internal#482

@mafredri mafredri force-pushed the mafredri/feat-agent-recreate-devcontainer branch 2 times, most recently from 91dfec3 to 0098663 Compare April 9, 2025 15:43
@mafredri mafredri force-pushed the mafredri/feat-agent-recreate-devcontainer branch from 0098663 to 6d18522 Compare April 9, 2025 15:55
@mafredri mafredri marked this pull request as ready for review April 9, 2025 15:55
Copy link
Contributor

@DanielleMaywood DanielleMaywood left a comment

Choose a reason for hiding this comment

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

looks good to me 👍

Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

Nice work! I especially like the test helper thing you added 👍

return
}

containers, err := ch.cl.List(ctx)
Copy link
Member

Choose a reason for hiding this comment

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

Potential follow-up (non-blocking): I wonder if we should also add an Inspect() method to the Lister; listing the entire containers endpoint is probably wasteful.

@mafredri mafredri force-pushed the mafredri/feat-agent-recreate-devcontainer branch from e2d5de8 to f5e2328 Compare April 10, 2025 10:15
@mafredri mafredri merged commit 25fb34c into main Apr 10, 2025
34 checks passed
@mafredri mafredri deleted the mafredri/feat-agent-recreate-devcontainer branch April 10, 2025 13:16
@github-actions github-actions bot locked and limited conversation to collaborators Apr 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants