Skip to content

Add virtual display for XCUITests on headless Depot runners - #721

Merged
lawrencecchen merged 1 commit into
mainfrom
task-xcuitests-depot
Mar 1, 2026
Merged

lawrencecchen merged 1 commit into
mainfrom
task-xcuitests-depot

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Mar 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Depot macOS runners have no physical display. system_profiler SPDisplaysDataType returns empty, and XCUITests fail with Failed to activate application (current state: Running Background) because macOS can't bring the app to foreground without a display.
  • Adds scripts/create-virtual-display.m, a small ObjC tool that creates a 1920x1080 virtual display using the private CGVirtualDisplay API (same approach used by Chromium CI). Runs as a background process during the workflow, dies when the step completes.
  • Workflow compiles and launches the tool before tests, with before/after display diagnostics.

Testing

  • Compiled and verified locally: clang -framework Foundation -framework CoreGraphics -o /tmp/create-virtual-display scripts/create-virtual-display.m && /tmp/create-virtual-display produces Virtual display created: 1920x1080@60Hz (displayID: 10)
  • Merge to main, then trigger: gh workflow run test-depot.yml -f skip_unit_tests=true -f test_filter=UpdatePillUITests

Related

Summary by CodeRabbit

Release Notes

  • Chores
    • Enhanced CI testing infrastructure with support for filtered test execution and customizable per-test timeouts.
    • Added virtual display support for headless testing environments, enabling UI tests to run reliably in CI/CD pipelines without a physical display.

@vercel

vercel Bot commented Mar 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Mar 1, 2026 0:26am

@coderabbitai

coderabbitai Bot commented Mar 1, 2026

Copy link
Copy Markdown

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between 1b160dc and a0d58e2.

📒 Files selected for processing (2)
  • .github/workflows/test-depot.yml
  • scripts/create-virtual-display.m
 __________________________________________________
< My OKRs are all about finding bugs in your code. >
 --------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch task-xcuitests-depot

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0d58e2f63

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

echo ""
clang -framework Foundation -framework CoreGraphics \
-o /tmp/create-virtual-display scripts/create-virtual-display.m
/tmp/create-virtual-display &

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail if virtual display process dies after launch

Starting the helper with /tmp/create-virtual-display & does not propagate its runtime failure to the step, so if CGVirtualDisplay is unavailable (or the helper exits for any reason), this step still succeeds and the workflow proceeds with no active display; UI tests then fail later with unrelated foreground-activation errors. Because set -e does not monitor background jobs, this should explicitly verify the process is still alive (or that a display appeared) before continuing.

Useful? React with 👍 / 👎.

Depot macOS runners have no physical display, causing XCUITests to fail
with "Failed to activate application (current state: Running Background)".
This adds a small ObjC tool that creates a virtual display using the
private CGVirtualDisplay API before tests run.
@lawrencecchen
lawrencecchen force-pushed the task-xcuitests-depot branch from a0d58e2 to 48a1dca Compare March 1, 2026 12:25
@lawrencecchen
lawrencecchen merged commit 2b66a2f into main Mar 1, 2026
@greptile-apps

greptile-apps Bot commented Mar 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds virtual display support for headless Depot macOS runners to fix XCUITest failures. Creates a 1920x1080@60Hz virtual display using the private CGVirtualDisplay API (same approach as Chromium CI) to resolve Failed to activate application (current state: Running Background) errors that occur when macOS cannot bring the app to foreground without a display.

  • Implemented scripts/create-virtual-display.m - Objective-C tool that creates and maintains a virtual display using private CoreGraphics APIs
  • Modified workflow to compile and launch the display tool as a background process before running tests
  • Added display diagnostics before/after to verify display creation

Confidence Score: 4/5

  • Safe to merge - focused CI infrastructure fix with proper error handling
  • Well-tested approach (used by Chromium CI), proper error checking, scoped to CI environment only. Minor point: VDISPLAY_PID stored but unused (likely for future debugging)
  • No files require special attention

Important Files Changed

Filename Overview
scripts/create-virtual-display.m New Objective-C tool creates 1920x1080 virtual display using private CoreGraphics API for headless CI runners
.github/workflows/test-depot.yml Adds virtual display compilation and background execution step with before/after diagnostics

Last reviewed commit: 48a1dca

bn-l pushed a commit to bn-l/cmux that referenced this pull request Apr 3, 2026
Depot macOS runners have no physical display, causing XCUITests to fail
with "Failed to activate application (current state: Running Background)".
This adds a small ObjC tool that creates a virtual display using the
private CGVirtualDisplay API before tests run.

This branch was successfully deployed

1 active deployment
Preview — 48a1dca9 Deployed Mar 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant