Repository navigation
Conversation
Herdr plugins declare actions with contexts (pane, tab, workspace, selection). The pane menu (and an agent row's menu, which is the pane menu), the tab menu, and the workspace popover now list the actions of their context below their own rows, grouped under each plugin's name, and run one on the pane, tab, or workspace the menu was opened on. A pane with highlighted text also lists the actions that take a selection. Herdr does not admit plugin.action.list or plugin.action.invoke on a GUI client's connection, and the `herdr plugin action` CLI cannot carry an invocation context. So each request runs Herdr's own `herdr remote-api-bridge` on the endpoint's host, locally or over SSH, through the host scripts pane moves already use, with the request on stdin. Herdr fills every context field a caller omits from its focused pane, and a right-clicked pane is often not focused. So an action's context is built from Herdr's session.snapshot taken just before it runs: the target's ids, labels, worktree, cwd, agent, and status, and for a tab or workspace the pane focused in it, as Herdr derives them itself. Opening a menu shows the host's last list at once and reads it again on a background worker; a failed read never affects the menu's own rows. The list leaves out disabled plugins, actions for another platform, and actions without contexts. Long titles end with an ellipsis; a tooltip holds the whole title and the action's description. The pane and tab menu rows are now the panel's own children, so a row the keyboard selects below the window's edge scrolls into view. Herdr 2 (herdr-core) has no plugins, so its menus and kept workspaces show none. A window built without the host bridge, as headless tests build theirs, reaches no host. Refs sheprd-labs#534
Regression tests for the plugin action rows, written from the feature's failure list by an author who did not write the feature. A stand-in host (`plugin_actions::tests::fake`) replaces the bridge's `fetch` and `invoke`, so the menus run against canned catalogs and record each action they run. A stand-in `herdr` and `uname` in a private home drive the real host scripts for the list and invoke paths. - Catalog: contexts per menu, unknown contexts and platforms, disabled and removed plugins, platform filter by `uname`, grouping and headings, one-line titles, blank descriptions. - Context: pane, tab, and workspace targets take every field from the target, never Herdr's focused pane; absent values are left out; a gone or inconsistent target is refused. - Bridge: list order and failures, the output bound, data only on stdin, `--session` binding, no invoke for a gone target. - Menus: rows run on the right-clicked pane, tab, or workspace; cached rows show at once and survive failed reads; one read at a time; keys and hover across built-in and plugin rows; late answers; stale targets; failure flashes; selection only for the highlighted pane, fenced at run time; scrolling past headings; long titles. - Errors: every variant localizes, also through the app's root error. The only non-test change is the `#[cfg(test)]` module declaration in `plugin_actions.rs`.
serde already reads a JSON null into None for the worktree and agent status, and Catalog::rows never lists an action without contexts.
👷 Deploy request for sheprd-labs pending review.Visit the deploys page to approve it
|
[Medium impact] The latest test-only changes appear safe to merge; the two earlier menu issues remain non-blocking. FindingsSummaryAdds plugin actions below the built-in pane, tab, and workspace menu rows.
No new issues were found in the changes since the previous review. Reviews (2) · Last reviewed commit: "test: build the plugin menus' stand-in h..." · Reviewed by Greptile |
| let id = endpoint.id.clone(); | ||
| let entry = self | ||
| .plugin_actions | ||
| .by_endpoint | ||
| .entry(id.clone()) | ||
| .or_default(); | ||
| if entry.fetching { |
There was a problem hiding this comment.
Menus retain another session’s actions. The cache uses only the endpoint ID, but choosing another local or device session keeps that ID. A menu can therefore show the previous session’s actions. An old request that finishes after the switch can also replace the new session’s list and prevent its opening from starting a fresh read. Actions missing from the current session then fail when clicked.
Key both cached lists and pending reads by the host’s identity, including its session, and ignore answers from an earlier target.
There was a problem hiding this comment.
Fixed in 1e17be5: the cache is now keyed by the host identity (route, session, installation), so each session keeps its own actions. A late answer for the session left no longer touches the open menu, and a read in flight for one session no longer blocks another. Tests in plugin_actions/tests/sessions.rs.
| self.render_plugin_rows( | ||
| &target.plugins, | ||
| selected, |
There was a problem hiding this comment.
Keyboard selection leaves view. Workspace plugin rows can make the popover taller than the window. Arrow keys update
workspace_selected, but never scroll the selected row into view. Users can move onto an unseen action and press Enter without seeing what will run. The new pane and tab rows already scroll their selection into view; add the same behavior for workspace rows and cover a long list in a short window.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Fixed in 057446e: the popover now draws its sections as the menu panel's own children with a tracked scroll handle, so arrow keys scroll the selected action, plugin row, or pull request card into view. menu/workspace_tests/plugins_scroll.rs covers a long list in a 320px window, both directions, across plugin headings.
Windows lints failed on the unused stand-in host: every menu test that uses it needs host scripts, so it is gated the same way. The catalog helper the pure tests share moves out of it.
|
@greptileai review |
…n-menus # Conflicts: # crates/sheprd-gpui/src/menu/workspace.rs # crates/sheprd-gpui/src/menu/workspace/popover.rs # crates/sheprd-gpui/src/pane_menu.rs # crates/sheprd-gpui/src/tab_menu/tests.rs
An endpoint keeps its id when the user picks another session behind it, so a cache of plugin actions keyed by endpoint id showed one session's actions in another session's menus, let a late answer for the session left replace the new one's, and let a read in flight for one session stop the other's. Key the cache by the host's identity (route, session, installation) instead, and update an open menu only when the answer is for the session it is on. Tests: a menu lists its session's actions and keeps each session's cache; a late answer for the session left does not change the open menu; a read in flight for another session does not stop this one's; a row runs on the host of the menu's session. The pane menu's key-walk test clears agents, as the Favorite row that main added to agent panes evened out the row counts it compares.
With plugin actions the workspace popover can be taller than the window, and arrow keys could select an action below its edge. The popover now draws its sections as the menu panel's own children, with a tracked scroll handle, so the selected action, plugin row, or pull request card scrolls into view, as in the pane and tab menus. The pages that draw into the panel itself (group, move pane, move tab, pane, tab) go through one lookup in menu/chrome/panel_pages.rs, which keeps menu/chrome.rs within the 1,000-line limit after the merge of main. Tests: in a short window, arrow keys keep every selected action inside the panel, both ways, with and without the pull request card, across plugin headings; the popover keeps its order of header, tiles, rows, delete, plugin rows, and pull request.
Closes #534.
What it does
Herdr plugins declare where their actions apply (
contexts = ["pane"],["tab"],["workspace"],["selection"]). Sheprd now lists those actions in its right-click menus, under one heading per plugin, below the built-in rows:paneactions. When the pane has highlighted text,selectionactions too.tabactions.workspaceactions.An action runs on the pane, tab or workspace the menu was opened on, not on the focused pane. Arrow keys and Enter walk across built-in and plugin rows. A long title ends with an ellipsis, and a tooltip shows the full title and the action's description.
How it reaches Herdr
plugin.action.listorplugin.action.invokeon a client-shell connection (src/api/schema.rs:142-143).herdr plugin action invokeCLI fixes the context tocli, so it cannot target a pane.herdr remote-api-bridgeon the endpoint's host, through the host scripts that pane moves already use. This works locally and over SSH.When a caller leaves a context field out, Herdr fills it from its focused pane. So the context is built from
session.snapshotjust before the action runs: the target's ids, labels, worktree, cwd, agent and status. I asked Herdr to accept the two methods from clients, and to derive the context from the pane id the caller passes: herdrdev/herdr#5552 (comment). If Herdr makes both changes, the bridge can go.Limits
--socketand--devwindows, and Windows clients, show no plugin rows, because no host script reaches them.QA checklist
cargo test --locked -p sheprd-gpui --lib -- plugin pane_menu tab_menu: 127 passed. This includes 35 new tests, written from a failure list by a separate author. They use a stand-inherdrbehind the real host scripts.b989ee6d.cargo fmt --all -- --check,cargo clippy --locked -p sheprd-gpui --all-targets -- -D warnings,scripts/check-file-size.sh,scripts/check-sorted.py,scripts/check-i18n.py: pass on macOS.722c0edf, including Windows. The first push failed the Windows lints because a test-only stand-in was unused there, and722c0edffixes that.taborworkspaceactions, and run one.selectionaction.Screenshots
Not attached yet: the native check above was done by hand, and no capture was taken. I will add before and after images of the pane menu.