Skip to content

[build] start X server before launching fluxbox#17644

Merged
titusfortner merged 2 commits into
trunkfrom
x_server
Jun 6, 2026
Merged

[build] start X server before launching fluxbox#17644
titusfortner merged 2 commits into
trunkfrom
x_server

Conversation

@titusfortner

Copy link
Copy Markdown
Member

Tests that require a windows manager are frequently failing because Fluxbox is attempting to start before xvfb is ready

This is a race condition and the failure is silent in the GitHub step, but logs: Couldn't connect to XServer:99

💥 What does this PR do?

  • Waits for the X server before starting fluxbox.

🔧 Implementation Notes

  • Recently failing Ruby tests all logged this error and passed when failure was not present

🤖 AI assistance

  • AI assisted (complete below)
    • Tool(s): Claude Code
    • What was generated: root-cause analysis and the workflow change
    • I reviewed all AI output and can explain the change

🔄 Types of changes

  • Bug fix (backwards compatible)

@qodo-code-review

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Fix flaky tests by waiting for X server readiness

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Adds X server readiness check before launching fluxbox
• Installs x11-utils package for xdpyinfo availability
• Implements retry loop with 30 attempts and 0.5s intervals
• Eliminates race condition causing flaky window manager tests
Diagram
flowchart LR
  A["Install fluxbox and x11-utils"] --> B["Start Xvfb :99"]
  B --> C["Poll xdpyinfo for X server readiness"]
  C --> D["Launch fluxbox when ready"]
  D --> E["Set DISPLAY environment variable"]

Loading

Grey Divider

File Changes

1. .github/workflows/bazel.yml 🐞 Bug fix +6/-1

Add X server readiness check before fluxbox startup

• Adds x11-utils package installation alongside fluxbox
• Implements polling loop using xdpyinfo to verify X server availability
• Waits up to 15 seconds (30 attempts × 0.5s) before starting fluxbox
• Prevents race condition where fluxbox starts before Xvfb is ready

.github/workflows/bazel.yml


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0)

Grey Divider


Action required

1. xdpyinfo loop never fails ✓ Resolved 📘 Rule violation ☼ Reliability
Description
The workflow’s X server readiness wait loop can time out without failing, so the step still proceeds
to start fluxbox (backgrounded) even when xdpyinfo never succeeds and no display is actually
available. This violates the requirement to validate preconditions and to have deterministic timeout
failure paths for async waits, and can preserve the same intermittent/silent failure mode the wait
was meant to eliminate.
Code

.github/workflows/bazel.yml[R176-181]

+          # X server must start before fluxbox
+          for _ in $(seq 1 30); do
+            xdpyinfo -display :99 >/dev/null 2>&1 && break
+            sleep 0.5
+          done
          fluxbox -display :99 &
Evidence
PR Compliance ID 10 requires CI scripts to validate preconditions and fail safe, but the script does
not verify that the display became available after the polling loop completes. PR Compliance ID 12
requires deterministic timeout failure paths for async waits; here, the loop may end via timeout
without error, and fluxbox -display :99 & runs unconditionally afterward, meaning the step can
continue even if Xvfb never became ready, with failures easy to miss due to backgrounding.

.github/workflows/bazel.yml[176-181]
.github/workflows/bazel.yml[171-182]
Best Practice: Learned patterns
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The X server (Xvfb) readiness polling loop does not have a deterministic failure path: if `xdpyinfo` never succeeds within the timeout, the workflow still starts `fluxbox` in the background and continues, allowing silent/intermittent failures when no display is actually ready.

## Issue Context
This step is intended to eliminate a race where `fluxbox` starts before Xvfb is ready. CI/workflow scripts must validate preconditions and fail safe on errors, and async waits must have explicit timeouts with actionable failure when the timeout is exceeded; without a post-loop assertion, the race is only reduced, not eliminated.

## Fix Focus Areas
- .github/workflows/bazel.yml[171-182]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@selenium-ci selenium-ci added the B-build Includes scripting, bazel and CI integrations label Jun 5, 2026
Comment thread .github/workflows/bazel.yml
@qodo-code-review

qodo-code-review Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 3d00184

@titusfortner titusfortner merged commit c678813 into trunk Jun 6, 2026
26 checks passed
@titusfortner titusfortner deleted the x_server branch June 6, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants