Repository navigation
refactor(macos): status menu polish — owned width, quiet header, structured diagnostics, native highlight - #130388
Conversation
fittedTitle's hasImage/hasSubmenu/keyEquivalent parameters never changed the computation - the budget always included image, submenu, and shortcut chrome - because AppKit aligns those columns across the whole menu, so a per-item budget is the wrong model. Collapse to one menu-wide budget and drop the misleading knobs from all 13 call sites.
A working system now says nothing: the header renders only operator- actionable trouble lines (colored text, no status bubbles), the healthy state is title + toggle + capability strip, and the churn sources that made the open menu jump are gone - relative check ages, 'health check running', and the per-tool activity label (the critter icon already animates work). Session-row kind icons go monochrome; green conveyed nothing actionable. Healthy title is 'OpenClaw' (or the primary gateway name with multiple gateways) since the toggle already communicates active. DashboardGatewayMenuModel.connectionLabel lost its last caller and is deleted with its test.
AppKit paints no selection behind NSMenuItem.view, so hosted session and device rows had no hover or keyboard highlight. HostedMenuRowView now draws the native selection material (rounded, emphasized) and flips the SwiftUI content through the existing menuItemHighlighted environment, driven by NSMenuDelegate.menu(_:willHighlight:) so pointer and arrow-key navigation both light up. Submenus get a shared highlight-only delegate; the controller's root-menu guards keep open/refresh paths unaffected.
Canvas panels are agent-opened; a manual open action was noise. The Allow Canvas capability tile stays - that is the permission. Removes the menu action, the dock-menu item, and the now-orphaned AppNavigationActions.toggleCanvas.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 26, 2026, 5:31 PM ET / 21:31 UTC. ClawSweeper reviewWhat this changesThe PR gives the macOS status menu a fixed width, quieter healthy-state header, structured worker diagnostics, native highlighting for hosted rows, and removes manual Canvas open/close actions. Merge readinessKeep open: current main lacks this status-menu work, but the PR truncates worker stderr before the header tooltip receives it, so long diagnostics cannot be fully inspected on hover. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe macOS status item combines gateway, worker, session, and capability state into an AppKit menu with embedded SwiftUI rows. It is the operator-facing surface for opening actions and reading local node health. flowchart LR
State[Gateway and worker state] --> Descriptor[Status menu descriptor]
Descriptor --> Renderer[AppKit menu renderer]
Renderer --> Hosted[Hosted SwiftUI rows]
Renderer --> Native[Native menu rows]
Hosted --> Operator[macOS operator]
Native --> Operator
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceOther +298. Total +298 across 28 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep a full bounded worker-stderr value for the tooltip while rendering a separate four-line excerpt in the menu, preserving the compact healthy-state layout. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: provide worker stderr longer than 360 characters or four lines; Is this the best way to solve the issue? No; the current shape conflates compact display text with hover text, so it cannot satisfy the stated full-diagnostic-on-hover behavior. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e0a4915bcf16. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
AppKit sends no willHighlight(nil) on submenu close, so a hosted device row selected there reopened still lit. The shared highlight delegate now resets its menu's hosted rows in menuDidClose; regression covers the close cycle.
|
Addressed the P2 in d41d009: |
|
Merged via squash.
|
…ctured diagnostics, native highlight (openclaw#130388) * fix(macos): stabilize status menu width across hosted and native rows * fix(macos): format node worker termination status without optionals * refactor(macos): give status menu width one owner fittedTitle's hasImage/hasSubmenu/keyEquivalent parameters never changed the computation - the budget always included image, submenu, and shortcut chrome - because AppKit aligns those columns across the whole menu, so a per-item budget is the wrong model. Collapse to one menu-wide budget and drop the misleading knobs from all 13 call sites. * refactor(macos): keep the status menu header quiet when healthy A working system now says nothing: the header renders only operator- actionable trouble lines (colored text, no status bubbles), the healthy state is title + toggle + capability strip, and the churn sources that made the open menu jump are gone - relative check ages, 'health check running', and the per-tool activity label (the critter icon already animates work). Session-row kind icons go monochrome; green conveyed nothing actionable. Healthy title is 'OpenClaw' (or the primary gateway name with multiple gateways) since the toggle already communicates active. DashboardGatewayMenuModel.connectionLabel lost its last caller and is deleted with its test. * fix(macos): preserve structured node worker diagnostics in status menu * feat(macos): highlight hosted menu rows from AppKit's selection signal AppKit paints no selection behind NSMenuItem.view, so hosted session and device rows had no hover or keyboard highlight. HostedMenuRowView now draws the native selection material (rounded, emphasized) and flips the SwiftUI content through the existing menuItemHighlighted environment, driven by NSMenuDelegate.menu(_:willHighlight:) so pointer and arrow-key navigation both light up. Submenus get a shared highlight-only delegate; the controller's root-menu guards keep open/refresh paths unaffected. * refactor(macos): drop the manual Open Canvas action Canvas panels are agent-opened; a manual open action was noise. The Allow Canvas capability tile stays - that is the permission. Removes the menu action, the dock-menu item, and the now-orphaned AppNavigationActions.toggleCanvas. * fix(macos): clear hosted submenu selection when the submenu closes AppKit sends no willHighlight(nil) on submenu close, so a hosted device row selected there reopened still lit. The shared highlight delegate now resets its menu's hosted rows in menuDidClose; regression covers the close cycle. * style(macos): apply swiftformat to highlight delegate
What Problem This Solves
Follow-up polish on the #130041 status-menu redesign, driven by live operator use. Four problems: (1) menu width was emergent, not owned — a greedy header card (
fittingSize600pt vs 330pt siblings) stretched the open menu to ~434pt (worst case 619pt), stranding session rings and chevrons mid-menu, and long native titles could stretch it further; (2) the header narrated a healthy system (green status dots, endpoint, "Health ok · checked just now", per-tool activity), with relative ages and transient states re-rendering while the menu was open — visually jumpy; (3) the "Mac node degraded" line crushed the worker's dying stderr into a truncated single line ending in garbage (…exited(1): [ope…), andString(describing:)over an Optional leakedOptional(exit 1)into operator text; (4) hosted rows (sessions, devices) had no selection highlight at all — AppKit paints none behindNSMenuItem.view— and no keyboard-navigation feedback.Why This Change Was Made
One width owner (
StatusMenuMetrics): the renderer applieswidthexactly once by framing every hosted root view,menu.minimumWidthpins the floor, cards stopped declaring their own width (four views dropped theirwidth:parameter), and native + hosted titles are fitted to a measured menu-wide chrome budget (AppKit aligns image/submenu/shortcut columns menu-wide, so per-item budgets are the wrong model — a parameterized budget that never varied was collapsed to one constant). No runtime width probing anywhere. Quiet when healthy: the header renders only operator-actionable problem lines as colored text (no bubbles); healthy is title + toggle + capability strip; churn sources (check ages, "health check running", activity label) removed along with their now-dead store observations; healthy title is "OpenClaw" (or the primary gateway name with ≥2 gateways) since the toggle already communicates active; session kind icons went monochrome;DashboardGatewayMenuModel.connectionLabellost its last caller and is deleted. Structured diagnostics:WorkerError, the coordinator's failure recording, andMacNodeChannelStatecarry reason and stderr excerpt as separate fields; the menu shows the headline plus up to four complete monospaced stderr lines (bounded, never cut mid-line) with full text on hover; theOptional(...)leak is fixed at the producer. Native highlight:HostedMenuRowViewdraws the real selection material (rounded, emphasized) and flips content colors through the existingmenuItemHighlightedenvironment, driven byNSMenuDelegate.menu(_:willHighlight:)so pointer and arrow keys both work; submenus get a shared highlight-only delegate. Removed: the manual "Open Canvas" action (menu + dock menu + orphanedtoggleCanvas) — canvas panels are agent-opened; the Allow Canvas permission tile stays.User Impact
The menu holds a stable 330pt regardless of content, stays silent while the system is healthy, shows readable multi-line worker diagnostics when degraded, highlights rows like native menus under mouse and keyboard, and drops a noise action.
Evidence
StatusMenuWidthTestsassertmenu.size.width == StatusMenuMetrics.widthand per-card frame agreement across long sessions, degraded multi-line headers, and multi-gateway sections;fittedTitletruncation unit-tested.willHighlightacross sibling rows (highlight follows, siblings clear, nil clears all).[ope…now renders as[openclaw] Could not start the CLI…under the headline.apps/macossuite: 1,832 tests / 186 suites. Three failures on this machine are pre-existing on cleanorigin/main(verified by runningMacNodeCodexThreadCatalogTestson detacheda021f79badc: fails there with the same timing-sensitive signatures, different tests per run;MacNodeHostWorkerTests— the only failing suite touching this diff — passes in isolation). All menu-owned suites (width/descriptor/reconcile/approvals/ring/coordinator, 109 tests) green.OPENCLAW_PROFILEinstance (unconfigured state; visible deltas there are the status-dot removal and the Open Canvas removal). The width/quiet/diagnostic improvements were verified live on the operator's configured menu, whose captures contain private session names and are not attached; measured numbers and tests above carry that proof.git diff --numstat: prod +612/−551; tests +322/−84, net +238). Growth is the two new capabilities — structured diagnostics (+59) and native highlight (+88) — while the width refactor, quiet header (−96), and canvas removal are net-negative.