fix(menu): prevent guardProc buffer wipe race & eliminate login-shell overhead - #6502
Open
shrijit37 wants to merge 1 commit into
Open
fix(menu): prevent guardProc buffer wipe race & eliminate login-shell overhead#6502shrijit37 wants to merge 1 commit into
shrijit37 wants to merge 1 commit into
Conversation
- Prevent clearing in-flight guardProc stdout buffer when evaluateGuards is called concurrently. - Queue pending guard evaluations until active guardProc completes. - Preserve existing whenResults and checkedResults across guard evaluations to prevent items/submenus from disappearing on partial runs. - Use 'bash -c' instead of 'bash -lc' to eliminate login-shell startup overhead per guard pass.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes concurrent menu guard evaluation races and reduces guard startup latency.
Changes:
- Queues guard reevaluation while a pass is running.
- Preserves prior guard results when parsing partial output.
- Replaces login-shell execution with
bash -c.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+954
to
+956
| if (guardProc.running) { | ||
| root.guardEvaluationPending = true | ||
| return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When opening or toggling the Omarchy menu (such as via the physical keyboard power button
omarchy-menu toggle system), the menu intermittently opens completely empty ("Nothing here yet") or fails to display submenus/items.Root Cause Analysis
evaluateGuards()clearsguardProc.collected = ""and attempts to startguardProc(bash -lc script). IfevaluateGuards()is invoked whileguardProcis already running in background,guardProc.collectedis wiped mid-flight. WhenguardProc.onExitedeventually runs, it parses a truncated stdout buffer.whenResultsOverwrite:guardProc.onExitedoverwritesroot.whenResultsandroot.checkedResultswith the partial/empty output, causingisVisible()checks to returnfalsefor valid items/submenus and rendering an empty state ("Nothing here yet").bash -lcloads startup profile scripts (~/.bashrc,~/.bash_profile, etc.) on every guard pass, adding unnecessary latency to evaluation.Fix
guardProc.runningis true whenevaluateGuards()is called, markguardEvaluationPending = trueand return without touchingguardProc.collected. Re-runevaluateGuards()whenguardProcexits if pending.whenResultsandcheckedResultsinto existing result maps inonExitedso partial output never wipes known valid item visibility states.bash -cinstead ofbash -lcto avoid startup profile overhead.