Skip to content

feat(macos): show live Gateway cards in the Gateways menu - #139688

Merged
steipete merged 5 commits into
mainfrom
steipete/gateway-menu-rich-rows
Sep 6, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/gateway-menu-rich-rows

Conversation

@steipete

@steipete steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Problem

After #139522 the Gateways menu opens a window per Gateway, but each row is only a name. Operators cannot see which Gateway is reachable, which version and build it runs, where it lives, or how many windows they already have open for it without opening the dashboard.

Solution

  • Each Gateway renders as a card row (AppKit NSMenuItem.view, hosted through the status menu's existing HostedMenuRowView): health dot, name, Primary badge, ⌘ shortcut hint; second line version · build · endpoint · transport; third line latency · N windows · session expiry or unreachable · last seen … / checking….
  • SwiftUI keeps the top-level CommandMenu("Gateways") in place; GatewaysMainMenu takes over its submenu delegate and rebuilds the items (cards, "New … Window" Option alternates with ⌥⌘digit, separator, Manage Gateways…).
  • GatewayMenuStatusStore probes only while the menu is open: the primary through ControlChannel.health, saved profiles through their fleet connection's health request, reading version/build id from the hello-ok snapshot. Closing the menu cancels probes and disconnects probed saved profiles with no dashboard window (never the primary); a window opened from the menu is awaited first. Facts stay cached for the process.
  • DashboardManager.openWindowCount(for:) and catalog-only authKind / browserSessionExpiresAt on MacGatewayCatalogProfile; the profile registry and the web bridge payload are unchanged.
  • Docs: docs/platforms/mac/menu-bar.md, docs/platforms/mac/webchat.md.

Impact

macOS-only, user-visible: the Gateways menu becomes a live overview of configured Gateways. No new background traffic: probes exist only while the menu is open and idle probe sockets are closed on menu close. Release-note context: "macOS: the Gateways menu shows live cards with health, version, endpoint, latency, and open-window counts."

Evidence

  • scripts/format-swift.sh macos, scripts/lint-swift.sh macos: clean.
  • swift build --package-path apps/macos --build-system native --product OpenClaw and --build-tests: build.
  • pnpm native:i18n:verify passes after pnpm native:i18n:baseline (21 new strings).
  • node scripts/check-changed.mjs (apps + docs lanes): passes.
  • Codex autoreview (P1 threshold): scoped-clean.
  • New tests: GatewayMenuCardModelTests (line composition, expiry, window counts, endpoint labels), GatewayMenuStatusStoreTests (concurrent probes, failure keeps last identity, cancellation, idle-profile disconnect, late-result rejection). Native tests are compile-verified locally; the macos-swift CI job runs them.
  • Live test on a signed release build installed on a Mac with an SSH-tunneled primary plus two Cloudflare Access profiles (stable.openclaw.ai, team.openclaw.ai): opening the menu shows three cards with green health, version · commit · endpoint · transport (… · clawstudio.local via ssh, … · stable.openclaw.ai · Access), warm latency (about 30 ms for the SSH primary, about 145 ms for the Cloudflare Access profiles), open-window counts, and session expires in 19h/14h; while team.openclaw.ai was mid-update its card switched to a red dot with unreachable · last seen 2 min ago and recovered on the next open; ⌘2 opened the Stable window, ⌥⌘3 opened a second Team window, ⌘1 brought the primary window front; the Option state lists the New … Window alternates; no errors in the app log. The first build reused SwiftUI's private submenu and drew blank rows, which is why the menu now owns a plain NSMenu under the SwiftUI top-level item; later commits show the commit segment of build ids, time a warm health round-trip, and start probes before the catalog refresh so cards fill in while a profile window is open.

Before (#139522):

Gateways menu with plain rows

After:

Gateways menu with live cards

With Option held:

Gateways menu with Option held showing New … Window alternates

The Gateways menu listed plain names, so operators could not tell which
Gateway was healthy, which version it ran, or where it lived.

- Render each Gateway as an AppKit card row hosted through the status
  menu's row view: health dot, name, Primary badge, shortcut hint,
  version and build id, endpoint and transport, latency, open-window
  count, browser-session expiry, and last successful contact.
- SwiftUI keeps the top-level Gateways command menu in place; AppKit takes
  over its submenu delegate so the rows can carry live facts.
- Probe Gateways only while the menu is open: the primary through the
  control channel, saved profiles through their fleet connection. Closing
  the menu cancels probes and disconnects probed profiles that have no
  dashboard window, never the primary. Facts stay cached for the process.
- Expose window counts from DashboardManager and auth kind plus
  browser-session expiry from the profile catalog; the profile registry
  and the web bridge payload are unchanged.
- Docs describe the cards and the probe lifetime.
The SwiftUI-owned submenu drew view-based items as blank rows. Own a plain
NSMenu under the SwiftUI top-level item, attach each card before inserting
its item, and rebuild rows only when the catalog changes instead of on every
menuNeedsUpdate.
…file latency

Build ids are version-prefixed, so a seven-character prefix showed only the
version. Extract the embedded commit instead. Profile probes now time a
second health request so the card shows the warm round-trip rather than the
initial connect.
The catalog refresh can take seconds while a profile window is open, which
left the cards without health, version, or latency. Start probing the rows
that already exist and refresh the catalog and profile metadata alongside.
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos size: XL maintainer Maintainer-authored PR labels Sep 6, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 6, 2026, 12:17 AM ET / 04:17 UTC.

ClawSweeper review

What this changes

The macOS Gateways menu gains cards showing connection health, version, endpoint, latency, session expiry, and dashboard-window counts.

Merge readiness

⛔ Blocked before merge - 4 items remain

This remains useful work absent from current main. The latest commit protects established native chat windows, but the prior cleanup concern remains for chat windows whose asynchronous opening has not finished.

Priority: P2
Reviewed head: 25617c4d651d4238906dcca9b30377bee9746a80

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, demonstrated feature work remains blocked by an incomplete shared-connection lifetime repair.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The captured signed-macOS report exercises the new menu cards, real health probes, recovery, and shortcuts, with linked before/after captures and follow-up consumer-wiring verification. Screenshot inspection was unavailable here; the unfinished-native-open interleaving remains a correctness gap outside the reported scenarios.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The captured signed-macOS report exercises the new menu cards, real health probes, recovery, and shortcuts, with linked before/after captures and follow-up consumer-wiring verification. Screenshot inspection was unavailable here; the unfinished-native-open interleaving remains a correctness gap outside the reported scenarios.
Evidence reviewed 8 items Current main still uses plain menu rows: The fetched main revision builds Toggle rows with window-opening shortcuts; it does not contain the proposed card menu. The supplied merged predecessor, #139522, establishes window navigation rather than live cards. The new menu file is also absent from the supplied latest release tag.
Latest repair counts completed native chat windows: The comparison against the prior reviewed head confirms the new count helper. It counts profileWindowOrder entries, which show(profile:) inserts only after awaiting fleet binding and mainSessionKey().
Pending native opens remain outside cleanup ownership: disconnectIdleProfile awaits only dashboard opens registered by this menu, then checks completed dashboard/native windows and disconnects the fleet connection. Native show(profile:) can still be awaiting its initial session lookup with no registered window.
Findings 1 actionable finding [P2] Count pending native chat opens before disconnecting
Security None None.

How this fits together

The macOS app combines its primary Gateway and saved profiles in a menu that opens dashboard windows. The new cards fetch health through existing Gateway connections, which saved-profile native chat windows also share.

flowchart TD
  A[Primary and saved Gateways] --> B[Gateways menu]
  B --> C[Health probes]
  C --> D[Cached card facts]
  D --> B
  B --> E[Open dashboard window]
  B --> F[Menu closes]
  F --> G{Active connection consumers?}
  G -->|None| H[Disconnect saved connection]
Loading

Before merge

  • Count pending native chat opens before disconnecting (P2) - Established native chat windows are now protected, but show(profile:) awaits fleet binding and connection.mainSessionKey() before inserting into profileWindowOrder. If the Gateways menu closes during that initial lookup, this helper still returns zero; menu cleanup tracks only its own dashboard opens and shuts down the same fleet connection. The initial config request then fails and falls back to main. Register native opening consumers before the first await and retain them until setup completes or fails; cover this overlap alongside the existing open-window case.
  • Resolve merge risk (P1) - Menu cleanup can disconnect a saved-profile connection while native chat is still opening and has not registered its window.
  • Resolve merge risk (P1) - The linked before/after screenshots could not be independently inspected because attachment access failed.
  • Complete next step (P2) - Protect pending native chat opens from menu cleanup and verify the overlapping open/close sequence before merge.

Findings

  • [P2] Count pending native chat opens before disconnecting — apps/macos/Sources/OpenClaw/WebChatManager.swift:341-342
Agent review details

Security

None.

PR surface

Docs +11, Other +1050. Total +1061 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 2 13 2 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 13 1094 44 +1050
Total 15 1107 46 +1061

Review metrics

Metric Value Why it matters
Production versus test growth Production +675 lines; tests +354 lines The stated growth implements native card rendering and probe lifecycle coverage, but the remaining consumer-lifetime edge crosses those separate owners.

Merge-risk options

Maintainer options:

  1. Protect pending native chat opens (recommended)
    Include admitted native window opens in connection ownership and verify that closing the menu cannot disconnect their transport before setup finishes.

Technical review

Best possible solution:

Connection ownership should cover native chat setup from admission through window closure, so menu cleanup releases only genuinely idle transports.

Do we have a high-confidence way to reproduce the issue?

Yes, from the PR source: delay a native chat's initial session lookup, then close the probing Gateways menu before its window is registered. This interleaving was traced but not executed.

Is this the best way to solve the issue?

The card implementation reuses existing menu and connection owners appropriately, but completed-window counts alone do not safely establish that a connection is idle.

Full review comments:

  • [P2] Count pending native chat opens before disconnecting — apps/macos/Sources/OpenClaw/WebChatManager.swift:341-342
    Established native chat windows are now protected, but show(profile:) awaits fleet binding and connection.mainSessionKey() before inserting into profileWindowOrder. If the Gateways menu closes during that initial lookup, this helper still returns zero; menu cleanup tracks only its own dashboard opens and shuts down the same fleet connection. The initial config request then fails and falls back to main. Register native opening consumers before the first await and retain them until setup completes or fails; cover this overlap alongside the existing open-window case.
    Confidence: 0.9

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 932886441a34.

Labels

Label justifications:

  • P2: This is a bounded macOS visibility improvement with a connection-cleanup edge case.
  • merge-risk: 🚨 availability: The introduced menu cleanup can shut down a transport still needed by an unfinished native chat open.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (linked_artifact): The captured signed-macOS report exercises the new menu cards, real health probes, recovery, and shortcuts, with linked before/after captures and follow-up consumer-wiring verification. Screenshot inspection was unavailable here; the unfinished-native-open interleaving remains a correctness gap outside the reported scenarios.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured signed-macOS report exercises the new menu cards, real health probes, recovery, and shortcuts, with linked before/after captures and follow-up consumer-wiring verification. Screenshot inspection was unavailable here; the unfinished-native-open interleaving remains a correctness gap outside the reported scenarios.

Evidence

What I checked:

  • Current main still uses plain menu rows: The fetched main revision builds Toggle rows with window-opening shortcuts; it does not contain the proposed card menu. The supplied merged predecessor, feat(macos): open Gateway windows from the Gateways menu #139522, establishes window navigation rather than live cards. The new menu file is also absent from the supplied latest release tag. (apps/macos/Sources/OpenClaw/DashboardGatewayCommands.swift:13, 932886441a34)
  • Latest repair counts completed native chat windows: The comparison against the prior reviewed head confirms the new count helper. It counts profileWindowOrder entries, which show(profile:) inserts only after awaiting fleet binding and mainSessionKey(). (apps/macos/Sources/OpenClaw/WebChatManager.swift:341, 25617c4d651d)
  • Pending native opens remain outside cleanup ownership: disconnectIdleProfile awaits only dashboard opens registered by this menu, then checks completed dashboard/native windows and disconnects the fleet connection. Native show(profile:) can still be awaiting its initial session lookup with no registered window. (apps/macos/Sources/OpenClaw/GatewaysMainMenu.swift:333, 25617c4d651d)
  • Disconnect affects pending connection work: GatewayConnection.shutdown retires the configured client and increments shutdownGeneration. An interrupted refreshMainSessionKey request catches the failure and returns the fallback main session. This establishes the causal effect of cleanup during an unfinished native open. (apps/macos/Sources/OpenClaw/GatewayConnection.swift:969, 25617c4d651d)
  • Existing tests cover probe lifetime: The complete status-store tests cover concurrent probes, cancellation, failed refreshes, count-gated disconnect, and delayed probe completion. They do not exercise a native window opening while menu cleanup runs. Tests were inspected, not executed. (apps/macos/Tests/OpenClawIPCTests/GatewayMenuStatusStoreTests.swift:173, 25617c4d651d)
  • Captured signed-build behavior evidence: The supplied body at sourceRevision 365acd4fe44fe9b607d776487e9c22f1c0448c6576210314052d595a8d4683c6 reports a signed macOS build showing live cards, failure/recovery, shortcuts, and Option alternates, with before/after attachment links. The follow-up comment reports verification of native-chat consumer wiring: feat(macos): show live Gateway cards in the Gateways menu #139688 (comment). These observations support the feature but do not describe cleanup overlapping an unfinished native open.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Protect pending native chat opens and add a regression that closes the menu while initial chat setup is awaiting the Gateway.

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-09-06T03:41:40.310Z sha 23ab48a :: blocked before merge. :: [P2] [P2] Preserve connections owned by native chat windows

Native chat windows share a saved profile's fleet connection with dashboard
windows. Probe cleanup only counted dashboard windows, so closing the menu
could shut down a connection an open chat window was using. Count both
owners before disconnecting.
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

The native-chat consumer finding was valid and is fixed in 25617c4. WebChatManager.openWindowCount(profileID:) now feeds GatewaysMainMenu.activeConsumerCount(for:), which counts dashboard and native chat windows for both menu-close cleanup and idle-profile disconnect.

The existing GatewayMenuStatusStoreTests cover the count-gated disconnect; the owner wiring is exercised by the signed-build live test. The linked screenshots are private user-attachment URLs visible to maintainers.

@steipete
steipete merged commit e5f86ed into main Sep 6, 2026
122 checks passed
@steipete
steipete deleted the steipete/gateway-menu-rich-rows branch September 6, 2026 04:48
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…39688)

* feat(macos): show live Gateway cards in the Gateways menu

The Gateways menu listed plain names, so operators could not tell which
Gateway was healthy, which version it ran, or where it lived.

- Render each Gateway as an AppKit card row hosted through the status
  menu's row view: health dot, name, Primary badge, shortcut hint,
  version and build id, endpoint and transport, latency, open-window
  count, browser-session expiry, and last successful contact.
- SwiftUI keeps the top-level Gateways command menu in place; AppKit takes
  over its submenu delegate so the rows can carry live facts.
- Probe Gateways only while the menu is open: the primary through the
  control channel, saved profiles through their fleet connection. Closing
  the menu cancels probes and disconnects probed profiles that have no
  dashboard window, never the primary. Facts stay cached for the process.
- Expose window counts from DashboardManager and auth kind plus
  browser-session expiry from the profile catalog; the profile registry
  and the web bridge payload are unchanged.
- Docs describe the cards and the probe lifetime.

* fix(macos): own the Gateways submenu so card rows render

The SwiftUI-owned submenu drew view-based items as blank rows. Own a plain
NSMenu under the SwiftUI top-level item, attach each card before inserting
its item, and rebuild rows only when the catalog changes instead of on every
menuNeedsUpdate.

* fix(macos): show the commit segment of Gateway build ids and warm profile latency

Build ids are version-prefixed, so a seven-character prefix showed only the
version. Extract the embedded commit instead. Profile probes now time a
second health request so the card shows the warm round-trip rather than the
initial connect.

* fix(macos): probe Gateway cards as soon as the menu opens

The catalog refresh can take seconds while a profile window is open, which
left the cards without health, version, or latency. Start probing the rows
that already exist and refresh the catalog and profile metadata alongside.

* fix(macos): keep native chat connections when the Gateways menu closes

Native chat windows share a saved profile's fleet connection with dashboard
windows. Probe cleanup only counted dashboard windows, so closing the menu
could shut down a connection an open chat window was using. Count both
owners before disconnecting.
steipete added a commit that referenced this pull request Oct 13, 2026
* refactor(apple): simplify old shared and macOS bookkeeping

Replace redundant generations with existing cancellation or actual owner
identity, consolidate parallel fallback/policy paths, and remove test-only
forwarding layers. Preserve authority, FIFO, durable state, resource bounds,
public protocol/config shapes, signing, permissions, and visible rendering.

Reuse canonical session-key normalization for Voice Wake delivery selection:
opaque Signal group IDs remain case-sensitive and main aliases are not added.
Use canonical IP-literal policy for discovery labels and remote CLI validation.

Best-effort tradeoffs accepted

- Palette generation (#159350): synthetic direct completions bypassed the sole cancellation-owning caller; unsupported future callers can show stale results until the next search. Current cancellation/request/agent checks remain.
- Link preview generation (#160710): synthetic URL replacement without caller cancellation is outside the SwiftUI task lifecycle; a late cosmetic result can remain until the next refresh. Network/SSRF checks and bounded caches remain.
- Sidebar preview generation (#147197): same-request overlapping cache reads can finish out of order; no linked human failure report, and a later refresh replaces the cosmetic projection. Owner/request checks remain.
- Source-preview producer revision (#148906): duplicate of exact task cancellation, with no human failure report. Consumer revision and authenticated resource authority remain.
- Mermaid generations (#135470/#135746): feature stress fixtures, no linked human race report. Exact subscriber cancellation and job/WebView identity retain the same admission; no extra failure accepted.
- Camera JPEG UUID (#107879): duplicates exact task cancellation; #107804 was a human feature request, not a generation-specific incident. Captured session/agent/route and attachment admission remain.
- Discovery generation (#145435): speculative queued callbacks, no linked human incident. A stopped browser may publish one late discovery projection; next discovery/refresh repairs it. Connection authority remains separate.
- FSEvents generation (#145453): synthetic stop/restart fixtures, no linked human incident. An old callback after restart may cause one extra refresh; serial lifecycle ownership and pending-work cancellation remain.
- Menu generations (#139688): feature-local late-result fixtures, no linked human incident. Exact task cancellation replaces duplicate tokens; drain-before-disconnect and real consumer/window authority remain.
- Cron generation (#131466/#137502): #138209 cut every load over to one cancel-and-drain chain. No direct concurrent load caller remains; cancellation and physical source leases stay checked after awaits.
- WebChat visibility acknowledgement/retry (#113634/#137089): synthetic timeout/reconnect interleavings, no linked human incident. A timed-out visibility update is best effort until the next transition/reconnect; FIFO and live socket leases remain.
- WebChat cleanup UUID (#113634/#137089): retain one bounded completed Task handle per live connection instead of matching cleanup tokens. Completion releases captures; replacement/retirement removes the handle.
- Child-exit polling (#145437): synthetic missed-notification coverage, no linked human report. A lost OS exit notification may wait for the existing deadline; final non-reaping liveness/status checks and cleanup remain.
- Realtime iterator borrowing trap (#156772): every real consumer awaits its own iterator sequentially. Unsupported concurrent next calls no longer get a custom custody protocol; bounded stream/cancellation/socket checks remain.
- Receipt projection admission (#161745): both real callers already match receipt and row identity immediately before synchronous projection. Those effect checks remain; no unsupported internal caller is defended twice.
- Recap attribution heuristics (#112188/#113084): synthetic guard matrix, no linked human race report. Missing initial rows or very late unrelated completion may supply a cosmetic footer; per-session freshness, failed-turn handling and settled results remain.
- PortGuardian per-write schema scans (#110527): synthetic live-handle version advance, no linked human incident. Concurrent external schema upgrades are best effort until reopen; initial admission, migration locks, receipts, transactions and durability remain.
- Unread queue counter (#110019): actual Task equality replaces the duplicate integer token. Exact-tail reclamation, bounded bookkeeping, FIFO and route authority remain unchanged.

Review dispositions: the claimed Task compilation failure is disproved by the
selected SDK's Equatable conformance and native builds. Repeated receipt
identity admission is unnecessary at its internal projector because both real
callers retain it immediately before projection. Per-write schema revalidation
was declined under the explicit best-effort policy above.

Proof and scope

Net production reduction: 369 lines (148 added, 517 deleted), excluding tests.
Fresh seven-day census permits all substantive production edits; the only
recent caller change is the unavoidable one-line fallback-to-parse rename.

Shared Swift build passed. Final focused shared tests passed 396 cases in six
suites (6.683s execution), Watch decoder tests passed five cases (0.003s), and
isolated whole-owner native tests passed 16 cases. macOS SwiftPM compiled all
products and the test bundle. Final macOS and iOS/Watch xcodebuild builds passed
(89.60s and 120.87s wall), without signing changes or app launches.

Canonical Apple lint/format checks passed; the initial iOS format failure in
WatchCommands was ours and corrected, with no gate weakened. Lint-suppression
tests passed 3/3 (14.09s wall). Earlier runtime cycles and Madge each reported 0;
the TypeScript graph is unchanged. Native localization stayed at 4476 entries.
The 45 original packaging/elevation timeout cases passed one focused retry
(94.79s wall), with no assertion/budget change and no claim of a diagnosed fix.

Known gaps: seven issues remained in the earlier ChatStreamReplayTests
narration=false package cases; causality/current-main attribution is unproven.
App-hosted macOS tests were not executed on the operator desktop. No hosted CI
or PR was started: the explicit BELOW-500 rule requires a branch-only handoff.

* refactor(ui): consolidate old UI owners and validation

Share route decoding, attachment retention, gallery preparation, transient
identity encoding, override copying, and extension classification. Remove
duplicate admission/schema mirrors and obsolete supported-browser fallbacks.
Both Lit and Solid paths remain; no rendering change is intended. No config,
protocol, persisted shape, dependency, or public SDK change.

Best-effort tradeoffs accepted

- Malformed internal native requests (#140988): all callers are typed and
  native hosts validate at the effect; their error replaces the renderer mirror.
- Worker replacement during an identity query (#140484): added for synthetic
  autoreview interleavings, not a human incident. Return false; normal worker
  announcements and foreground recovery observe the next active worker.
- Native readiness changing between synchronous checks (#140484/#109719):
  rely on queued events. A broken native event can require another worker event
  or reload; camera readiness retains its existing five-second error deadline.
- Overlapping application-root health reporters (#152638): startup mounts one
  root. Unsupported overlapping roots are last-publication-wins; the actual
  reported health/status feature and native trusted-document checks remain.
- Polling after stop (#139704): its sole owner retires eligibility first.
  Scheduling now uses that owner admission, not a separate read-only generation.
- Resetting an observer without retiring its connection (#116887): no production
  caller does this. Canonical connection epochs remain the sole retirement owner;
  unsupported direct live-scope reset no longer fences an old response separately.
- Upload policy changing during local reads (#158567): decoded/hash work can
  finish. Draft publication and every upload request retain live policy checks.
- Missing supported browser primitives (#105240/#151388/#100024/#102745):
  unsupported runtimes error instead of code-point initials, skipped input yield,
  wall-clock timing, or approximate microtask paint. The human progress-card fix
  in #151386 keeps its browser yield and durable FIFO handoff unchanged.
- URL APIs disappearing after URL creation (#100024/#149330): supported browsers
  keep paired APIs. An unsupported replaced global can throw during cleanup;
  undefined URLs, creation fallback, cancellation and release ordering remain.
- Malformed internal MCP calls bypassing AppBridge (#161747): may throw. The SDK
  still rejects malformed wire blocks before dispatch, proved over real in-memory
  App/AppBridge transport. UI content, authority, confirmation and custody policy
  remain. The introducing PR cites no human incident for the second mirror.

Production: +176/-394, net -218 lines across 21 eligible old files. Tests: +30.
Focused owner/sibling tests, targeted types/lint/format, lint-suppression and
independent P0-P2 review pass. Import edges are unchanged; runtime/Madge cycle
proof remains zero. Whole-tree Knip timed out at existing limits; heavy gallery
renderer runs did not reach assertions, while its owning controller suite passed.

* refactor(ui): remove obsolete Fetch capability branch

The supported Control UI browser floor includes Fetch. Start attachment
metadata reads directly rather than leaving an unsupported runtime in a
permanent checking state.

Best-effort tradeoffs accepted

- Missing global Fetch: the guard originated in #64104, whose feature report
  cites no human missing-Fetch incident. An unsupported runtime that replaces
  Fetch now reaches the existing rejected-request/unavailable path. Metadata
  validation, auth/tickets, allow POST, cancellation, resource admission,
  expiry and bounded retry remain unchanged. No intended rendering change.

Unchanged lifecycle baseline: 21/21, 25.09 s. Final lifecycle and attachment
siblings: 50/50, 14.77 s. UI types, typed lint, formatting and lint-suppression
checks pass. This cut removes five production lines including formatter
reflow, bringing the lane to 223 net production lines removed.
Fresh independent P0-P2 review is scoped-clean with no actionable findings.

* fix(ui): use global frame scheduling APIs

Preserve double-frame paint timing and cancellation without requiring a Window object in renderer-free hosts that supply the standard global APIs. The existing access suite reproduces seven unhandled errors before this fix and passes on main; all 130 affected cases plus 262 timing/state/send sibling cases now pass without test changes.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…#170823)

* refactor(apple): simplify old shared and macOS bookkeeping

Replace redundant generations with existing cancellation or actual owner
identity, consolidate parallel fallback/policy paths, and remove test-only
forwarding layers. Preserve authority, FIFO, durable state, resource bounds,
public protocol/config shapes, signing, permissions, and visible rendering.

Reuse canonical session-key normalization for Voice Wake delivery selection:
opaque Signal group IDs remain case-sensitive and main aliases are not added.
Use canonical IP-literal policy for discovery labels and remote CLI validation.

Best-effort tradeoffs accepted

- Palette generation (openclaw#159350): synthetic direct completions bypassed the sole cancellation-owning caller; unsupported future callers can show stale results until the next search. Current cancellation/request/agent checks remain.
- Link preview generation (openclaw#160710): synthetic URL replacement without caller cancellation is outside the SwiftUI task lifecycle; a late cosmetic result can remain until the next refresh. Network/SSRF checks and bounded caches remain.
- Sidebar preview generation (openclaw#147197): same-request overlapping cache reads can finish out of order; no linked human failure report, and a later refresh replaces the cosmetic projection. Owner/request checks remain.
- Source-preview producer revision (openclaw#148906): duplicate of exact task cancellation, with no human failure report. Consumer revision and authenticated resource authority remain.
- Mermaid generations (openclaw#135470/openclaw#135746): feature stress fixtures, no linked human race report. Exact subscriber cancellation and job/WebView identity retain the same admission; no extra failure accepted.
- Camera JPEG UUID (openclaw#107879): duplicates exact task cancellation; openclaw#107804 was a human feature request, not a generation-specific incident. Captured session/agent/route and attachment admission remain.
- Discovery generation (openclaw#145435): speculative queued callbacks, no linked human incident. A stopped browser may publish one late discovery projection; next discovery/refresh repairs it. Connection authority remains separate.
- FSEvents generation (openclaw#145453): synthetic stop/restart fixtures, no linked human incident. An old callback after restart may cause one extra refresh; serial lifecycle ownership and pending-work cancellation remain.
- Menu generations (openclaw#139688): feature-local late-result fixtures, no linked human incident. Exact task cancellation replaces duplicate tokens; drain-before-disconnect and real consumer/window authority remain.
- Cron generation (openclaw#131466/openclaw#137502): openclaw#138209 cut every load over to one cancel-and-drain chain. No direct concurrent load caller remains; cancellation and physical source leases stay checked after awaits.
- WebChat visibility acknowledgement/retry (openclaw#113634/openclaw#137089): synthetic timeout/reconnect interleavings, no linked human incident. A timed-out visibility update is best effort until the next transition/reconnect; FIFO and live socket leases remain.
- WebChat cleanup UUID (openclaw#113634/openclaw#137089): retain one bounded completed Task handle per live connection instead of matching cleanup tokens. Completion releases captures; replacement/retirement removes the handle.
- Child-exit polling (openclaw#145437): synthetic missed-notification coverage, no linked human report. A lost OS exit notification may wait for the existing deadline; final non-reaping liveness/status checks and cleanup remain.
- Realtime iterator borrowing trap (openclaw#156772): every real consumer awaits its own iterator sequentially. Unsupported concurrent next calls no longer get a custom custody protocol; bounded stream/cancellation/socket checks remain.
- Receipt projection admission (openclaw#161745): both real callers already match receipt and row identity immediately before synchronous projection. Those effect checks remain; no unsupported internal caller is defended twice.
- Recap attribution heuristics (openclaw#112188/openclaw#113084): synthetic guard matrix, no linked human race report. Missing initial rows or very late unrelated completion may supply a cosmetic footer; per-session freshness, failed-turn handling and settled results remain.
- PortGuardian per-write schema scans (openclaw#110527): synthetic live-handle version advance, no linked human incident. Concurrent external schema upgrades are best effort until reopen; initial admission, migration locks, receipts, transactions and durability remain.
- Unread queue counter (openclaw#110019): actual Task equality replaces the duplicate integer token. Exact-tail reclamation, bounded bookkeeping, FIFO and route authority remain unchanged.

Review dispositions: the claimed Task compilation failure is disproved by the
selected SDK's Equatable conformance and native builds. Repeated receipt
identity admission is unnecessary at its internal projector because both real
callers retain it immediately before projection. Per-write schema revalidation
was declined under the explicit best-effort policy above.

Proof and scope

Net production reduction: 369 lines (148 added, 517 deleted), excluding tests.
Fresh seven-day census permits all substantive production edits; the only
recent caller change is the unavoidable one-line fallback-to-parse rename.

Shared Swift build passed. Final focused shared tests passed 396 cases in six
suites (6.683s execution), Watch decoder tests passed five cases (0.003s), and
isolated whole-owner native tests passed 16 cases. macOS SwiftPM compiled all
products and the test bundle. Final macOS and iOS/Watch xcodebuild builds passed
(89.60s and 120.87s wall), without signing changes or app launches.

Canonical Apple lint/format checks passed; the initial iOS format failure in
WatchCommands was ours and corrected, with no gate weakened. Lint-suppression
tests passed 3/3 (14.09s wall). Earlier runtime cycles and Madge each reported 0;
the TypeScript graph is unchanged. Native localization stayed at 4476 entries.
The 45 original packaging/elevation timeout cases passed one focused retry
(94.79s wall), with no assertion/budget change and no claim of a diagnosed fix.

Known gaps: seven issues remained in the earlier ChatStreamReplayTests
narration=false package cases; causality/current-main attribution is unproven.
App-hosted macOS tests were not executed on the operator desktop. No hosted CI
or PR was started: the explicit BELOW-500 rule requires a branch-only handoff.

* refactor(ui): consolidate old UI owners and validation

Share route decoding, attachment retention, gallery preparation, transient
identity encoding, override copying, and extension classification. Remove
duplicate admission/schema mirrors and obsolete supported-browser fallbacks.
Both Lit and Solid paths remain; no rendering change is intended. No config,
protocol, persisted shape, dependency, or public SDK change.

Best-effort tradeoffs accepted

- Malformed internal native requests (openclaw#140988): all callers are typed and
  native hosts validate at the effect; their error replaces the renderer mirror.
- Worker replacement during an identity query (openclaw#140484): added for synthetic
  autoreview interleavings, not a human incident. Return false; normal worker
  announcements and foreground recovery observe the next active worker.
- Native readiness changing between synchronous checks (openclaw#140484/openclaw#109719):
  rely on queued events. A broken native event can require another worker event
  or reload; camera readiness retains its existing five-second error deadline.
- Overlapping application-root health reporters (openclaw#152638): startup mounts one
  root. Unsupported overlapping roots are last-publication-wins; the actual
  reported health/status feature and native trusted-document checks remain.
- Polling after stop (openclaw#139704): its sole owner retires eligibility first.
  Scheduling now uses that owner admission, not a separate read-only generation.
- Resetting an observer without retiring its connection (openclaw#116887): no production
  caller does this. Canonical connection epochs remain the sole retirement owner;
  unsupported direct live-scope reset no longer fences an old response separately.
- Upload policy changing during local reads (openclaw#158567): decoded/hash work can
  finish. Draft publication and every upload request retain live policy checks.
- Missing supported browser primitives (openclaw#105240/openclaw#151388/openclaw#100024/openclaw#102745):
  unsupported runtimes error instead of code-point initials, skipped input yield,
  wall-clock timing, or approximate microtask paint. The human progress-card fix
  in openclaw#151386 keeps its browser yield and durable FIFO handoff unchanged.
- URL APIs disappearing after URL creation (openclaw#100024/openclaw#149330): supported browsers
  keep paired APIs. An unsupported replaced global can throw during cleanup;
  undefined URLs, creation fallback, cancellation and release ordering remain.
- Malformed internal MCP calls bypassing AppBridge (openclaw#161747): may throw. The SDK
  still rejects malformed wire blocks before dispatch, proved over real in-memory
  App/AppBridge transport. UI content, authority, confirmation and custody policy
  remain. The introducing PR cites no human incident for the second mirror.

Production: +176/-394, net -218 lines across 21 eligible old files. Tests: +30.
Focused owner/sibling tests, targeted types/lint/format, lint-suppression and
independent P0-P2 review pass. Import edges are unchanged; runtime/Madge cycle
proof remains zero. Whole-tree Knip timed out at existing limits; heavy gallery
renderer runs did not reach assertions, while its owning controller suite passed.

* refactor(ui): remove obsolete Fetch capability branch

The supported Control UI browser floor includes Fetch. Start attachment
metadata reads directly rather than leaving an unsupported runtime in a
permanent checking state.

Best-effort tradeoffs accepted

- Missing global Fetch: the guard originated in openclaw#64104, whose feature report
  cites no human missing-Fetch incident. An unsupported runtime that replaces
  Fetch now reaches the existing rejected-request/unavailable path. Metadata
  validation, auth/tickets, allow POST, cancellation, resource admission,
  expiry and bounded retry remain unchanged. No intended rendering change.

Unchanged lifecycle baseline: 21/21, 25.09 s. Final lifecycle and attachment
siblings: 50/50, 14.77 s. UI types, typed lint, formatting and lint-suppression
checks pass. This cut removes five production lines including formatter
reflow, bringing the lane to 223 net production lines removed.
Fresh independent P0-P2 review is scoped-clean with no actionable findings.

* fix(ui): use global frame scheduling APIs

Preserve double-frame paint timing and cancellation without requiring a Window object in renderer-free hosts that supply the standard global APIs. The existing access suite reproduces seven unhandled errors before this fix and passes on main; all 130 affected cases plus 262 timing/state/send sibling cases now pass without test changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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