Skip to content

feat(workbench): view open agent hosts in a grouped dialog - #994

Merged
t8y2 merged 2 commits into
t8y2:mainfrom
DeanCen:perf/mcp-host-access-large-lists
Nov 23, 2026
Merged

t8y2 merged 2 commits into
t8y2:mainfrom
DeanCen:perf/mcp-host-access-large-lists

Conversation

@DeanCen

@DeanCen DeanCen commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #942.

With thousands of saved hosts, choosing Allow all in MCP agent host access
paused the UI and rendered every host name in one unbounded block with no
internal scrollbar. This replaces that inline block with an on-demand,
read-only dialog and fixes the quadratic save cleanup.

What changed

  • View button beside the mode choice. The host-access row now shows a
    View button to the left of None / Per host / Allow all, plus a live
    N hosts open count. The button is disabled when no host is open.
  • A grouped, read-only dialog. View opens a dialog that reuses the monitor
    panel creator's visual language: hosts bucketed by catalog group with a
    folder header (group shown / total), tinted host cards carrying each
    host's catalog icon and color. It only reads — permissions are still changed
    by the mode choice and each host's Advanced switch.
  • Search that never touches permissions. The query filters the view only;
    the count switches to matched / total. Escape clears the query first, then
    closes the dialog.
  • Virtualized for large catalogs. The dialog is a page-declared ui.Dialog
    whose body is a virtualized ui.List (group headers + multi-column card
    rows), so a catalog of thousands paints only the rows on screen. The page
    owns focus, hits, keyboard and scrolling; the wheel is routed through
    windowPage().Wheel, consistent with the dashboard dialog. The row model is
    cached and rebuilt only when the open hosts, query or column count change.
  • O(N) save cleanup. Cleaning stale agent permissions on save now builds
    the SSH id set once instead of scanning the catalog for each permission
    (previously O(N²)).

Design notes

  • Follows the current page-control architecture: the dialog is declared in the
    workbench page (declareAgentHostsDialog) rather than painted as a canvas
    overlay, so it shares the page's focus trap, scroll routing and keyboard
    handling with the other dialogs.
  • Adaptive 1–3 columns from the dialog width; long names ellipsize.
  • The bulk mode semantics and the transactional rollback on a refused save are
    unchanged.

Test plan

  • go build ./...
  • go test ./internal/i18n
  • go test ./internal/workbench -run 'Agent|MCP'
  • New 1000-host headless regression
    (TestMCPAgentHostsLargeListUsesVirtualizedScrolling): open via View,
    viewport culling, wheel to the last host, drag the scrollbar, search
    filters without changing stored permissions, Escape clears then closes,
    narrow layout keeps the mode choice intact
  • Adjacent groups: Modal|Settings|Dashboard|Persist|ConnectionCatalog|HostShared|HostMerge|Select|Menu
  • go vet ./internal/workbench ./internal/i18n
  • Manual: 1000-host Dev profile, Allow all → View

Note: the platform-pinned paint goldens are generated on the CI platform; this
change does not alter their fixtures.

@DeanCen
DeanCen force-pushed the perf/mcp-host-access-large-lists branch 2 times, most recently from e1f1cf5 to 18a9a48 Compare November 19, 2026 15:40
DeanCen and others added 2 commits November 23, 2026 21:52
With thousands of saved hosts, choosing Allow all in MCP agent host
access paused the UI and listed every name in one unbounded block.
Replace the inline list with a View button beside the mode choice that
opens a read-only dialog borrowing the monitor panel creator's grouped
cards, host icons and color marks. Search filters the view without
touching permissions, an internal draggable scrollbar and viewport
culling paint only the visible hosts, and Escape clears the query then
closes. Cleaning stale permissions on save now builds an SSH id set
once instead of scanning the catalog for each permission.
The cards were sized from the dialog's nominal width less the surface padding, which
is wider than the body the dialog gives its content, so the last column ran under
the right edge. Size them from the body rect, less the list's scrollbar lane.
@t8y2
t8y2 force-pushed the perf/mcp-host-access-large-lists branch from 18a9a48 to 37bd6b7 Compare November 23, 2026 13:59
@t8y2
t8y2 merged commit a977d90 into t8y2:main Nov 23, 2026
18 of 19 checks passed
@t8y2

t8y2 commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution! Merged in a977d90, will be released in the next version. I rebased it onto the latest main (one adjacent enum conflict in connection.go) and added a small commit that sizes the host cards from the dialog body, so the last column no longer runs under the dialog's right edge.

@DeanCen
DeanCen deleted the perf/mcp-host-access-large-lists branch November 23, 2026 14:04
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.

[feature] MCP的代理开放主机优化

2 participants