feat(agent/agentcontainers): update containers periodically (#17972)

This change introduces a significant refactor to the agentcontainers API
and enables periodic updates of Docker containers rather than on-demand.
Consequently this change also allows us to move away from using a
locking channel and replace it with a mutex, which simplifies usage.

Additionally a previous oversight was fixed, and testing added, to clear
devcontainer running/dirty status when the container has been removed.

Updates coder/coder#16424
Updates coder/internal#621
This commit is contained in:
Mathias Fredriksson
2025-05-22 19:44:33 +03:00
committed by GitHub
parent 13b41c200c
commit d6c14f3d8a
6 changed files with 530 additions and 339 deletions

View File

@ -326,7 +326,7 @@ func TestOpenVSCodeDevContainer(t *testing.T) {
},
},
}, nil,
)
).AnyTimes()
client, workspace, agentToken := setupWorkspaceForAgent(t, func(agents []*proto.Agent) []*proto.Agent {
agents[0].Directory = agentDir
@ -501,7 +501,7 @@ func TestOpenVSCodeDevContainer_NoAgentDirectory(t *testing.T) {
},
},
}, nil,
)
).AnyTimes()
client, workspace, agentToken := setupWorkspaceForAgent(t, func(agents []*proto.Agent) []*proto.Agent {
agents[0].Name = agentName