Skip to content

fix(agent/agentcontainers): fix TestAPI/IgnoreCustomization flake #18863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 15, 2025

Conversation

DanielleMaywood
Copy link
Contributor

@DanielleMaywood DanielleMaywood commented Jul 14, 2025

Fixes a flake spotted here https://github.com/coder/coder/actions/runs/16277283041/job/45959150449

The flake occurred due to a race condition between RefreshContainers and the file system watcher. We might want to improve how these tests are written in the future, but for now it appears this change has fixed the flake on my Coder Workspace.

How I ran the test to recreate the issue

seq 1 128 | xargs -P 64 -I {} sh -c 'echo "Run {}:" &&  go test -run="TestAPI/IgnoreCustomization" -race -count=20 ./agent/agentcontainers'

@DanielleMaywood DanielleMaywood requested a review from Copilot July 14, 2025 22:18
@DanielleMaywood DanielleMaywood changed the title fix(agent/agentcontainers): resolve flake fix(agent/agentcontainers): fix TestAPI/IgnoreCustomization flake Jul 14, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fixes a flaky race condition in TestAPI by waiting for container refresh to complete before asserting subagent creation.

  • Wrapped api.RefreshContainers calls in require.Eventuallyf to poll for fakeSAC.created entries after filesystem events.
  • Applied the same change in both phases of the test to ensure subagent creation is detected reliably.

@DanielleMaywood DanielleMaywood marked this pull request as ready for review July 14, 2025 22:35
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

Thanks!

@DanielleMaywood DanielleMaywood merged commit bd3d0ea into main Jul 15, 2025
32 checks passed
@DanielleMaywood DanielleMaywood deleted the danielle/devcontainer-test-flake branch July 15, 2025 09:01
@github-actions github-actions bot locked and limited conversation to collaborators Jul 15, 2025
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.

2 participants