Repository navigation
Fix keybindings menu hang when user configs iterate hl accessors - #10212
evariste1963 wants to merge 2 commits into
Conversation
Chessing234
left a comment
There was a problem hiding this comment.
returning nil for numeric keys on the noop metatable is exactly what stops ipairs from spinning. good catch, and the timeout test pins it.
It shared XDG_CACHE_HOME and the stubbed hyprctl with the block before it, and the records cache is keyed on that stub alone, so the run answered from the cache and never scanned a config at all. The config it installed was also loaded through Omarchy's defaults, which abort the scan at default/hypr/qconsole.lua:64 — comparing the noop against a number — well before any user file. Either of those alone made it pass with the noop reverted, on a worker. Scan a standalone config from a cache of its own, and assert that the bind declared after the loop still renders with the key only the scan can supply, so a scan that stops early fails the same way a hang does. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Reviewed against The fix is right, and the mechanism is exactly the one you named. Two smaller corrections to the write-up. The regression test did not test the regression, and I have pushed a commit that makes it fail without the fix. Verified by mutation on the worker: with your
The commit scans a standalone Two things left open, deliberately not pushed. Returning nil for numeric keys is right for a stub that should read as an empty sequence, but it converts one failure mode into another for a different shape of config.
What this collides with, which is the part worth reading. #10214 is the fifth open report of this bug — #7025, #8819, #9052 and #9395 all describe the same One mechanical thing: the body has no Waiting on the maintainer, both for that choice and for whether Codex reviewed the same head independently at xhigh and reached the vacuous-test and early-abort findings too; its independence is not currently guaranteed, so read that as agreement rather than confirmation. Two things were its own: the Lua 5.2-to-5.3 boundary above, and that the guard calls |
|
Independent reproduction on Omarchy 4.0.0.alpha (the linked issues cite 4.0.2-1), Hyprland 0.56.2, kernel 7.2.3-arch1-2. Triggered by for _, p in ipairs(hl.get_loaded_plugins()) doTwo behavioural details that don't appear in the write-up and may matter for how the fix gets prioritised: The spinner outlives its parent. Killing It accumulates once per invocation. Every open leaves another spinner behind. I ended up with four concurrent (~400% CPU, load average 3.2) from three menu opens plus the one orphan above. So on an affected config the user-visible cost isn't just a menu that won't open — it's a permanently lost core per attempt, with no obvious attribution back to the cause. |
|
Automated duplication check: this pull request looks similar to #8876, which covers the same keybindings scanner ipairs termination fix. I keep that one open and close this one to consolidate review. If you feel this is the wrong decision, please open the PR again with a note on the difference. |
Problem
omarchy-menu-keybindingsparses the user's~/.config/hypr/hyprland.luaunder a stubbedhlso it can resolve Lua bindings that Hyprland reports as__lua. Unknownhl.*accessors fall back to anoopobject whose__indexreturns itself for every key — including numeric indices.Any real user config that calls a list accessor and walks the result spins forever:
This is what the border-fx plugin's generated
border-fx.luadoes. Result:luapegs a CPU core,omarchy menu keybindingsnever opens, and--printnever returns.Fix
In the embedded
noopmetatable, returnnilfor numeric keys while still mirroring non-numeric access for method chaining. Stubbed accessors then read as empty sequences, soipairs()and#terminate immediately instead of recursing on a metatable that never yieldsnil.Test
Added a regression test to
test/shell.d/keybindings-menu-test.shthat installs a config callingipairs(hl.get_loaded_plugins())and asserts the scan completes (wrapped intimeoutso a regression fails instead of hanging the suite).Verified:
test/shell.d/keybindings-menu-test.shpasses./test/clipasses