Skip to content

test: wait for devcontainer readiness#25567

Merged
DanielleMaywood merged 3 commits into
mainfrom
fix/open-vscode-devcontainer-flake
May 22, 2026
Merged

test: wait for devcontainer readiness#25567
DanielleMaywood merged 3 commits into
mainfrom
fix/open-vscode-devcontainer-flake

Conversation

@DanielleMaywood
Copy link
Copy Markdown
Contributor

Note

🤖 This PR was written by Coder Agent on behalf of Danielle Maywood

TestOpenVSCodeDevContainer could start its parallel coder open vscode subtests before the parent agent's container API was ready through tailnet. This adds a setup wait for the parent container API to return the running devcontainer and for the devcontainer subagent to be visible as connected before the parallel CLI checks begin.

Research

A recent CI failure timed out in coder open vscode while listing parent workspace agent containers. The coderd request took nearly the full test deadline and the parent agent logged a container update after the subtest had already timed out.

The existing WorkspaceAgentWaiter only waits for coderd's workspace agent state. It does not prove that the parent agent's HTTP API is reachable through tailnet or that the agent container cache has a running devcontainer with the subagent populated. The CLI path under test depends on that API before building the VS Code devcontainer link.

The targeted fix keeps the parallel subtests but moves the readiness wait into setup. The wait exercises the same parent container endpoint the CLI uses and also confirms the devcontainer subagent is present in the workspace before the subtests run.

@DanielleMaywood DanielleMaywood marked this pull request as ready for review May 21, 2026 14:21
Comment thread cli/open_test.go Outdated
Comment on lines +438 to +446
var parentAgentID uuid.UUID
for _, resource := range resources {
for _, workspaceAgent := range resource.Agents {
if workspaceAgent.Name == parentAgentName {
parentAgentID = workspaceAgent.ID
}
}
}
require.NotEqual(t, uuid.Nil, parentAgentID)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

non-blocking, suggestion: I feel like this "give me the parent agent" is ripe for a helper or something. I recall seeing it in a few places.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Definitely remember thinking this when working more heavily on dev containers. Have span up a helper in codertest and gotten the agent to find places to use it in

Comment thread cli/open_test.go
Comment on lines +459 to +476
for _, dc := range resp.Devcontainers {
if dc.ID != devcontainerID {
continue
}
if dc.Status != codersdk.WorkspaceAgentDevcontainerStatusRunning {
return false
}
if dc.Container == nil || dc.Container.ID != containerID {
return false
}
if dc.Agent == nil || dc.Agent.Name != devcontainerName {
return false
}
devcontainerAgentID = dc.Agent.ID
}
if devcontainerAgentID == uuid.Nil {
return false
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

non-blocking, suggestion: might be worth dropping a few more t.Logf's before the false returns.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The agent gave it a go 😄

Comment thread cli/open_test.go Outdated

// WorkspaceAgentWaiter only observes coderd state. The CLI exercises
// the parent agent container API through tailnet, so wait for that path
// before starting parallel open commands.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment is just very confusingly written.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will rewrite

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agent rewrote it. I think it makes more sense now but if you want it refined again lemme know

@DanielleMaywood DanielleMaywood changed the title test(cli): wait for devcontainer readiness test: wait for devcontainer readiness May 22, 2026
@DanielleMaywood DanielleMaywood merged commit 5deab9f into main May 22, 2026
26 checks passed
@DanielleMaywood DanielleMaywood deleted the fix/open-vscode-devcontainer-flake branch May 22, 2026 12:55
@github-actions github-actions Bot locked and limited conversation to collaborators May 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants