Skip to content

refactor(macos): status menu polish — owned width, quiet header, structured diagnostics, native highlight - #130388

Merged
steipete merged 9 commits into
mainfrom
steipete/menu-polish-width-quiet-highlight
Aug 26, 2026
Merged

steipete merged 9 commits into
mainfrom
steipete/menu-polish-width-quiet-highlight

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

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 (fittingSize 600pt 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…), and String(describing:) over an Optional leaked Optional(exit 1) into operator text; (4) hosted rows (sessions, devices) had no selection highlight at all — AppKit paints none behind NSMenuItem.view — and no keyboard-navigation feedback.

Why This Change Was Made

One width owner (StatusMenuMetrics): the renderer applies width exactly once by framing every hosted root view, menu.minimumWidth pins the floor, cards stopped declaring their own width (four views dropped their width: 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.connectionLabel lost its last caller and is deleted. Structured diagnostics: WorkerError, the coordinator's failure recording, and MacNodeChannelState carry 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; the Optional(...) leak is fixed at the producer. Native highlight: HostedMenuRowView draws the real selection material (rounded, emphasized) and flips content colors through the existing menuItemHighlighted environment, driven by NSMenuDelegate.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 + orphaned toggleCanvas) — 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

  • Width: worst-case measured 619pt → 330pt; the reported live menu's rows measured 361pt → 330pt. New StatusMenuWidthTests assert menu.size.width == StatusMenuMetrics.width and per-card frame agreement across long sessions, degraded multi-line headers, and multi-gateway sections; fittedTitle truncation unit-tested.
  • Highlight: renderer-level regression walks willHighlight across sibling rows (highlight follows, siblings clear, nil clears all).
  • Diagnostics: bounding tests (≤4 lines, no mid-line cut, ellipsis) plus structured reason/diagnostic shaping tests; live-verified on the operator's real degraded state — the previously unreadable [ope… now renders as [openclaw] Could not start the CLI… under the headline.
  • Full apps/macos suite: 1,832 tests / 186 suites. Three failures on this machine are pre-existing on clean origin/main (verified by running MacNodeCodexThreadCatalogTests on detached a021f79badc: 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.
  • Before/after screenshots attached, captured from a Developer-ID-signed build in an isolated OPENCLAW_PROFILE instance (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.
  • Production LOC net +61 across the seven commits (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.

before-menu

after-menu

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.
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added app: macos App: macos size: XL maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 20:34
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 26, 2026, 5:31 PM ET / 21:31 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 3 items remain

Keep 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
Reviewed head: 812c17e3b99f8fb419a91d8d7a05cbd35ff598eb

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has focused evidence and resolves the prior highlight finding, but the remaining diagnostic-tooltip defect blocks merge readiness.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless supplies after-fix screenshots and a live operator report.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless supplies after-fix screenshots and a live operator report.
Evidence reviewed 6 items Tooltip receives only the display excerpt: The diagnostic is transformed through excerpt before it reaches the status-line model; that helper caps it at 360 characters or four lines.
Header tooltip uses the already-truncated field: The header renders and passes the same diagnostic value to .help, so the omitted stderr tail is unavailable on hover.
New regression coverage asserts truncation only: The diagnostic test deliberately asserts a maximum 360-character value, but has no owner-boundary assertion that the tooltip retains the full bounded stderr.
Findings 1 actionable finding [P2] Preserve the full diagnostic for the tooltip
Security None None.

Live Verification

Command: swift test --package-path apps/macos --filter StatusMenuWidthTests

Result: FAIL (failed) — step 1 run swift test --package-path apps/macos --filter StatusMenuWidthTests: previous terminal command was still running after 30 seconds: "swift test --package-path apps/macos --filter StatusMenuWidthTests"

Fetching https://github.com/openclaw/Peekaboo.git
Fetched https://github.com/openclaw/Peekaboo.git from cache (18.58s)
Fetching https://github.com/apple/swift-numerics.git
Fetching https://github.com/swiftlang/swift-cmark.git
Fetching https://github.com/groue/GRDB.swift.git
Fetched https://github.com/apple/swift-numerics.git from cache (10.23s)
Fetching https://github.com/sindresorhus/KeyboardShortcuts
Fetched https://github.com/swiftlang/swift-cmark.git from cache (10.24s)
Fetching https://github.com/apple/swift-system
Fetched https://github.com/groue/GRDB.swift.git from cache (10.50s)
Fetching https://github.com/pointfreeco/swift-concurrency-extras
Fetched https://github.com/pointfreeco/swift-concurrency-extras from cache (0.83s)
Fetching https://github.com/steipete/ElevenLabsKit
Fetched https://github.com/apple/swift-system from cache (1.27s)
Fetching https://github.com/openclaw/AXorcist.git
Fetched https://github.com/sindresorhus/KeyboardShortcuts from cache (1.30s)
Fetching https://github.com/swiftlang/swift-subprocess.git
Fetched https://github.com/steipete/ElevenLabsKit from cache (1.05s)
Fetching https://github.com/sparkle-project/Sparkle
Fetched https://github.com/swiftlang/swift-subprocess.git from cache (1.12s)
Fetching https://github.com/mgriebling/SwiftMath
Fetched https://github.com/openclaw/AXorcist.git from cache (1.31s)
Fetching https://github.com/apple/swift-log.git
Fetched https://github.com/apple/swift-log.git from cache (1.14s)
Fetching https://github.com/apple/swift-algorithms
Fetched https://github.com/mgriebling/SwiftMath from cache (1.38s)
Fetching https://github.com/steipete/Commander.git
[34600/44506] Fetching sparkle, commander

Assertions:

  • FAIL expect_output: Test run

How this fits together

The 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
Loading

Before merge

  • Preserve the full diagnostic for the tooltip (P2) - operatorStatusLine replaces stderr with the 360-character/four-line excerpt, and the header passes that same value to .help. A long worker failure therefore loses its tail both in the row and on hover, contrary to the intended full-diagnostic hover path; carry the bounded original separately from the rendered excerpt.
  • Resolve merge risk (P1) - Removing the manual Canvas open/close actions changes an existing menu and Dock workflow; the retained Canvas permission tile and agent-open path should remain verified on the exact merge head.
  • Complete next step (P2) - The remaining blocker is a narrow mechanical repair at the diagnostic presentation boundary.

Findings

  • [P2] Preserve the full diagnostic for the tooltip — apps/macos/Sources/OpenClaw/NodeMode/MacNodeChannelStatusStore.swift:22-24
Agent review details

Security

None.

PR surface

Other +298. Total +298 across 28 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 28 697 399 +298
Total 28 697 399 +298

Review metrics

Metric Value Why it matters
Production versus test delta production +61 net; tests +238 net The stated growth is concentrated in structured diagnostics and hosted-row highlighting, while the refactor removes prior menu-width and action code.

Stored data model

Persistent data-model change detected: migration/backfill/repair: apps/macos/Tests/OpenClawIPCTests/StatusMenuWidthTests.swift, serialized state: apps/macos/Tests/OpenClawIPCTests/StatusMenuWidthTests.swift. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the retained Canvas path (recommended)
    Before merge, confirm that the header Canvas permission tile and the agent-driven panel-open path remain available after the menu and Dock actions are removed.

Technical review

Best 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; excerpt discards the tail before the header constructs its hover help.

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:

  • [P2] Preserve the full diagnostic for the tooltip — apps/macos/Sources/OpenClaw/NodeMode/MacNodeChannelStatusStore.swift:22-24
    operatorStatusLine replaces stderr with the 360-character/four-line excerpt, and the header passes that same value to .help. A long worker failure therefore loses its tail both in the row and on hover, contrary to the intended full-diagnostic hover path; carry the bounded original separately from the rendered excerpt.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against e0a4915bcf16.

Labels

Label justifications:

  • P2: A bounded but incomplete worker diagnostic prevents operators from reading the full available failure context.
  • merge-risk: 🚨 compatibility: The PR removes existing Canvas open/close entries from both the status menu and Dock menu.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless supplies after-fix screenshots and a live operator report.

Evidence

Acceptance criteria:

  • [P1] swift test --package-path apps/macos --filter MacNodeModeCoordinatorTests.
  • [P1] swift test --package-path apps/macos --filter StatusMenuWidthTests.

What I checked:

Likely related people:

  • steipete: Introduced the merged status-menu redesign and authored the current follow-up changes across the renderer, header, and worker diagnostic paths. (role: feature owner and recent area contributor; confidence: high; commits: 2b0da0e1932f, 812c17e3b99f; files: apps/macos/Sources/OpenClaw/StatusMenuRenderer.swift, apps/macos/Sources/OpenClaw/StatusMenuHeaderView.swift, apps/macos/Sources/OpenClaw/NodeMode/MacNodeChannelStatusStore.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Keep a full bounded stderr value for hover help while rendering the compact excerpt, and add regression coverage for both outputs.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-26T20:43:18.827Z sha f647caa :: needs changes before merge. :: [P2] 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.
@steipete

Copy link
Copy Markdown
Contributor Author

Addressed the P2 in d41d009: StatusMenuHighlightDelegate now implements menuDidClose and clears its menu's hosted rows — AppKit sends no willHighlight(nil) on submenu close, so a device row selected there previously reopened still lit. The regression test extends the highlight walk with an explicit close cycle (select second row → close → both rows cleared).

@steipete
steipete merged commit 99a2434 into main Aug 26, 2026
107 checks passed
@steipete
steipete deleted the steipete/menu-polish-width-quiet-highlight branch August 26, 2026 21:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant