Skip to content

fix(agent/agentcontainers): fix devcontainer integration tests #19109

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 2 commits into from
Jul 31, 2025

Conversation

DanielleMaywood
Copy link
Contributor

@DanielleMaywood DanielleMaywood commented Jul 31, 2025

It appears we accidentally merged a change that broke our devcontainer integration tests #18570.

You can run CODER_TEST_USE_DOCKER=1 go test ./coderd ./agent ./agent/agentcontainers to run the integration tests.

@DanielleMaywood
Copy link
Contributor Author

@coderabbitai review

Copy link

coderabbitai bot commented Jul 31, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

coderabbitai bot commented Jul 31, 2025

📝 Walkthrough

Walkthrough

The logic for filtering containers based on label inclusion was updated to require all specified labels to match (logical AND), instead of any (logical OR). Additionally, containers labeled as test devcontainers are now skipped by default unless inclusion filters are set. Only comments and internal logic were modified; no public interfaces changed.

Changes

Cohort / File(s) Change Summary
Container Label Filtering Logic
agent/agentcontainers/api.go
Updated label filter logic from OR to AND, corrected related comment, and added logic to skip test devcontainers by default.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Suggested reviewers

  • mafredri
  • mtojek

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4dc2d9 and 7419dd2.

📒 Files selected for processing (1)
  • agent/agentcontainers/api.go (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: test-go-pg-17
  • GitHub Check: test-go-pg (windows-2022)
  • GitHub Check: test-go-race-pg
  • GitHub Check: test-go-pg (ubuntu-latest)
  • GitHub Check: test-go-pg (macos-latest)
  • GitHub Check: test-e2e
  • GitHub Check: lint
  • GitHub Check: gen
🔇 Additional comments (3)
agent/agentcontainers/api.go (3)

164-165: LGTM! Comment accurately reflects the AND logic.

The documentation now correctly describes that containers must match all provided labels, which aligns with the implementation changes.


930-934: Excellent fix for test devcontainer interference.

This change appropriately excludes test devcontainers from normal processing when no explicit include filters are set, which should resolve the integration test issues mentioned in the PR objectives.


936-942: Correct implementation of AND logic for label filtering.

The logic properly changed from OR to AND behavior:

  • Initializes ok = true
  • Uses logical AND (ok = ok && (found && v == value)) to require all labels to match
  • This provides more precise filtering control and aligns with the updated documentation
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch danielle/fix-devcontainer-integration-tests

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@DanielleMaywood DanielleMaywood requested a review from Copilot July 31, 2025 11:14
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

This PR fixes devcontainer integration tests by correcting the container filtering logic and improving how test containers are handled. The fix addresses filtering behavior to ensure proper container inclusion/exclusion based on labels.

  • Updated container label filtering logic to require all labels to match (AND behavior) instead of any label (OR behavior)
  • Added explicit filtering to ignore test devcontainers when no include filters are set
  • Reorganized the filtering logic to handle test containers more appropriately

@DanielleMaywood DanielleMaywood marked this pull request as ready for review July 31, 2025 11:30
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

:shipit:

}
v, found := container.Labels[label]

includeContainer = includeContainer && (found && v == value)
Copy link
Member

Choose a reason for hiding this comment

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

no break when matched?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change is to ensure every filter is found, instead of just one.

@DanielleMaywood DanielleMaywood merged commit cc4f8da into main Jul 31, 2025
35 checks passed
@DanielleMaywood DanielleMaywood deleted the danielle/fix-devcontainer-integration-tests branch July 31, 2025 12:24
@github-actions github-actions bot locked and limited conversation to collaborators Jul 31, 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.

3 participants