feat: reinitialize agents when a prebuilt workspace is claimed - #17475
Merged
Conversation
SasSwart
force-pushed
the
jjs/prebuilds-agent-reinit
branch
from
April 23, 2025 13:49
35e4bf8 to
18da76e
Compare
evgeniy-scherbina
force-pushed
the
yevhenii/512-claim-prebuild
branch
from
April 23, 2025 15:23
fe569d4 to
fcdbba8
Compare
SasSwart
force-pushed
the
jjs/prebuilds-agent-reinit
branch
from
April 24, 2025 12:34
cc25406 to
26dbc3a
Compare
SasSwart
force-pushed
the
jjs/prebuilds-agent-reinit
branch
from
April 25, 2025 08:32
ec9ed29 to
362db7c
Compare
dannykopping
reviewed
May 1, 2025
| } | ||
|
|
||
| func StreamAgentReinitEvents(ctx context.Context, logger slog.Logger, rw http.ResponseWriter, r *http.Request, reinitEvents <-chan agentsdk.ReinitializationEvent) { | ||
| sseSendEvent, sseSenderClosed, err := httpapi.ServerSentEventSender(rw, r) |
Contributor
There was a problem hiding this comment.
We can fix this later, but I think this might be inappropriate at this layer.
This seems like a detail of the HTTP API, and we aren't testing this directly so I'd argue this code could go back to coderd/workspaceagents.go.
spikecurtis
reviewed
May 7, 2025
spikecurtis
left a comment
Contributor
There was a problem hiding this comment.
The biggest remaining issue is around back compatibility for old versions of the provisionerd server.
dannykopping
added a commit
that referenced
this pull request
May 12, 2025
…17757) Used in combination with coder/terraform-provider-coder#396 This is required by both #17475 and #17571 Operators may need to conditionalize their templates to perform certain operations once a prebuilt workspace has been claimed. This value will **only** be set once a claim takes place and a subsequent `terraform apply` occurs. Any `terraform apply` runs thereafter will be indistinguishable from a normal run on a workspace. --------- Signed-off-by: Danny Kopping <[email protected]>
spikecurtis
reviewed
May 13, 2025
Minor code quality enhancements
dannykopping
approved these changes
May 14, 2025
mtojek
approved these changes
May 14, 2025
mtojek
left a comment
Member
There was a problem hiding this comment.
Let's get this merged now, Sas. Based on the discussion we had yesterday, we can work on improvements iteratively 👍
spikecurtis
reviewed
May 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request allows coder workspace agents to be reinitialized when a prebuilt workspace is claimed by a user. This facilitates the transfer of ownership between the anonymous prebuilds system user and the new owner of the workspace.
Only a single agent per prebuilt workspace is supported for now, but plumbing has already been done to facilitate the seamless transition to multi-agent support.