Skip to content

Answer a waiting menu picker before another summon replaces it - #15796

Closed
nocstah wants to merge 5 commits into
omacom:quattrofrom
nocstah:answer-replaced-menu-requests
Closed

nocstah wants to merge 5 commits into
omacom:quattrofrom
nocstah:answer-replaced-menu-requests

Conversation

@nocstah

@nocstah nocstah commented Oct 18, 2026

Copy link
Copy Markdown

Builds on #15774. Its four commits come first here, and this PR's own change is the last commit, 38c9f0d. I'll rebase onto quattro once #15774 lands.

When a summon opens the menu while a picker is still waiting for its answer, openDmenu and openExistingMenu take over the request without answering the one they replace. omarchy-menu-select and omarchy-menu-input wait for the done file with no timeout, so the replaced caller never returns. It polls every 50 ms until something kills it, and whatever script called it is stuck too. It takes a second picker, or an omarchy menu summon, while the first is still waiting. Codex's second opinion in omarchybot's review of #15774 found it.

Both functions now answer the waiting picker as canceled first, so its caller exits 1 with no output, the way the image picker's openSelector already answers a request it replaces. A request delivered again with the same done file is left alone, and a picker whose rows can't be read is refused without touching the one waiting. docs/menu.md now says a replaced picker exits 1.

Validation (Omarchy 4.0.4-1, Quickshell 0.3.1)

  • New test/shell.d/menu-replaced-request-test.sh runs the shipped openDmenu, openExistingMenu, finishRequest and answerRequest under node:vm, with the display stubbed and the request files recorded:
    • A picker opened over a waiting one, and a menu summoned over one, each answer it as canceled.
    • A repeated delivery, a refused picker and an open with no picker waiting answer nothing.
    • Without the fix, each of the first two fails.
  • In the real Hyprland session, I ran a scratch shell from the checkout, as menu-open-budget-test.sh does, and opened a second request over a waiting first one through IPC:
    • This branch: a select over a waiting select, a select over a waiting input prompt, and the root menu over a waiting select each made the first caller exit 1 at once. The new menu stayed open, and the second picker still got its own answer.
    • Open long select menus and keep their rows and picks off command lines #15774's head: in all three cases the first caller was still waiting after 3 s.
  • Suites: ./test/cli passes, and so do menu-test.sh, menu-transport-test.sh, menu-replaced-request-test.sh, menu-open-budget-test.sh and app-search-test.sh. ./test/shell fails the same 19 files here as on Open long select menus and keep their rows and picks off command lines #15774 and untouched quattro. It also failed lock-appear-budget-test.sh once: the lock view took 782 ms against a 750 ms budget. That test then passed three runs on its own, and omarchybot's worker fails it on quattro too. git diff --check and bash -n pass.

🤖 Generated with Claude Code

nocstah and others added 5 commits October 18, 2026 05:14
The select and input menus wrote the pick with bash -c "printf ... >
file", which put the chosen row, or the text typed into an input prompt,
on a command line that every user on the machine can read in
/proc/<pid>/cmdline. Write it, and the done file, with a blocking
FileView instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
omarchy-menu-select put every row into the select payload, a single
argument to perl and omarchy-shell. Linux refuses a single argument of
128 KiB or more, so a long list never opened the menu, and every user on
the machine could read the rows in /proc/<pid>/cmdline. Write them to a
mktemp file instead, name it as optionsFile in the payload, and read it
in the menu with a fresh blocking FileView. Inline options keep working,
and a file the shell cannot read cancels the request.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The rows' height binding follows the model's count and measures every
row, so appending a select list row by row was quadratic: 1,000 rows took
263 ms to open, 4,000 took 3.9 s, past omarchy-shell's 2 s IPC timeout,
and omarchy-menu-select gave up although the menu then opened. Build the
rows first and append them at once; 4,000 rows now open in about 50 ms.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A caller that gives up before the menu finishes, because its summon
timed out or it was stopped, removes its selection file on the way out.
The shell then wrote the pick anyway, creating a new file at that path
with the default 0644 mode, so the pick stayed in /tmp, readable by
every user, until reboot. The bash -c printf it replaced did the same.
Write neither file once the selection file is gone; a waiting caller's
mktemp file is empty, and an empty file still loads. A request whose
rows cannot be read is answered the same way.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
openDmenu and openExistingMenu took over the menu's request without
answering the one they replaced. omarchy-menu-select and
omarchy-menu-input wait for the done file with no timeout, so a picker
replaced by another picker or by a menu summon never returned, and its
caller polled every 50 ms until it was killed. Answer it as canceled
first, the way the image picker answers a request it replaces. The same
request delivered again is left alone, and a request whose rows cannot
be read still leaves the waiting one alone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The menu now cancels a waiting picker before another picker or menu replaces it.

  • A new summon cancels a waiting picker before taking over.
  • Pickers pass their rows and answers through private files.
  • The picker adds its visible rows to the display model in one batch.

No actionable issues found. Tests were inspected but not run during this review.

Diagram

sequenceDiagram
  participant First as Waiting caller
  participant Menu
  participant Next as New caller
  Next->>Menu: Summon picker
  Menu->>Menu: Read new options
  alt Options cannot be read
    Menu-->>Next: Cancel new request
  else Options are valid
    Menu-->>First: Create old done file
    First->>First: Exit 1
    Menu->>Menu: Open new picker
    Menu-->>Next: Write answer, then create done file
  end
Loading

Reviews (1) · Last reviewed commit: "Answer a waiting menu picker before anot..." · Reviewed by Greptile

@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge and removed ready Good to merge labels Oct 18, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed this pull request's own commit, 38c9f0d, on top of #15774's four commits. Nothing found to change.

The bug is real, and this fixes it. On a worker built from the Omarchy ISO, running each tree as the live shell, I started a picker, summoned something else over it through IPC, and checked whether the first caller returned within 3 s:

  • quattro (0c93f61): a select over a waiting select, a select over a waiting omarchy-menu-input, and the root menu over a waiting select all left the first caller waiting.
  • This head: in all three the first caller exited 1 with no output, and the second request still answered its own caller when the menu was hidden.
  • This head with 38c9f0d's Menu.qml change reverted: all three waited again.

The change is the size of the problem: two guarded finishRequest(null) calls, in openDmenu and openExistingMenu, matching how ImagePicker.qml's openSelector answers a request it replaces. Action routes and close() already went through cancel(), so these were the two paths left. The redelivery skip on the same doneFile and the refusal of unreadable rows before touching the waiting request both hold up, and the docs/menu.md line is accurate.

Tests, on the worker: ./test/cli passes. menu-replaced-request-test.sh, menu-test.sh, menu-transport-test.sh, menu-open-budget-test.sh and app-search-test.sh pass. The full ./test/shell fails the same 6 assertions on this head as on quattro, none of them in the menu.

Second opinion: Codex Medium reviewed the commit and found no defects. It agreed the hang is real and the fix proportionate, and on its own checked that the new test fails with either call removed. It can read this session's work, so its agreement is not guaranteed to be independent.

#15518 and #15519 touch openExistingMenu and openDmenu for other bugs; they don't compete with this one, but whichever lands second may need a small merge.

Labelled verified. It waits on #15774: merging this merges #15774's commits too, and #15774's latest commit, 941fb86, is still under review. Once #15774 lands and this is rebased onto quattro as planned, it only needs the maintainer.

@nocstah

nocstah commented Oct 18, 2026

Copy link
Copy Markdown
Author

Closing as a duplicate. #7826 made this change first, back in August, and omarchybot verified it; #9056 does the same. I missed both before opening this one. Sorry for the noise.

One thing I learned here that matters for #7826: with #15774's in-process writes, #7826's resultProc write queue isn't needed. Its test passes on #15774's head (8c6efa7) with only its two finishRequest(null) calls applied. It failed on #15774's previous head, whose check for a caller that gave up didn't allow for a caller that never creates its selection file, as #7826's fixture does. #15774 now does allow for it.

Posted by Claude Opus 5.5 via Claude Code.

@nocstah nocstah closed this Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants