Skip to content

Conversation

@adimoldovan
Copy link
Contributor

@adimoldovan adimoldovan commented Dec 8, 2025

Changes proposed in this Pull Request:

Contributes to QAO-172

Adds diagnostics to debug intermittent wp-env port binding failures and explicitly sets all wp-env ports via environment variables.

How to test the changes in this Pull Request:

  • CI still green.

This adds diagnostic output to help identify the root cause of wp-env
port binding failures in CI.

Pre-start diagnostics:
- Docker containers
- Docker networks
- Ports currently in use

Post-failure diagnostics (only shown on failure):
- Docker containers after failure
- Docker logs from mysql containers
- Ports in use after failure
- Which processes are using common wp-env ports

Related: QAO-172

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@github-actions github-actions bot added the focus: monorepo infrastructure Issues and PRs related to monorepo tooling. label Dec 8, 2025
@adimoldovan adimoldovan self-assigned this Dec 8, 2025
@adimoldovan adimoldovan requested a review from Copilot December 8, 2025 12:43
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

Testing Guidelines

Hi @jorgeatorres ,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

Copy link
Contributor

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 addresses intermittent wp-env port binding failures in CI by replacing randomized port assignments with fixed port values and adding comprehensive diagnostic output to aid in debugging failures.

  • Removes the randomized port generation logic that was previously used to avoid conflicts
  • Sets fixed wp-env ports (8888, 58888, 8086, 58086) via environment variables
  • Adds detailed pre-start and post-failure diagnostics including Docker state, network configuration, and port usage information

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@adimoldovan adimoldovan marked this pull request as ready for review December 8, 2025 12:55
@adimoldovan adimoldovan requested a review from a team as a code owner December 8, 2025 12:55
@adimoldovan adimoldovan requested review from jorgeatorres and removed request for a team December 8, 2025 12:55
@adimoldovan adimoldovan added this to the 10.5.0 milestone Dec 8, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 8, 2025

📝 Walkthrough

Walkthrough

The CI workflow file is updated to use fixed port values for wp-env instead of dynamic generation, add pre-start diagnostic output (port states, Docker containers, networks), and implement post-failure diagnostics with error handling when wp-env startup fails.

Changes

Cohort / File(s) Change Summary
CI Workflow Configuration
.github/workflows/ci.yml
Replaces dynamic port generation with fixed values (WP_ENV_PORT=8888, WP_ENV_MYSQL_PORT=58888, WP_ENV_TESTS_PORT=8086, WP_ENV_TESTS_MYSQL_PORT=58086); exports environment variables for the step; adds pre-start diagnostics (port states, Docker containers, networks); adds post-failure diagnostics and error handling (containers, MySQL logs, port usage) if wp-env start fails.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Configuration-based changes with fixed port values and environment variable exports
  • Diagnostic and error-handling commands follow consistent patterns
  • No complex logic or control flow changes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly aligns with the main change: adding debugging diagnostics for wp-env start failures.
Description check ✅ Passed The description clearly relates to the changeset by explaining the purpose of adding diagnostics for wp-env failures and port configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch qao-172-debug-wp-env-port-failures

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 274e548 and add653a.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml (1 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). (5)
  • GitHub Check: Run tests / Report results on Slack
  • GitHub Check: Run tests / Report results on Slack
  • GitHub Check: Run tests / Report results on Slack
  • GitHub Check: Run tests / Report results on Slack
  • GitHub Check: Run tests / Report results on Slack
🔇 Additional comments (3)
.github/workflows/ci.yml (3)

191-202: Fixed ports configuration is well-structured.

The dual export pattern (lines 191-196 to GITHUB_ENV, lines 199-202 as local exports) is correct: GITHUB_ENV variables become available in subsequent steps only, so the explicit exports in lines 199-202 are necessary for the current step's diagnostics and wp-env invocation.


205-217: Pre-start diagnostics are comprehensive and robust.

The diagnostic output with collapsible grouping, port assignments, Docker state, and port binding information should effectively help debug intermittent failures. The fallback chains (ss → netstat) ensure compatibility across different systems.


220-236: The post-failure diagnostics are well-designed, but the ss command syntax on line 232 is already correct.

The conditional execution and multi-step fallback diagnostics (containers, MySQL logs, port usage, process inspection) provide excellent visibility into failure causes. The || true guards throughout ensure diagnostics don't compound the original failure.

The ss -tlnp "sport = :$port" syntax with the quoted filter is actually the correct and recommended approach. Documentation for the ss command advises quoting filter expressions, and the double quotes correctly allow bash variable expansion. The unquoted alternative suggested in the original comment is less reliable and could cause shell interpretation issues. No changes needed here.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@adimoldovan adimoldovan merged commit 2aac763 into trunk Dec 8, 2025
143 of 147 checks passed
@adimoldovan adimoldovan deleted the qao-172-debug-wp-env-port-failures branch December 8, 2025 13:02
vladolaru pushed a commit that referenced this pull request Dec 12, 2025
* Add debugging for wp-env start failures

This adds diagnostic output to help identify the root cause of wp-env
port binding failures in CI.
leonardola pushed a commit that referenced this pull request Dec 16, 2025
* Add debugging for wp-env start failures

This adds diagnostic output to help identify the root cause of wp-env
port binding failures in CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

focus: monorepo infrastructure Issues and PRs related to monorepo tooling.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant