Repository navigation
Conversation
Automated AI review
Verified: in the tested scope, Back (Left, or Backspace with an empty filter) now returns the cursor to the parent row used to open the submenu. The restore works for keyboard and mouse entry and at each level of a nested history. It also follows the row by id when other parent rows are hidden while the submenu is open. If the saved row became disabled, the cursor moves to the next selectable row. One edge case remains for submenus opened from search results.
Back after opening a deeper search result lands on an unrelated rowWith a filter active, the list includes matching submenus from deeper levels. When one of those is opened, Observed with the default menu and no installed-app search results (installed apps can add results and shift the exact row). The base branch puts the cursor on the first row in the same flow. Search results that are direct children of the current menu, such as Impact: cursor position only, with no wrong action. The search, open, Back flow ends on a row unrelated to the one chosen, which is less predictable than the previous first-row behavior. Suggested change: when the picked row is not a direct child of the menu being left, save its ancestor that is (so Back lands on Install), or skip the index fallback when a filter was active. These approaches were not tested. Optional test improvement: the reorder assertion in Review informationTest scope: Source review of head AI process: Opus 5.5 Medium coordination and synthesis, independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments, Opus 5.5 Medium editorial check. Opt out: To stop receiving these reviews, reply to this comment saying so. |
There was a problem hiding this comment.
Verdict: approve-with-comments — mechanics verified against source and by driving the real shell; three comments and three suggested tests below.
The attached 71-second narrated video shows the behavior difference live: the real omarchy shell running under Quickshell with the stock menu, keys sent through a virtual keyboard. Control (the PR's base d3cfd53): Down twice to Trigger (row 2), Return into its submenu, Back — the cursor lands on row 0 (Apps), the drilled-from row is lost. On this PR's head (7a7fb10): Back restores the cursor to Trigger, row 2 — the nav stack now records the row's index and item id, not just the menu.
pr-13012-restore-selection.mp4
Hazards I specifically checked (all clear):
- Out-of-range restore index cannot crash:
restoreSelection.indexmay exceed the rebuilt model, butrebuildDisplay()ends insettleCursor()→nextSelectable(from, 1)(Menu.qml:530), which modulo-normalizes and returns −1 for empty/disabled models. Traced both functions. - No other
navStackconsumers that could trip on the new record shape: the only readers are the push (734), the pop (762–764), and the two resets (859, 887). The dmenu paths resetnavStack = [], so the record shape never leaks into the select flow. - Pointer hygiene:
fromPointergating untouched;disarmPointer()still runs on keyboard-driven restores, so a stale mouse position can't steal selection. - Disabled/vanished rows degrade sanely: the
rowSelectable(i)guard skips a disabled remembered row; a vanished row falls back to the settled index — except after a search, where that index points into the filtered list (comment 3). - Ordering: the push captures the outgoing menu's cursor before
activeMenureassigns — correct in the diff.
Comments:
-
The new test's extraction regex is brittle — and I can prove it. Pulling
setActiveMenu/goBackout of Menu.qml with/ function setActiveMenu\([\s\S]*?\n \}\n\n function goBack\([\s\S]*?\n \}/assumes the two functions sit exactly one blank line apart in that order. When I applied this PR to my working copy (which has comments between those functions), the new test null-deref'd (TypeError, rc=1) on first run — the failure mode is a regexnullderef, not a clean assertion. Please match each function independently, or assertmatch()non-null with a descriptive message before slicing. -
Cursor-vs-provider drift (worth a code comment, not a blocker).
loadProviderForMenu(id)runs after the restore scan, and asynchronously arriving provider rows trigger a laterrebuildDisplay()whosesettleCursor()follows the index, not the id — a volatile provider reshaping rows above the remembered row can drift the cursor off it. Same shape as pre-existing behavior on any rebuild, but a comment at the restore scan would stop future readers assuming id-tracking survives async row arrival. -
Back after opening a deeper search result lands on an unrelated row (@llstrk's report, reproduced on this head). The restore itself works, including after a search whose result is a direct child of the current menu: inside Style, search
font, open Font, and Back lands on Font. It goes wrong only when the result sits deeper than the menu being left. Searchfont, Enter on Install › Style › Font, then Back: the cursor lands onLearn(root row 1);quattrogives row 0 (Apps). The saved index points into the filtered list, but Back shows the unfiltered one. Remember the selected row's ancestor that is a direct child of the menu being left, not the filtered index. The climb is capped at 32 likeisDescendantOf, so aparentcycle in a user extension can't hang it.menu-test.shstill passes, and Back lands onInstall:
var selectedRow = root.selectedIndex >= 0 && root.selectedIndex < displayModel.count ? displayModel.get(root.selectedIndex) : null
+ // A search result can sit deeper than this menu, and Back clears the
+ // filter: remember the row Back will show, not the filtered index.
+ // Bounded like the other parent walks, so a parent cycle can't hang.
+ var selectedId = selectedRow ? selectedRow.itemId : ""
+ for (var up = 0; up < 32 && selectedId && root.item(selectedId) && root.item(selectedId).parent !== root.activeMenu; up++)
+ selectedId = root.item(selectedId).parent
root.navStack = root.navStack.concat([{
menu: root.activeMenu,
- index: root.selectedIndex,
- itemId: selectedRow ? selectedRow.itemId : ""
+ index: root.filterText ? 0 : root.selectedIndex,
+ itemId: selectedId
}])A rarer form of the same stale index: if the parent menu is removed from the user file while you're below it, setActiveMenu falls back to root and applies the child menu's index there, so Back lands on an unrelated root row. Ignoring restoreSelection when the target menu no longer exists covers that (if (!root.item(id)) { id = "root"; restoreSelection = null }).
A test for the same harness (after the reorder assertion): fails on this head, passes with the change
It fails on this head (expected: install / actual: learn) and passes with the change:
// Back after opening a search result that sits deeper than the current menu.
const parents = { install: 'root', 'install.style': 'install', 'install.style.font': 'install.style' }
const shallowItem = navRoot.item
navRoot.item = id => parents[id] ? { parent: parents[id] } : shallowItem(id)
menuRows.root = [{ itemId: 'apps' }, { itemId: 'learn' }, { itemId: 'install' }]
menuRows['install.style.font'] = []
navRoot.filterText = 'font'
visibleRows = [{ itemId: 'style.font' }, { itemId: 'install.style.font' }]
navRoot.selectedIndex = 1
navRoot.setActiveMenu('install.style.font', true)
navRoot.goBack()
assertEqual(visibleRows[navRoot.selectedIndex].itemId, 'install', 'menu Back from a deeper search result lands on the row it belongs under')Real-function check against the default menu
Run from the repo root with node back-from-search.js:
const fs = require('fs'), path = require('path'), vm = require('vm')
const m = require(path.resolve('shell/plugins/menu/MenuModel.js'))
const qml = fs.readFileSync('shell/plugins/menu/Menu.qml', 'utf8')
const fn = n => qml.match(new RegExp('\\n function ' + n + '\\([^)]*\\) \\{[\\s\\S]*?\\n \\}\\n'))[0]
const g = m.mergeMenuSources(m.parseMenuJsonc(fs.readFileSync('default/omarchy/omarchy-menu.jsonc', 'utf8')), [])
const rows = []
const displayModel = { clear() { rows.length = 0 }, append(x) { rows.push(x) }, get count() { return rows.length }, get(i) { return rows[i] } }
const r = {
dmenuActive: false, rowsLoaded: true, activeMenu: 'root', filterText: '', searchDivider: false, navStack: [],
selectedIndex: 0, cursorActive: true, items: g.items, itemOrder: g.itemOrder, whenResults: {}, disabledResults: {}, checkedResults: {},
item(id) { return this.items[id] || null },
isDescendantOf(id, a) { return m.isDescendantOf(this.items, id, a) },
isVisible(e) { return m.isVisible(this.items, this.itemOrder, this.whenResults, e) },
isDisabled(e) { return m.isDisabled(this.disabledResults, e) },
matchesQuery(e, q) { return m.matchesQuery(e, q, this.isVisible(e) && !this.isDisabled(e)) },
parentPathFor(id) { return m.parentPathFor(this.items, id) },
searchScore(e, q) { return m.searchScore(this.items, e, q) },
displayRow(e, d, s, sec) { return m.displayRow(this.items, this.itemOrder, this.checkedResults, this.disabledResults, e, d, s, sec) },
revealCursor() {}, disarmPointer() {}, invalidateVolatileProvider() {}, loadProviderForMenu() {}
}
const names = ['setActiveMenu', 'goBack', 'rebuildDisplay', 'settleCursor', 'nextSelectable', 'rowSelectable']
const fns = vm.runInNewContext(`(function() { ${names.map(fn).join('\n')}; return { ${names.join(', ')} } })()`,
{ root: r, displayModel, layoutSerial: 0, Qt: { callLater() {} }, panel: { freezeCardTop() {} }, pointerGate: { allowInitialSample() {} } })
for (const n of names) r[n] = fns[n].bind(r)
r.filterText = 'font'
r.rebuildDisplay()
r.selectedIndex = rows.findIndex(x => x.itemId === 'install.style.font')
console.log('search "font", Enter on row', r.selectedIndex, '(install.style.font)')
r.setActiveMenu('install.style.font', true)
r.goBack()
console.log('after Back: cursor on row', r.selectedIndex, '=', rows[r.selectedIndex].itemId)| Tree | After Back |
|---|---|
quattro 8b4eae6 |
row 0 = apps |
this head 7a7fb10 (also merged onto 8b4eae6) |
row 1 = learn |
| this head + the change above | row 5 = install |
Test results: fails on this head, green with the fix, and safe on a parent cycle
| Run | Result |
|---|---|
| this head + the new test | exit 1 — expected: install / actual: learn |
| this head + the fix + the new test | exit 0, 124 ok |
| this head + the fix only | exit 0, 123 ok |
a parent cycle in a user extension, with the fix |
terminates (the climb is capped at 32) |
| the same cycle with an unbounded walk | hangs (times out) |
Suggested additional tests (the new ones cover the happy paths well — these pin the degrade paths, which are where this feature can quietly regress):
| Test | Why |
|---|---|
| Remembered row now disabled → cursor settles on nearest selectable row, never the disabled one | pins the rowSelectable guard |
| Remembered id absent → cursor lands at clamped old index, not 0, no crash — except after a search: there the old index is the cause of comment 3, so don't pin it for that case | pins the degrade path of the scan |
goBack with empty nav stack → falls back to parent menu with cursor at 0 |
fallback behavior under the new record shape |
Verified by driving the real shell on a live Omarchy/Quickshell session; the video above is the actual run.
Independent verification: the requirement map and change-impact analysis for this PR.
Updated 2026-10-02: added comment 3 (Back after a deeper search result) with a bounded fix and a failing test; line numbers for this head; new video.
…attro-proof Brings only the new artifacts from archive/2026-10-01/media-on-forkfixes (d79155c), re-based onto the clean upstream-code branch: - agents/skills/headless-gui-testing.md (new guide; upstream files untouched) - review/media/: five clips + MANIFEST.md - pocs/reproducers/<clip>/: drivers, fixtures, READMEs; run-at-rev.sh runs them against explicit SHAs from the git object store Every rev reference is now an explicit SHA (8b4eae6/e332dc97 upstream, f75205f PR omacom#13512 head, ff77cd0 consolidated fix, d3cfd53/7a7fb10c PR omacom#13012), with per-SHA output re-run on the audit box. Adds a full-line-comment control fixture (upstream 3 rows, f75205f 0, ff77cd0 3). Box paths parametrized via PROOF_ENV_DIR. Clean-product-diff allowlist gains the one added guide file. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Front page: omacom#9057 row says omacom#9056 fixes the re-summon trigger only (a menu process that dies mid-request still strands the caller); omacom#13492 row says label-only array elements stay hidden; omacom#13493 row says every entry in that file; omacom#13250 row covers actions; omacom#10340 reproduces but is a ranking-policy change (omacom#12223). - Clip notes: this branch carries upstream 821ae58 (was e332dc9); ff77cd0 is the first commit of omacom#13968 (head b2dae8d), with the reproducers re-run on 821ae58 and b2dae8d; no internal branch names; the omacom#13012 back-from-search note names the KI-MENU-BACK-FILTERED-INDEX test instead of a removed script.
Upstream PR product code (Menu.qml) and the PR's own menu-test.sh hunk, applied onto quattro-proof with a 3-way merge against the change base d3cfd53. One conflict, resolved as on the previous mirror: the baseline's // Implements: SW-REQ-260922-DE93 line sits directly above the PR's changed setActiveMenu signature; both are kept. The product diff against the PR merged onto quattro f45461a is behaviour-neutral annotations only, and the menu-test.sh hunk is identical to the PR's. Proof-Change-Key: pr/13012 Proof-Upstream-Repo: github.com/omacom/omarchy Proof-Mirror-Of: refs/pull/13012/head Proof-Upstream-Head: 7a7fb10 Proof-Head-Ref: fix/menu-back-selection Proof-Change-Base: d3cfd53 Proof-Base-Ref: quattro Proof-Baseline: 1e43373 Proof-Baseline-Ref: quattro-proof Proof-Previous-Mirror: c9d42a2 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…de the body PR omacom#13012's own vm-test (menu-test.sh) extracts setActiveMenu+goBack with a regex that requires goBack to follow setActiveMenu after exactly one blank line; the baseline's annotation comment between them made the regex return null and the whole menu-test.sh crash (TypeError, not an assertion). Trace links are file-level, so the annotation is relocated into goBack's body (binds to the enclosing function). PR product/test code untouched; the fragility is recorded as a review finding. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tro-proof 1e43373) Mirror of omacom#13012 at head 7a7fb10: the upstream change applied onto quattro-proof 1e43373, followed by the proof work for the review. This commit changes no file; it records the mirror at the branch tip, where the review pipeline reads it (Proof-* trailers). Proof-Change-Key: pr/13012 Proof-Upstream-Repo: github.com/omacom/omarchy Proof-Mirror-Of: refs/pull/13012/head Proof-Upstream-Head: 7a7fb10 Proof-Head-Ref: fix/menu-back-selection Proof-Change-Base: d3cfd53 Proof-Base-Ref: quattro Proof-Baseline: 1e43373 Proof-Baseline-Ref: quattro-proof Proof-Previous-Mirror: a60c47d
|
Thanks for this, @onurersel. Tracking the selected row by id is the right fix for the reorder case. Several other open pull requests fix the same Back behaviour, though, so I compared them all instead of verifying this one alone. Nothing was run on a worker, because verifying a fix that will not be merged in this form would not tell the maintainer anything new. The one I'm recommending is #12644. It is older than this one, and it also handles two cases this one misses:
The older pull requests #7074 and #11577 restore only an index, so they land on the wrong row when the parent's rows are hidden or reordered. #7954 and #12759 also bring back the search filter on Back, which is a behaviour change beyond the fix. #13225 matches by id exactly, the same way this pull request does. Codex Medium reviewed all seven separately and also chose #12644. It found nothing in this pull request that #12644 lacks and should take on. Note that its independence is not guaranteed, since it could read this session's reasoning. Its verdict came from reading the source: nothing was run. This now waits on the maintainer to choose among the competing fixes. If #12644 is merged, this one can be closed. |
|
I reviewed the open PRs that restore the menu selection when going back (no linked issue). This is code review only, because the menu tests need a running compositor.
I'd go with #13012. It saves the selected item's id with each history entry, restores it after the parent menu rebuilds, skips rows that can't be selected, and falls back to the old index. #13225, #7074, #7954 and #12759 duplicate it. #7074's index-only restore lands on the wrong row whenever the parent menu's rows change. Suggestion for #13012: menus filled by a provider load after the restore runs, so it only gets the index fallback there. A second lookup once the provider finishes would cover them. |
Summary
Screen capture
before
screenrecording-2026-09-23_08-48-09.mp4
after
screenrecording-2026-09-23_08-44-13.mp4
Testing
bash test/shell.d/menu-test.sh— passedgit diff --check— passedBefore marking ready