mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
feat: reinitialize agents when a prebuilt workspace is claimed (#17475)
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. --------- Signed-off-by: Danny Kopping <dannykopping@gmail.com> Co-authored-by: Danny Kopping <dannykopping@gmail.com>
This commit is contained in:
@ -368,9 +368,11 @@ func (a *agent) runLoop() {
|
||||
if ctx.Err() != nil {
|
||||
// Context canceled errors may come from websocket pings, so we
|
||||
// don't want to use `errors.Is(err, context.Canceled)` here.
|
||||
a.logger.Warn(ctx, "runLoop exited with error", slog.Error(ctx.Err()))
|
||||
return
|
||||
}
|
||||
if a.isClosed() {
|
||||
a.logger.Warn(ctx, "runLoop exited because agent is closed")
|
||||
return
|
||||
}
|
||||
if errors.Is(err, io.EOF) {
|
||||
@ -1051,7 +1053,11 @@ func (a *agent) run() (retErr error) {
|
||||
return a.statsReporter.reportLoop(ctx, aAPI)
|
||||
})
|
||||
|
||||
return connMan.wait()
|
||||
err = connMan.wait()
|
||||
if err != nil {
|
||||
a.logger.Info(context.Background(), "connection manager errored", slog.Error(err))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// handleManifest returns a function that fetches and processes the manifest
|
||||
|
Reference in New Issue
Block a user