Skip to content

Keep menu rows when the guard results did not change - #14740

Open
rofrol wants to merge 3 commits into
omacom:quattrofrom
rofrol:menu-keep-rows
Open

rofrol wants to merge 3 commits into
omacom:quattrofrom
rofrol:menu-keep-rows

Conversation

@rofrol

@rofrol rofrol commented Oct 9, 2026 •

Copy link
Copy Markdown

What

A click on a menu row right after opening the menu is sometimes lost: nothing happens, and a second click works.

Opening the menu builds its rows and starts the guard batch (evaluateGuards). When the batch exits, guardProc.onExited calls rebuildDisplay(), which clears displayModel and recreates every row, even when no when:, checked: or disabled: result changed. A press that lands on a row just before the rebuild loses its MouseArea with the row, so onClicked never fires.

Now the rows are rebuilt only when one of the three result sets differs from the one the menu is showing. The first batch after the shell starts or a menu source changes still rebuilds, as before.

Why it shows up

The window is as long as the guard batch takes, so it depends on the machine: it was seen in a VM while the host was busy (a bare bash -lc true took about 0.3 s there) and went away when the host was idle. libinput debug-events showed every press paired with its release, so the input reached the shell.

Notes

  • JSON.stringify compares the maps in the guard script's id order, which is stable for the same items; a different order only causes the rebuild that happens today.
  • A result that does change can still rebuild under a press. Updating the rows in place instead of clearing the model would close that too, at the cost of a larger change to rebuildDisplay.

Testing

  • test/shell.d/menu-test.sh runs the guard process's exit handler from Menu.qml against a stand-in root: a batch that repeats the shown results keeps the rows, a changed visibility, checked or disabled result rebuilds them. It passes with the change and fails without it (menu keeps its rows when a guard batch repeats the results it shows), and also fails if the result assignments move above the comparison. menu-guards-test.sh fails the same way with and without the change on the machine I ran it on (macOS, no pacman: guard prelude resolves packages as pacman does), so that one is unrelated.
  • In a VM running Omarchy 4.0.4 (a Guix-based guest, with the equivalent change to the 4.0.4 Menu.qml, minus disabled:, which 4.0.4 does not have yet): a user menu extension added a root row whose action appends to a file and whose when: guard takes 3 s, which keeps the guard batch running for 3 s after each open. The menu was opened with Super+Space and the row was pressed 0.2 s after the menu layer mapped (Hyprland's openlayer event) and released 4 s later, so the press spans the batch's exit:
    • without the change, 2 of 10 such clicks ran the action;
    • with it, 10 of 10 did;
    • quick clicks (30 ms) at random times up to 1.5 s after opening worked 30 of 30 in both, since they rarely overlap the rebuild.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ucstzc5CCY22DABDnFrkXr
@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable new issues were found.

Summary

The menu keeps its rows when guard results stay the same, avoiding lost clicks caused by needless row replacement.

  • The latest change compares results by ID instead of their arrival order.
  • Tests cover reordered results and results for different rows.
  • The earlier test concern is addressed: the test runs the real exit handler and checks unchanged results plus changes to all three result maps.

Reviews (3) · Last reviewed commit: "Compare guard results by id, not by the ..." · Reviewed by Greptile

Comment thread test/shell.d/menu-test.sh Resolved
The assertion matched the comparison's spelling, so moving the result
assignments ahead of it would have passed while changed guards never
refreshed the rows. Run the guard process's exit handler against a
stand-in root instead: a batch that repeats the shown results keeps the
rows, and a changed visibility, checked or disabled result rebuilds them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VxoFhvW3i63ay7Zsbdfi3i
@jandrusk

Copy link
Copy Markdown

The fix and the test look right to me. One cross-link: #15048 (dhh) moves the guard batch to run once at startup instead of per menu file, and #14993 appends rows in one batch. If #15048 lands, the window this closes may shrink or go away, so this is worth rebasing on top of it and checking whether the press-during-rebuild case still reproduces.

The guards run in eight subshells side by side, so a batch reports the same results in a different order each time. Comparing the JSON strings saw that as a change and rebuilt the rows on every batch, which is the rebuild this pull request exists to avoid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed against current quattro (51bfd1d), with this branch merged onto it, on an Omarchy worker VM with the shell linked to the tree.

The bug is real on quattro. openExistingMenu still runs the guard batch on every open, and its exit still calls rebuildDisplay(). To reproduce it with a real pointer, I gave About a when: "sleep 3; true" guard, opened the menu, and pressed a virtual mouse on the row 0.3 s after opening, releasing it 4 s later so the press spanned the batch's exit. On quattro, 0 of 10 clicks ran the action. As controls, quick clicks (5 of 5) and presses released before the batch ended (4 of 4) worked.

As first pushed, the change did not fix it on quattro: 0 of 10. Since #15049, the guards run in eight subshells side by side, so each batch reports the same results in a different order. Two JSON.stringify strings built from those maps differ even when every value is the same, so changed was true on every batch and the rows were rebuilt as before. Logging from the handler on the worker showed changed=true on batches whose values were identical.

Pushed ed5e48c to this branch. It compares the three result maps by id (same ids, same values) rather than as strings, and adds two cases to menu-test.sh: the same results in another order keep the rows, and a batch that answers for a different row rebuilds them. With it, 10 of 10 long presses ran the action. menu-test.sh passes 173 of 173. Swapping the string comparison back in fails the new order case, and dropping the comparison fails your original case.

Full suite (./test/all) on the worker: 6534 passed, 7 failed. The failing tests are ascii, branding-about-animation, hyprland-startup-cursor-cold, i18n, lock-appear-budget, passwordless-grant-lifecycle and runtime-smoke. Each fails the same way on quattro without this change. channel-sudo-boundary also failed once in the full run, then passed twice when run alone on this branch.

No second opinion. The configured reviewer, Codex Medium, did not run: the day's review budget was spent. So this review is one model's (Claude Opus 5.5), and the classification is unsettled for the same reason. A review by the second model will be needed before this can be marked ready.

Related: #14993 also changes how rebuildDisplay() fills the rows, but it does not compete with this. #15048, mentioned above, has merged and did not close the window, since the batch still runs on every open.

Waiting on the second opinion, then the maintainer. Nothing is needed from you.

rofrol added a commit to omaguix/try-omaguix that referenced this pull request Oct 25, 2026
omacom/omarchy#14740 (comment) by omarchybot
(2026-10-16) did what the item asked: it merged the branch onto quattro
51bfd1dba (after #15048), reproduced the press-across-guard-exit bug with
a real pointer (0 of 10 clicks ran), found the first fix still failed
there because parallel guards report results in another order, pushed
ed5e48ce comparing the results by id (10 of 10, menu-test.sh 173 of 173)
and said nothing is needed from the author. The PR is mergeable on
current quattro; it waits on their second reviewer and the maintainer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015WSJYF8115GK3o1hEsCiCj
@omarchybot

Copy link
Copy Markdown
Collaborator

Followed up on the failed Check translation structure run for ed5e48ceda57055ef3ecf04aed3367b51baddd6f. GitHub currently returns zero jobs and zero check runs for it, and its log endpoint returns “log not found.” There is no retained failing test or error message to diagnose, so the cause remains unknown. The translation workflow and its test are absent from both this head and its merge base; the menu diff does not change them. A passing Greptile review does not establish that this failed workflow passed.

./test/cli passed all 117 checks on a disposable Omarchy worker at that exact head. This follow-up did not rerun the full suite or reproduce the menu interaction against current quattro; the PR also conflicts with that branch. No commits were pushed and no verification labels were added.

GPT-6 High in Codex reviewed the CI data and branch. Opus 5.5 High found no concrete defect in the menu diff and agreed that the available CI evidence does not justify a source repair; reviewer independence is not guaranteed. This is waiting on the maintainer because the failed run cannot be diagnosed from the available GitHub data, and the branch still needs reconciliation with current quattro.

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.

3 participants