Skip to content

Commit d5e3419

Browse files
authored
revert: fix(agent/agentcontainers): refresh containers before status change (#18624)
Reverts #18620 This fix exacerbated the problem, reverting until a better fix can be made.
1 parent 7b0b649 commit d5e3419

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

agent/agentcontainers/api.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,15 +1002,6 @@ func (api *API) CreateDevcontainer(workspaceFolder, configPath string, opts ...D
10021002

10031003
logger.Info(ctx, "devcontainer created successfully")
10041004

1005-
// Ensure the container list is updated immediately after creation.
1006-
// This makes sure that dc.Container is populated before we acquire
1007-
// the lock avoiding a temporary inconsistency in the API state
1008-
// where status is running, but the container is nil.
1009-
if err := api.RefreshContainers(ctx); err != nil {
1010-
logger.Error(ctx, "failed to trigger immediate refresh after devcontainer creation", slog.Error(err))
1011-
return xerrors.Errorf("refresh containers: %w", err)
1012-
}
1013-
10141005
api.mu.Lock()
10151006
dc = api.knownDevcontainers[dc.WorkspaceFolder]
10161007
// Update the devcontainer status to Running or Stopped based on the
@@ -1029,6 +1020,13 @@ func (api *API) CreateDevcontainer(workspaceFolder, configPath string, opts ...D
10291020
api.knownDevcontainers[dc.WorkspaceFolder] = dc
10301021
api.mu.Unlock()
10311022

1023+
// Ensure an immediate refresh to accurately reflect the
1024+
// devcontainer state after recreation.
1025+
if err := api.RefreshContainers(ctx); err != nil {
1026+
logger.Error(ctx, "failed to trigger immediate refresh after devcontainer creation", slog.Error(err))
1027+
return xerrors.Errorf("refresh containers: %w", err)
1028+
}
1029+
10321030
return nil
10331031
}
10341032

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy