Skip to content

Open selected file explorer item from keyboard#6036

Open
azooz2003-bit wants to merge 7 commits into
mainfrom
issue-5996-file-explorer-return-open
Open

Open selected file explorer item from keyboard#6036
azooz2003-bit wants to merge 7 commits into
mainfrom
issue-5996-file-explorer-return-open

Conversation

@azooz2003-bit

@azooz2003-bit azooz2003-bit commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a shared file explorer activation path for double-click, Return, keypad Enter, and the configurable Open Selection shortcut.
  • Adds openFileExplorerSelection to shortcut settings, cmux.json schema support, Settings UI ordering, localization, and docs.
  • Covers file open, folder expand/collapse, shortcut matching, and Settings-visible metadata.

Issue

Acceptance Criteria

  • Return opens the selected local file when the file explorer outline is focused.
  • Return toggles the selected folder expansion when the file explorer outline is focused.
  • Cmd-Down opens the selected file explorer item by default and is configurable in Settings and cmux.json.
  • Shortcut metadata is localized and documented.

Verification

  • git diff --check
  • ./scripts/lint-pbxproj-test-wiring.sh
  • swift test in Packages/CmuxSettings
  • bun run lint in web (passed with existing warnings)
  • SKIP_ENV_VALIDATION=1 bun run build in web
  • ./scripts/reload-cloud.sh --tag fexopen attempted cloud builder, fell back because no macfleet manifest/no slot
  • ./scripts/reload.sh --tag fexopen

Dogfood Preflight

  • Built tag: fexopen
  • Fixture: /Users/abdulazizalbahar/Dev/Manaflow/cmuxterm-hq/cmux-assets/issue-5996-file-explorer-return-open/fixture
  • /Users/abdulazizalbahar/Dev/Manaflow/cmuxterm-hq/cmux-assets/issue-5996-file-explorer-return-open/auto-feature/20260612-222230/preflight/before-open.png | TLDR: File explorer focused on fixture with Sources selected.
  • /Users/abdulazizalbahar/Dev/Manaflow/cmuxterm-hq/cmux-assets/issue-5996-file-explorer-return-open/auto-feature/20260612-222230/preflight/return-expanded-folder.png | TLDR: Return expanded the selected Sources folder.
  • /Users/abdulazizalbahar/Dev/Manaflow/cmuxterm-hq/cmux-assets/issue-5996-file-explorer-return-open/auto-feature/20260612-222230/preflight/return-opened-appswift.png | TLDR: Return opened selected App.swift into a file preview.
  • /Users/abdulazizalbahar/Dev/Manaflow/cmuxterm-hq/cmux-assets/issue-5996-file-explorer-return-open/auto-feature/20260612-222230/preflight/cmd-down-opened-readme.png | TLDR: Cmd-Down opened selected README.md into a markdown preview.

Baseline Cloud Recording


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Adds keyboard activation for the file explorer: Return/Enter and a configurable ⌘↓ shortcut open files or toggle folders, unified with double‑click. Default is ⌘↓ (openFileExplorerSelection); it honors right‑sidebar focus and prefers the visible outline selection, addressing #5996.

  • New Features

    • Return and keypad Enter open the selected file or toggle a folder when the explorer is focused.
    • Added openFileExplorerSelection (default ⌘↓) in Settings and cmux.json; grouped with right‑sidebar/find; docs updated; label localized.
    • Shared activation path for Return/Enter, ⌘↓, and double‑click; activation prefers the visible outline selection; ⌘↓ obeys right‑sidebar focus context.
  • Bug Fixes

    • CI: create the virtual display before the AppKit startup probe to stabilize the main‑thread regression check.

Written for commit 54d53f4. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added keyboard shortcut "File Explorer: Open Selection" (⌘+↓) to open the selected item or preview.
  • Improvements

    • Enhanced file explorer keyboard handling: consistent open/expand/collapse behavior, improved selection resolution, and quick‑search support.
    • Shortcut settings reordered so the new action appears with other right‑sidebar shortcuts.
  • Documentation

    • Updated docs, examples, schema, and localization entries for the new shortcut.
  • Tests

    • Added tests covering open‑selection shortcut behavior and settings ordering.

@vercel

vercel Bot commented Jun 13, 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 Jun 13, 2026 6:33am
cmux-staging Building Building Preview, Comment Jun 13, 2026 6:33am

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds a new keyboard shortcut openFileExplorerSelection (Cmd+Down) to open selected files in the file explorer. The action is registered in the shortcut system, keyboard handling is implemented via a custom NSOutlineView subclass with shortcut matching, file explorer activation is refactored into shared coordinator methods, and the feature is tested and documented across configuration and web docs.

Changes

File Explorer Open Selection Shortcut

Layer / File(s) Summary
Shortcut action registration and system integration
Packages/CmuxSettings/Sources/CmuxSettings/Values/ShortcutAction.swift, Packages/CmuxSettings/Sources/CmuxSettings/Values/ShortcutAction+Defaults.swift, Sources/KeyboardShortcutSettings.swift, Sources/KeyboardShortcutContext.swift, Packages/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/KeyboardShortcutsSection.swift, Resources/Localizable.xcstrings
ShortcutAction and KeyboardShortcutSettings.Action both gain .openFileExplorerSelection case; default binding is Cmd+Down; action is grouped with sidebar actions, mapped to right-sidebar focus context, positioned in settings UI after .toggleRightSidebar, and localized to English and Japanese.
File explorer keyboard event handling and shared activation logic
Sources/FileExplorerOutlineView.swift, Sources/FileExplorerView.swift
FileExplorerKeyboardActivation helpers detect when key events match the open-selection shortcut; FileExplorerNSOutlineView custom outline subclass routes keyDown and performKeyEquivalent through sidebar mode shortcuts, open-selection action with quick-search integration, and keyboard navigation; coordinator methods openSelectedItem and activateNode centralize file/folder activation; selection resolution prefers the outline view selection and syncs the store when they differ.
Test coverage for keyboard activation and shortcut defaults
cmuxTests/FileExplorerKeyboardActivationTests.swift, cmuxTests/WorkspaceUnitTests.swift
FileExplorerKeyboardActivationTests validates opening files and toggling folders through shared activation, verifies shortcut matching for Return/Enter/configured keys, and asserts action metadata; WorkspaceUnitTests confirms localized label and default shortcut configuration match settings surface and visible action ordering.
Build configuration updates
cmux.xcodeproj/project.pbxproj
Registers FileExplorerOutlineView.swift in main app target sources and FileExplorerKeyboardActivationTests.swift in test target sources.
Documentation and schema updates
skills/cmux-settings/references/shortcut-actions.md, web/app/[locale]/docs/configuration/page.tsx, web/app/[locale]/docs/keyboard-shortcuts/page.tsx, web/data/cmux-shortcuts.ts, web/data/cmux.schema.json
Replaces toggleFileExplorer reference with openFileExplorerSelection in shortcut actions reference; includes new binding in web docs examples; extends shortcut data definitions with localized descriptions and Return key equivalence note; adds action id to JSON schema validation enum.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Suggested reviewers

  • lawrencecchen

Poem

🐰 A rabbit hops through file explorer skies,
Cmd+Down nudges open the prize,
Quick-search hums and folders spin,
Selection opens — let the preview begin! ✨

🚥 Pre-merge checks | ✅ 20 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (20 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: enabling keyboard activation to open selected file explorer items, which is the primary feature added across all modified files.
Description check ✅ Passed The description is comprehensive and follows the template structure with Summary, Testing, Issue links, Acceptance Criteria, and Verification steps clearly documented, though lacking a demo video link.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Swift Actor Isolation ✅ Passed Scanned Swift diffs: new openFileExplorerSelection logic stays in AppKit/UI paths; FileExplorerView uses Task { @MainActor }; OutlineView has no async/background work; no Sendable/isolated-state vi...
Cmux Swift Blocking Runtime ✅ Passed Searched production Swift files for swift-blocking primitives (DispatchSemaphore, Task.sleep, DispatchQueue.*sync, locks, timers, polling); none found. Only test helper uses RunLoop polling.
Cmux Expensive Synchronous Load ✅ Passed In the PR’s changed Swift files, I found zero uses of RestorableAgentSessionIndex.load/SharedLiveAgentIndex.shared/sysctl or other sync-load/disk-I/O patterns, so no expensive synchronous loader wa...
Cmux Cache Substitution Correctness ✅ Passed Rules target persistence/history/undo/snapshot cache substitution. PR only adds openFileExplorerSelection and UI-only memoization (emptyAreaHeight nil→0; stale invalidated), with no persisted/undo/...
Cmux No Hacky Sleeps ✅ Passed PR adds sleep 3 + kill -0 only to .github/workflows/ci.yml (CI orchestration); rules allow workflow YAML sleeps, and no changed non-Swift TS/JS/shell files add hacky waits.
Cmux Algorithmic Complexity ✅ Passed Quick-search full scans (for row in 0..<outlineView.numberOfRows) already exist in main and the earliest PR commit; this PR mainly wires new shortcut without introducing new unbounded hot-path scans.
Cmux Swift Concurrency ✅ Passed PR #6036 diff view contains no legacy async modernization targets (no DispatchQueue/Task/async/completion handlers/AnyCancellable); only a new import Combine appears.
Cmux Swift @Concurrent ✅ Passed PR Swift diff contains no async, nonisolated async, or @concurrent occurrences, so there’s no missing/invalid Swift concurrency annotation to flag.
Cmux Swift File And Package Boundaries ✅ Passed No production Swift boundary violations found: new Sources/FileExplorerOutlineView.swift is 213 LOC and cohesive; other production Swift edits are small within existing (already oversized) files, n...
Cmux Swift Logging ✅ Passed Scanned PR’s Swift production files (ShortcutAction*, KeyboardShortcutsSection, FileExplorerView, KeyboardShortcut*, new FileExplorerOutlineView): no print/debugPrint/dump/NSLog and no file-scoped...
Cmux User-Facing Error Privacy ✅ Passed PR only adds shortcut/localization + file-explorer activation; web diff search found no user-facing error/alert text with vendor/provider/ids/tokens—only a generic test fatalError (“Failed to const...
Cmux Full Internationalization ✅ Passed New shortcut label uses String(localized:defaultValue:) and Resources/Localizable.xcstrings includes translations for all 20 locales. Web cmux-shortcuts adds description/note for the same 20 locale...
Cmux Swiftui State Layout ✅ Passed In SwiftUI files touched (KeyboardShortcutsSection.swift, KeyboardShortcutSettings.swift), there are 0 hits for ObservableObject/@Published/@StateObject/@EnvironmentObject/GeometryReader; no render...
Cmux Architecture Rethink ✅ Passed Swift code for this PR shows no timing/blocking repair patterns (no sleep/asyncAfter/locks/polling); open-selection activation routes through shared coordinator logic.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PR only changes keyboard shortcuts + file-explorer activation; in the affected Swift files there are no new standalone NSWindow/NSPanel/SwiftUI WindowGroup or cmux.* identifier assignments. The lin...
Cmux Source Artifacts ✅ Passed All PR-listed changed paths are hand-written source/config/docs (Swift, TSX/TS/JSON, schema, md, workflow, localization). No local/generated artifacts (logs, screenshots, DerivedData, caches) appea...

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-5996-file-explorer-return-open

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.

@greptile-apps

greptile-apps Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR implements keyboard activation for the file explorer: Return/keypad-Enter open files or toggle folders while the explorer is focused, and a new configurable openFileExplorerSelection action (default ⌘↓) is wired through shortcut settings, when-clauses, schema, Settings UI, xcstrings, and web docs.

  • FileExplorerNSOutlineView is extracted to its own file (FileExplorerOutlineView.swift), and a shared activateNode path replaces the previous duplicated logic between double-click and the new keyboard path.
  • resolvedSelectionRow now prioritises the visible outline selection over the store's selectedPath, and the localizedText helper is lifted into cmux-shortcuts.ts with a proper per-locale lookup before the English/Japanese fallbacks.
  • All 20 web locales and all Xcode xcstrings locales are covered by the new translations; the CI job order is corrected so the virtual display is created before the CoreAnimation regression test.

Confidence Score: 5/5

Safe to merge — the change is well-scoped, all locales are covered, the shared activation path is consistent, and the when-clause correctly gates the configured shortcut to sidebar focus.

The keyboard activation logic is straightforward: Return/keypad-Enter are intercepted before quick-search and always owned by the view, the configured ⌘↓ shortcut respects the existing sidebar when-clause, and the refactored activateNode path unifies double-click and keyboard without behavioral regression. Localization is complete across all 20 web locales and all Xcode xcstrings locales. Tests cover the added code paths.

No files require special attention.

Important Files Changed

Filename Overview
Sources/FileExplorerOutlineView.swift New file extracting FileExplorerNSOutlineView and FileExplorerKeyboardActivation enum; adds handleOpenSelectionShortcut before quick-search in keyDown/performKeyEquivalent; logic is clean and correctly returns true unconditionally for matched events.
Sources/FileExplorerView.swift Adds openSelectedItem/activateNode shared path; resolvedSelectionRow now prioritises the visible outline selection over store state; refactoring is correct and preserves double-click semantics.
Packages/CmuxSettings/Sources/CmuxSettings/Values/ShortcutAction.swift Adds openFileExplorerSelection case with .panes category, .atom(.sidebarFocus) when-clause, and a fully localised String(localized:) label; all correct.
Resources/Localizable.xcstrings Adds shortcut.openFileExplorerSelection.label with translations for all supported Xcode locales (ar, bs, da, de, en, es, fr, it, ja, km, ko, nb, pl, pt-BR, ru, th, tr, uk, zh-Hans, zh-Hant).
web/data/cmux-shortcuts.ts Adds openFileExplorerSelection shortcut entry with description and note covering all 20 web locales; lifts localizedText helper with proper per-locale lookup and en/ja fallback.
Sources/KeyboardShortcutContext.swift Correctly registers openFileExplorerSelection under .rightSidebarFocus context so the shortcut is scoped to the sidebar.
.github/workflows/ci.yml Moves 'Create virtual display' step before the CoreAnimation regression so the display exists when that test runs; sleep 3 is CI-only orchestration, not production synchronization.
cmuxTests/FileExplorerKeyboardActivationTests.swift New test suite covers file open, folder toggle, shortcut matching, metadata, and settings ordering; replaces the deleted XCTestCase equivalent from WorkspaceUnitTests.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    KD[keyDown / performKeyEquivalent] --> MSC{Mode shortcut?}
    MSC -- yes --> HMS[handleModeShortcut]
    HMS --> DONE[Consumed]
    MSC -- no --> OSS{handleOpenSelectionShortcut?}
    OSS -- "Return / KPEnter\nor matches ⌘↓ + whenClause" --> EQS[endQuickSearch]
    EQS --> OSI[openSelectedItem]
    OSI --> RSR[resolvedSelectionRow]
    RSR --> OVR{outlineView.selectedRow ≥ 0?}
    OVR -- yes --> AN["activateNode\n→ selectRow"]
    AN --> DIR{isDirectory?}
    DIR -- yes --> TOG[expand / collapse]
    DIR -- no --> LP{LocalFileExplorerProvider?}
    LP -- yes --> OFP[onOpenFilePreview]
    LP -- no --> NOOP["no-op, return true"]
    OVR -- no --> STR{store.selectedPath?}
    STR -- found in outline --> AN
    STR -- not found --> RET_FALSE[return false]
    OSS -- no match --> QSA{quickSearchActive?}
    QSA -- yes --> QSK[handleQuickSearchKey]
    QSA -- no --> NAV[nav / disclosure / slash / super]
Loading

Reviews (5): Last reviewed commit: "Run CI display setup before AppKit start..." | Re-trigger Greptile

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Sources/FileExplorerOutlineView.swift`:
- Around line 148-154: The handler handleOpenSelectionShortcut currently fires
the openFileExplorerSelection action without checking the action’s effective
when clause; update handleOpenSelectionShortcut to first verify the action is
allowed (same check used by the mode-shortcut path) before calling
endQuickSearch() and fileExplorerCoordinator?.openSelectedItem(in:);
specifically, call the existing shortcut/permission evaluation helper used
elsewhere (or evaluate the action's .when predicate for
openFileExplorerSelection in the current context) and return false if that check
fails so the action only runs when its when-clause permits it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2157a143-16a8-489f-8f22-d289db370152

📥 Commits

Reviewing files that changed from the base of the PR and between 3cd5ab3 and a7693bb.

📒 Files selected for processing (7)
  • Packages/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/KeyboardShortcutsSection.swift
  • Sources/FileExplorerOutlineView.swift
  • Sources/FileExplorerView.swift
  • Sources/KeyboardShortcutSettings.swift
  • cmux.xcodeproj/project.pbxproj
  • cmuxTests/FileExplorerKeyboardActivationTests.swift
  • cmuxTests/WorkspaceUnitTests.swift
💤 Files with no reviewable changes (2)
  • cmuxTests/WorkspaceUnitTests.swift
  • Sources/FileExplorerView.swift

Comment thread Sources/FileExplorerOutlineView.swift
Comment on lines +148 to +154
private func handleOpenSelectionShortcut(_ event: NSEvent) -> Bool {
guard FileExplorerKeyboardActivation.matchesOpenSelectionShortcut(event) else {
return false
}
endQuickSearch()
return fileExplorerCoordinator?.openSelectedItem(in: self) ?? false
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 When quick search is active and the user presses Return (or keypad Enter) but there is no selection (e.g. the quick-search query matched nothing, leaving selectedRow == -1 and store.selectedPath == nil), handleOpenSelectionShortcut calls endQuickSearch() — setting quickSearchActive = false — and then returns false because openSelectedItem found no row. The caller now sees quickSearchActive == false, so if quickSearchActive, handleQuickSearchKey(event) short-circuits and the Return event falls all the way through to super.keyDown, triggering a system alert beep. Before this PR, handleQuickSearchKey consumed Return unconditionally when quick search was active. The intent is clearly that any Return/keypad-Enter event is fully owned by this view when it matches matchesOpenSelectionShortcut. Returning true regardless of whether an item was actually opened fixes the beep while keeping the open-if-possible behaviour.

Suggested change
private func handleOpenSelectionShortcut(_ event: NSEvent) -> Bool {
guard FileExplorerKeyboardActivation.matchesOpenSelectionShortcut(event) else {
return false
}
endQuickSearch()
return fileExplorerCoordinator?.openSelectedItem(in: self) ?? false
}
private func handleOpenSelectionShortcut(_ event: NSEvent) -> Bool {
guard FileExplorerKeyboardActivation.matchesOpenSelectionShortcut(event) else {
return false
}
endQuickSearch()
_ = fileExplorerCoordinator?.openSelectedItem(in: self)
return true
}

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 634-643: Replace the fragile "sleep 3" + "kill -0" readiness check
by invoking the helper with its --ready-path and --display-id-path flags (from
scripts/create-virtual-display.m), write the helper's PID to VDISPLAY_PID as
before, then poll for the ready file (with a timeout) and read the display id
from the display-id file into the environment (echo "VDISPLAY_ID=..." >>
"$GITHUB_ENV"); if the ready file isn't created in time, kill the helper and
fail. Ensure you still export VDISPLAY_PID to GITHUB_ENV and keep robust cleanup
on timeout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 297f793a-1c4d-4abb-a322-14bc2ca1be70

📥 Commits

Reviewing files that changed from the base of the PR and between ea9e264 and 54d53f4.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Comment thread .github/workflows/ci.yml
Comment on lines +634 to +643
- name: Create virtual display
run: |
set -euo pipefail
clang -framework Foundation -framework CoreGraphics \
-o /tmp/create-virtual-display scripts/create-virtual-display.m
/tmp/create-virtual-display &
VDISPLAY_PID=$!
echo "VDISPLAY_PID=$VDISPLAY_PID" >> "$GITHUB_ENV"
sleep 3
kill -0 "$VDISPLAY_PID"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Virtual display readiness check is fragile; consider using helper's signal files.

The sleep 3 + kill -0 pattern only confirms the helper process is running, not that the virtual display was successfully created. The helper supports --ready-path and --display-id-path flags (see scripts/create-virtual-display.m) which signal when the display is actually ready. The same workflow in test-e2e.yml uses these for robust polling.

Since this step was moved earlier, both the CoreAnimation regression and workspace churn typing-lag regression now depend on it. If display creation takes longer than 3 seconds on a loaded runner, downstream steps could fail intermittently.

🛡️ Suggested improvement using readiness files
       - name: Create virtual display
         run: |
           set -euo pipefail
           clang -framework Foundation -framework CoreGraphics \
             -o /tmp/create-virtual-display scripts/create-virtual-display.m
-          /tmp/create-virtual-display &
+          VDISPLAY_READY="$RUNNER_TEMP/cmux-virtual-display.ready"
+          VDISPLAY_ID_PATH="$RUNNER_TEMP/cmux-virtual-display.id"
+          rm -f "$VDISPLAY_READY" "$VDISPLAY_ID_PATH"
+          /tmp/create-virtual-display \
+            --ready-path "$VDISPLAY_READY" \
+            --display-id-path "$VDISPLAY_ID_PATH" &
           VDISPLAY_PID=$!
           echo "VDISPLAY_PID=$VDISPLAY_PID" >> "$GITHUB_ENV"
-          sleep 3
-          kill -0 "$VDISPLAY_PID"
+          for _ in $(seq 1 60); do
+            if [ -s "$VDISPLAY_READY" ]; then break; fi
+            if ! kill -0 "$VDISPLAY_PID" 2>/dev/null; then
+              echo "Virtual display helper exited before ready" >&2
+              exit 1
+            fi
+            sleep 0.5
+          done
+          if [ ! -s "$VDISPLAY_READY" ]; then
+            echo "Timed out waiting for virtual display" >&2
+            exit 1
+          fi
+          echo "Virtual display ready"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Create virtual display
run: |
set -euo pipefail
clang -framework Foundation -framework CoreGraphics \
-o /tmp/create-virtual-display scripts/create-virtual-display.m
/tmp/create-virtual-display &
VDISPLAY_PID=$!
echo "VDISPLAY_PID=$VDISPLAY_PID" >> "$GITHUB_ENV"
sleep 3
kill -0 "$VDISPLAY_PID"
- name: Create virtual display
run: |
set -euo pipefail
clang -framework Foundation -framework CoreGraphics \
-o /tmp/create-virtual-display scripts/create-virtual-display.m
VDISPLAY_READY="$RUNNER_TEMP/cmux-virtual-display.ready"
VDISPLAY_ID_PATH="$RUNNER_TEMP/cmux-virtual-display.id"
rm -f "$VDISPLAY_READY" "$VDISPLAY_ID_PATH"
/tmp/create-virtual-display \
--ready-path "$VDISPLAY_READY" \
--display-id-path "$VDISPLAY_ID_PATH" &
VDISPLAY_PID=$!
echo "VDISPLAY_PID=$VDISPLAY_PID" >> "$GITHUB_ENV"
for _ in $(seq 1 60); do
if [ -s "$VDISPLAY_READY" ]; then break; fi
if ! kill -0 "$VDISPLAY_PID" 2>/dev/null; then
echo "Virtual display helper exited before ready" >&2
exit 1
fi
sleep 0.5
done
if [ ! -s "$VDISPLAY_READY" ]; then
echo "Timed out waiting for virtual display" >&2
exit 1
fi
echo "Virtual display ready"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 634 - 643, Replace the fragile "sleep
3" + "kill -0" readiness check by invoking the helper with its --ready-path and
--display-id-path flags (from scripts/create-virtual-display.m), write the
helper's PID to VDISPLAY_PID as before, then poll for the ready file (with a
timeout) and read the display id from the display-id file into the environment
(echo "VDISPLAY_ID=..." >> "$GITHUB_ENV"); if the ready file isn't created in
time, kill the helper and fail. Ensure you still export VDISPLAY_PID to
GITHUB_ENV and keep robust cleanup on timeout.

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