Skip to content

feat(macos): native-feel dashboard hosting — instant reopen, preload, frame autosave, ⌘N/⌘K, route memory - #106997

Merged
steipete merged 14 commits into
mainfrom
feat/macos-dashboard-native-feel
Jul 14, 2026
Merged

steipete merged 14 commits into
mainfrom
feat/macos-dashboard-native-feel

Conversation

@steipete

@steipete steipete commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The macOS app hosts the web Control UI in a WKWebView dashboard window, but the hosting still leaks "this is a website" tells and wastes work on every open:

  • Every menubar/dock reopen reloaded the whole SPA (DashboardWindowController.update always called load), so the dashboard felt slow even when nothing changed.
  • First open after app launch always paid the full cold load.
  • The window never remembered its frame — endpoint swaps (replaceController) re-centered it, and relaunches lost position entirely.
  • The SPA route was lost on every reload/relaunch: the window always reopened on the default chat view.
  • No main-menu access to core web actions: ⌘N / ⌘K did nothing (or fell through inconsistently).
  • Right-click showed WebKit's browser context menu (Reload, Open Link in New Window, Download Linked File) — actions that are wrong or dead inside the hosted dashboard.
  • The pre-paint/overscroll background was white, flashing in dark mode.

Why This Change Was Made

Part of the macOS hybrid-shell direction: the web Control UI owns product surfaces, the native app owns platform capability and must make the hosted UI feel native. This deepens the existing native web-chrome handshake instead of duplicating product UI in SwiftUI.

Design notes:

  • Reuse of the shipped native→web event contract. The Control UI has handled openclaw:native-new-session / openclaw:native-open-search since the pre-web-chrome app builds (app-host.ts). The new ⌘N/⌘K menu items dispatch those same events rather than introducing a parallel command channel — one canonical path, richer existing behavior (agent preselection, onboarding guard) for free.
  • Route memory lives web-side. ui/src/app/native-route-memory.ts persists the last committed route (localStorage, gated on isNativeWebChromeHost()) and restores it only when boot lands on the default chat route with no explicit search — deep links (?approval=…, ?session=…) always win. Keeping this out of Swift avoids polluting the native URL/trust model (token stays in the fragment; auth paths untouched).
  • Skip-reload is equality-gated. Reopen skips the reload only when the target URL is byte-identical to the loaded one and the last load succeeded (hasLiveContent); any endpoint, base-path, or token change still reloads with fresh auth injection. Failure pages (loadHTMLString also fires didFinish) are excluded via isShowingFailurePage.
  • Preload is conservative. Only after onboarding, only when an immediate (local/direct-remote) config with credentials exists, 2s after launch, never orders the window front, never surfaces failure UI.

User Impact

  • Dashboard opens instantly after the first load — reopen keeps the live SPA; app launch pre-warms it in the background.
  • Window frame persists across reopen, endpoint swaps, and relaunches; the SPA reopens where you left it.
  • ⌘N starts a new session and ⌘K toggles the command palette from anywhere in the app (opening the dashboard first if needed), with matching menu items (File → New Session, Navigate → Command Palette).
  • Right-click in the dashboard no longer offers Reload / Open in New Window / Download items.
  • No white flash while the dashboard loads in dark mode.

Evidence

  • apps/macos: swift build clean; swift test --filter DashboardWindowSmokeTests → 34/34 pass, including new coverage for context-menu filtering, reload-decision, command queueing before page load, frame-autosave name, and failure-page gating.
  • ui: node scripts/run-vitest.mjs ui/src/app/native-route-memory.test.ts ui/src/app/app-host.test.ts ui/src/app/native-web-chrome.test.ts → pass (route persist/restore incl. corrupt entries and non-native no-op; native titlebar events).
  • swiftformat/swiftlint clean with repo configs (config/swiftformat, config/swiftlint.yml); oxfmt applied.
  • Structured autoreview (Codex gpt-5.6-sol, xhigh): 16 rounds until clean. Accepted and fixed: auth-equality in the reload decision (password-only rotation); ordered native-command queue with press-order preservation; dedicated cancelable openclaw:native-toggle-search event with automatic fallback to the shipped open-only native-open-search on older gateway bundles; hasLiveContent reset at didCommit with cancelled-provisional survival; failure-state clearing when history restores a real document (swipe-back off the failure page); moment-bound command queues dropped on terminal failure (no stale ⌘K replay); manager-level coalesced open (prevents duplicate windows and reordered ⌘N/⌘K on the async remote path); in-flight loads counted as usable so opening mid-preload doesn't restart the load; ensureOnScreen after frame-autosave restore (disconnected-monitor case); storage-getter guard; context-gated restore/persist with history replace, settled-state persistence, and in-flight-navigation priority; transient ?draft= stripped from route memory; web-side retention of ⌘N until the shell context exists.
  • Rejected with proof: "preload failure pops a window" (showLoadFailure never orders the window front; preload skips the endpoint observer). Accepted limitations (commented in source): per-origin localStorage route memory degrades to the default route on remote-tunnel port swaps; repeated pre-context ⌘N presses collapse (destination is idempotent).
  • Final review on head c8895c42772: autoreview clean: no accepted/actionable findings reported.
  • Remote pnpm check:changed (delegated Blacksmith Testbox): green — https://github.com/openclaw/openclaw/actions/runs/29301412986 (also caught the TS LOC ratchet, which drove the lazy-custom-element extraction).
  • Not verified: signed-app relaunch visual smoke (would restart the locally running production app); behavior is covered by the smoke suite above.

@openclaw-barnacle openclaw-barnacle Bot added app: macos App: macos app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Jul 14, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 14, 2026
@clawsweeper

clawsweeper Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 14, 2026, 6:26 AM ET / 10:26 UTC.

Summary
Adds macOS dashboard preloading and live-window reuse, frame and route persistence, native ⌘N/⌘K actions, browser-context-menu filtering, load theming, localization, and related Swift and Control UI tests.

PR surface: Source +186, Tests +90, Other +618. Total +894 across 34 files.

Reproducibility: not applicable. as a bug reproduction: this PR adds new macOS hosting behavior. The two review defects are source-reproducible on the unchanged current head through the queue timing and incomplete persisted-route shape.

Review metrics: 2 noteworthy metrics.

  • Persisted UI state: 1 localStorage record added. The new native-route record affects relaunch and upgrade behavior, so its full location shape and sanitization need explicit review.
  • Native command contract: 1 new toggle event, 1 legacy fallback. The compatibility bridge must work both with the current mounted shell and older gateway-served Control UI bundles.

Stored data model
Persistent data-model change detected: serialized state: ui/src/app/native-route-memory.test.ts, serialized state: ui/src/app/native-route-memory.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Fix both repeated current-head findings and rebase the affected Control UI integration onto current main.
  • [P1] Add redacted signed-app recording or runtime proof for preload, reopen, relaunch restoration, and native shortcuts.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR explicitly says signed-app relaunch visual smoke was not verified; add a redacted packaged-app recording or linked runtime artifact showing preload, instant reopen, relaunch frame/route restoration, and ⌘N/⌘K, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.

Risk before merge

  • [P1] The branch's ui/src/app/app-host.ts is based on an older host structure than current main, so a rebase may require redesign rather than a mechanical conflict resolution.
  • [P1] Persisting route state introduces an upgrade-sensitive browser-storage record; restoration must preserve the full committed location without replaying transient or credential-bearing parameters.
  • [P1] The packaged, signed macOS lifecycle remains unproven, especially background preload, relaunch restoration, window replacement, and shortcut delivery timing.

Maintainer options:

  1. Repair and prove the rebased head (recommended)
    Rebase onto current main, resolve both repeated functional findings, and add redacted signed-app proof before owner review and merge.
  2. Pause the broad dashboard bundle
    If the current-main host rewrite makes this branch costly to reconcile, split the native-hosting improvements into smaller owner-reviewed PRs rather than merging stale integration code.

Next step before merge

  • [P1] The protected owner path must review a rebased exact head after the contributor fixes the repeated blockers and supplies signed-app behavior proof; automation cannot provide that proof.

Security
Cleared: The diff adds no dependency, workflow, permission, download, publishing, or new secret-access surface, and no concrete security regression was established.

Review findings

  • [P2] Wait for the mounted shell to acknowledge native commands — apps/macos/Sources/OpenClaw/DashboardWindowController.swift:87
  • [P2] Persist and restore the committed route hash — ui/src/app/native-route-memory.ts:11-14
Review details

Best possible solution:

Rebase onto current main, preserve its current Control UI ownership boundaries, deliver native commands through a shell-ready acknowledgement path, persist the complete safe committed route including hash, and demonstrate the result in a redacted signed-app recording.

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

Not applicable as a bug reproduction: this PR adds new macOS hosting behavior. The two review defects are source-reproducible on the unchanged current head through the queue timing and incomplete persisted-route shape.

Is this the best way to solve the issue?

No, not yet. The native-shell/web-owner split is the right direction, but the current implementation must use a shell acknowledgement for commands, preserve the full safe committed route, and be rebased onto the reorganized current-main host.

Full review comments:

  • [P2] Wait for the mounted shell to acknowledge native commands — apps/macos/Sources/OpenClaw/DashboardWindowController.swift:87
    The native queue still becomes deliverable when WK navigation finishes, but the app may still be rendering the connecting surface before <openclaw-app-shell> mounts its listeners. A queued ⌘N or ⌘K can therefore be dispatched into an unobserved window event and disappear; keep it queued until the shell explicitly acknowledges handling it.
    Confidence: 0.98
  • [P2] Persist and restore the committed route hash — ui/src/app/native-route-memory.ts:11-14
    StoredNativeRoute still records only routeId and search, although router equality and settings navigation use location.hash. Relaunching a hash-addressed settings section restores only the bare route, so store, sanitize, and replay the committed hash as well.
    Confidence: 0.99

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 b9d0473b2e98.

Label changes

Label justifications:

  • P2: This is a substantial but bounded macOS and Control UI UX feature with repeatable functional blockers, not an emergency or current core outage.
  • merge-risk: 🚨 compatibility: The PR adds persisted route state and a cross-version native-to-web command fallback while its central Control UI file has materially drifted on current main.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR explicitly says signed-app relaunch visual smoke was not verified; add a redacted packaged-app recording or linked runtime artifact showing preload, instant reopen, relaunch frame/route restoration, and ⌘N/⌘K, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +186, Tests +90, Other +618. Total +894 across 34 files.

View PR surface stats
Area Files Added Removed Net
Source 4 273 87 +186
Tests 2 91 1 +90
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 28 634 16 +618
Total 34 998 104 +894

What I checked:

  • Review continuity: The current head is still 3faeaf6, the same SHA reviewed in the latest completed ClawSweeper cycle, so both previously reported blockers remain applicable. (3faeaf609409)
  • Route memory omits hash: The new persisted route shape stores only routeId and search, while the Control UI route state treats location.hash as meaningful; settings-section and other hash-based navigation therefore cannot be restored exactly. (ui/src/app/native-route-memory.ts:11, 3faeaf609409)
  • Native command queue lacks shell acknowledgement: The added native-command queue is tied to WK page-load completion rather than acknowledgement from the mounted Control UI shell; commands dispatched while the connecting surface is rendered can still be lost before shell listeners exist. (apps/macos/Sources/OpenClaw/DashboardWindowController.swift:87, 3faeaf609409)
  • Real behavior proof is absent: The PR body states that signed-app relaunch visual smoke was not verified; Swift tests, Vitest, CI, and autoreview do not demonstrate preload, instant reopen, frame/route restoration, or native shortcuts in a packaged app. (3faeaf609409)
  • Current-main drift: Current main has substantially reorganized the Control UI host and still lacks the PR's macOS menu commands and preload call, so the feature remains necessary but the branch needs an exact-main rebase and renewed whole-path review. (ui/src/app/app-host.ts:1, b9d0473b2e98)
  • Current macOS behavior: Current main's application commands expose settings and navigation but not New Session or Command Palette, and launch does not schedule dashboard preload, confirming that the requested user-facing behavior is not already implemented. (apps/macos/Sources/OpenClaw/MenuBar.swift:99, b9d0473b2e98)

Likely related people:

  • steipete: The macOS hosted-dashboard behavior builds on prior Mac web-host work associated with steipete, and repository ownership policy identifies steipete for maintainer routing beyond this proposed branch. (role: feature owner and recent area contributor; confidence: high; commits: ad5c7d97ca06; files: apps/macos/Sources/OpenClaw/DashboardManager.swift, apps/macos/Sources/OpenClaw/DashboardWindowController.swift, apps/macos/Sources/OpenClaw/MenuBar.swift)
  • ngutman: ngutman was explicitly brought into this PR's live discussion while it was iterating on the macOS and Control UI boundary, making them a useful secondary routing candidate; the available history trail is otherwise limited. (role: adjacent owner or reviewer; confidence: low; files: apps/macos/Sources/OpenClaw/DashboardWindowController.swift, ui/src/app/app-host.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-14T05:55:13.074Z sha 6d51250 :: needs real behavior proof before merge. :: [P2] Wait for the mounted shell to acknowledge native commands | [P2] Persist and restore the committed route hash
  • reviewed 2026-07-14T06:55:42.772Z sha bf2b88f :: needs real behavior proof before merge. :: [P2] Wait for the mounted shell to acknowledge native commands | [P2] Persist the committed route hash
  • reviewed 2026-07-14T07:39:12.287Z sha bf2b88f :: needs real behavior proof before merge. :: [P2] Wait for the mounted shell to acknowledge native commands | [P2] Persist the committed route hash
  • reviewed 2026-07-14T08:19:33.953Z sha bf2b88f :: needs real behavior proof before merge. :: [P2] Wait for the mounted shell to acknowledge native commands | [P2] Persist the committed route hash
  • reviewed 2026-07-14T08:59:13.992Z sha 3faeaf6 :: needs real behavior proof before merge. :: [P2] Wait for the mounted shell to acknowledge native commands | [P2] Persist and restore the committed route hash
  • reviewed 2026-07-14T09:12:17.385Z sha 3faeaf6 :: needs real behavior proof before merge. :: [P2] Wait for the mounted shell to acknowledge native commands | [P2] Persist and restore the committed route hash
  • reviewed 2026-07-14T09:41:31.405Z sha 3faeaf6 :: needs real behavior proof before merge. :: [P2] Wait for the mounted shell to acknowledge native commands | [P2] Persist and restore the committed route hash
  • reviewed 2026-07-14T09:59:09.362Z sha 3faeaf6 :: needs real behavior proof before merge. :: [P2] Wait for the mounted shell to acknowledge native commands | [P2] Persist and restore the committed route hash

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b277e0f9a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +199 to +200
self.controller = controller
controller.loadInBackground(url: url, auth: auth)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Adopt the endpoint revision when preloading

When a hidden preload succeeds, this stores a controller without starting endpoint observation or recording the current route revision. On the first later open or ⌘N/⌘K command, showConfiguredWindowIfPossible() starts observeEndpointChanges(), whose subscription immediately yields the current ready state; because displayedRouteRevision is still nil, handleEndpointState() treats any nonzero routeRevision as a route change and replaces the just-shown preloaded controller. That throws away the preloaded page, and can also wipe out the native command that was just dispatched into it, so first open after preload reloads/resets instead of being instant.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5043628a13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

function shouldRestore(routeId: RouteId, search: string, nativeHost: boolean): boolean {
return nativeHost && routeId === "chat" && search === "";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow route restore after default session injection

When the native dashboard opens at the bare root/base path, normalizeInitialApplicationLocation() injects the stored/default ?session=main before OpenClawShell.updateRouteState() calls considerRouteRestore(). Because this guard only treats an empty search as the default boot route, the common native launch path skips the stored route and then persists chat?session=main, clobbering the route memory the feature is meant to restore. This still lets explicit deep links win, but the injected default session query needs to be distinguished from a user-supplied query.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49b297f332

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +899 to +900
self.hasLiveContent = false
self.isShowingFailurePage = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear stale native commands on load failure

When a native command is queued while the dashboard is still loading (dispatchNativeCommand appends while hasLiveContent is false), a non-cancelled load failure reaches this failure-page path but leaves pendingNativeCommands intact. The failure page skips the didFinish flush, so the next successful reload/reconnect later executes the old ⌘N/⌘K command unexpectedly; clear the pending queue when switching to a terminal load-failure page.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0fdfb4b1e0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +929 to +933
guard self.hasLiveContent else {
// Ordered queue, duplicates included: two ⌘K presses while loading
// must toggle twice, and ⌘N followed by ⌘K must deliver both.
self.pendingNativeCommands.append(command)
return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear queued commands when loading is cancelled

When a native command is queued while the dashboard is still loading, closing the window before didFinish cancels the navigation via windowWillClose/stopLoading(), and the NSURLErrorCancelled branch in showLoadFailure returns without clearing this array. Because the controller is retained after close, the next successful reopen flushes that stale ⌘N/⌘K into a fresh page, so the queue also needs to be cleared when a load is terminally cancelled by close.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d5ed5aeba0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

guard self.hasLiveContent else {
// Ordered queue, duplicates included: two ⌘K presses while loading
// must toggle twice, and ⌘N followed by ⌘K must deliver both.
self.pendingNativeCommands.append(command)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear queued native commands when closing the dashboard

When a native command is queued while the dashboard is still loading, closing the dashboard before navigation finishes leaves this queued command in memory: windowWillClose only stops the load, and the resulting cancellation is ignored by showLoadFailure. Reopening the retained controller later reloads the page and didFinish flushes the stale queue, so an old ⌘N/⌘K can unexpectedly create a session or toggle the palette after the user has already dismissed the window.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. labels Jul 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f057ef7c02

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

self.hasLiveContent = true
self.publishNativeHistoryState()
// History state must reach the shell before a queued command can navigate it.
self.flushPendingNativeCommands()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Wait for the shell before flushing native commands

When the first native open uses stored credentials, the UI can still be on the connecting splash when WK didFinish fires: ui/src/app/gateway-store.ts sets a non-null client before connected, and OpenClawApp.render() keeps returning the splash until hello. Flushing queued ⌘N/⌘K here dispatches window events before <openclaw-app-shell> has mounted its listeners, so commands pressed during the initial load are dropped instead of running after the shell appears; keep them queued until the shell listener exists or acknowledges receipt.

Useful? React with 👍 / 👎.

Comment thread ui/src/app/native-route-memory.ts Outdated
Comment on lines +10 to +13
export type StoredNativeRoute = {
routeId: RouteId;
search: string;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Persist route hashes in native route memory

Routes can carry meaningful hash state: the settings route includes location.hash in its loader dependencies, and the settings sidebar navigates to specific blocks with hash. Storing only routeId and search means native route memory restores a settings block/search-result route as the bare settings page, losing the selected section after reload or relaunch; persist and replay the hash alongside search so the committed route is restored exactly.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added 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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed 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 Jul 14, 2026
steipete added 12 commits July 14, 2026 01:42
…gate

Replace the failure-page-only fast-path check with canDeliverNativeCommands
(live document or in-flight load); a terminally cancelled reload now falls
through to the reload path instead of queueing ⌘N/⌘K forever.
The one-shot startup restore now checks the rendered/pending match against
the committed bootstrap route; an explicit navigation already in flight
(replayed native new-session, fast click) is no longer clobbered.
Queued ⌘N/⌘K are moment-bound; surviving a failure page meant a later
recovery reload replayed stale commands (double palette toggle nets closed,
surprise navigation). Both failure entry points now clear the queue.
Mid-navigation emissions still carry the stale committed bootstrap route; an
interrupted restore could overwrite the remembered destination with it.
One in-flight open drains a manager-level queue in press order; a Task per
key press could race window creation (duplicate windows) and reorder ⌘N/⌘K
delivery on the non-immediate remote path.
setFrameAutosaveName re-applies the stored frame; run ensureOnScreen after
both autosave-name assignments so a frame saved on a disconnected monitor
cannot restore the window off-screen.
…l document

Swipe-back/⌘[ off the failure page commits an http(s) document without
passing through load(); the flag previously stayed set and forced a reload
on the next native command.
An open/update during the launch preload previously cancelled and restarted
the same-URL load; in-flight non-failure documents now count as usable in
the reload decision.
Command palette dispatch now sends a cancelable toggle event and falls back
to the shipped open-search event when no handler acknowledges it, so ⌘K
keeps working against older gateway-served bundles. Route memory strips
one-shot action params (?draft=) before persisting; navigation state like
?session= still restores.
…ry export

native:i18n:sync inventory + per-locale artifacts for New Session / Command
Palette…; StoredNativeRoute is module-internal after the considerRouteRestore
refactor (deadcode exports gate).
The lazy-custom-element extraction moved three internal load-failure labels
out of app-host.ts; refresh the keyless raw-copy baseline to match (main's
new ui:i18n:verify gate).
@steipete
steipete force-pushed the feat/macos-dashboard-native-feel branch from bf2b88f to 3faeaf6 Compare July 14, 2026 08:47
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 14, 2026
@steipete
steipete merged commit bc4ed5c into main Jul 14, 2026
100 of 105 checks passed
@steipete
steipete deleted the feat/macos-dashboard-native-feel branch July 14, 2026 10:33
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 15, 2026
… frame autosave, ⌘N/⌘K, route memory (openclaw#106997)

* feat(macos): native-feel dashboard hosting: instant reopen, preload, frame autosave, ⌘N/⌘K, route memory

The hosted Control UI dashboard now skips SPA reloads when reopening an
unchanged endpoint (auth-equality gated), preloads after launch when a
credentialed local/direct config exists, autosaves its window frame, maps
⌘N/⌘K menu items onto the shipped native web events, filters browser-tell
context-menu items, restores the last committed route via web-side
localStorage memory, and themes the pre-paint background.

* refactor(ui): satisfy TS LOC ratchet: move optional lazy-element helpers out of app-host

app-host.ts is over the 500-line ratchet ceiling and may not grow; move the
self-contained optional custom-element block into lazy-custom-element.ts (its
natural owner) and fold the route-restore decision into native-route-memory's
considerRouteRestore so the shell only replaces-or-persists.

* fix(macos): recover stuck dashboard command queue via deliverability gate

Replace the failure-page-only fast-path check with canDeliverNativeCommands
(live document or in-flight load); a terminally cancelled reload now falls
through to the reload path instead of queueing ⌘N/⌘K forever.

* fix(ui): let in-flight navigation win over native route restore

The one-shot startup restore now checks the rendered/pending match against
the committed bootstrap route; an explicit navigation already in flight
(replayed native new-session, fast click) is no longer clobbered.

* docs(ui): note idempotent collapse of pending native new-session replays

* fix(macos): drop queued dashboard commands on terminal load failure

Queued ⌘N/⌘K are moment-bound; surviving a failure page meant a later
recovery reload replayed stale commands (double palette toggle nets closed,
surprise navigation). Both failure entry points now clear the queue.

* fix(ui): persist native route memory only for settled router states

Mid-navigation emissions still carry the stale committed bootstrap route; an
interrupted restore could overwrite the remembered destination with it.

* fix(macos): coalesce dashboard opens for queued native commands

One in-flight open drains a manager-level queue in press order; a Task per
key press could race window creation (duplicate windows) and reorder ⌘N/⌘K
delivery on the non-immediate remote path.

* fix(macos): correct dashboard placement after frame-autosave restore

setFrameAutosaveName re-applies the stored frame; run ensureOnScreen after
both autosave-name assignments so a frame saved on a disconnected monitor
cannot restore the window off-screen.

* fix(macos): clear dashboard failure state when history restores a real document

Swipe-back/⌘[ off the failure page commits an http(s) document without
passing through load(); the flag previously stayed set and forced a reload
on the next native command.

* fix(macos): keep in-flight dashboard loads instead of restarting them

An open/update during the launch preload previously cancelled and restarted
the same-URL load; in-flight non-failure documents now count as usable in
the reload decision.

* fix(macos,ui): ⌘K legacy fallback + transient search param filtering

Command palette dispatch now sends a cancelable toggle event and falls back
to the shipped open-search event when no handler acknowledges it, so ⌘K
keeps working against older gateway-served bundles. Route memory strips
one-shot action params (?draft=) before persisting; navigation state like
?session= still restores.

* chore(i18n): register dashboard menu strings + drop unused route-memory export

native:i18n:sync inventory + per-locale artifacts for New Session / Command
Palette…; StoredNativeRoute is module-internal after the considerRouteRestore
refactor (deadcode exports gate).

* chore(i18n): rebaseline raw-copy for relocated lazy-element labels

The lazy-custom-element extraction moved three internal load-failure labels
out of app-host.ts; refresh the keyless raw-copy baseline to match (main's
new ui:i18n:verify gate).
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
… frame autosave, ⌘N/⌘K, route memory (openclaw#106997)

* feat(macos): native-feel dashboard hosting: instant reopen, preload, frame autosave, ⌘N/⌘K, route memory

The hosted Control UI dashboard now skips SPA reloads when reopening an
unchanged endpoint (auth-equality gated), preloads after launch when a
credentialed local/direct config exists, autosaves its window frame, maps
⌘N/⌘K menu items onto the shipped native web events, filters browser-tell
context-menu items, restores the last committed route via web-side
localStorage memory, and themes the pre-paint background.

* refactor(ui): satisfy TS LOC ratchet: move optional lazy-element helpers out of app-host

app-host.ts is over the 500-line ratchet ceiling and may not grow; move the
self-contained optional custom-element block into lazy-custom-element.ts (its
natural owner) and fold the route-restore decision into native-route-memory's
considerRouteRestore so the shell only replaces-or-persists.

* fix(macos): recover stuck dashboard command queue via deliverability gate

Replace the failure-page-only fast-path check with canDeliverNativeCommands
(live document or in-flight load); a terminally cancelled reload now falls
through to the reload path instead of queueing ⌘N/⌘K forever.

* fix(ui): let in-flight navigation win over native route restore

The one-shot startup restore now checks the rendered/pending match against
the committed bootstrap route; an explicit navigation already in flight
(replayed native new-session, fast click) is no longer clobbered.

* docs(ui): note idempotent collapse of pending native new-session replays

* fix(macos): drop queued dashboard commands on terminal load failure

Queued ⌘N/⌘K are moment-bound; surviving a failure page meant a later
recovery reload replayed stale commands (double palette toggle nets closed,
surprise navigation). Both failure entry points now clear the queue.

* fix(ui): persist native route memory only for settled router states

Mid-navigation emissions still carry the stale committed bootstrap route; an
interrupted restore could overwrite the remembered destination with it.

* fix(macos): coalesce dashboard opens for queued native commands

One in-flight open drains a manager-level queue in press order; a Task per
key press could race window creation (duplicate windows) and reorder ⌘N/⌘K
delivery on the non-immediate remote path.

* fix(macos): correct dashboard placement after frame-autosave restore

setFrameAutosaveName re-applies the stored frame; run ensureOnScreen after
both autosave-name assignments so a frame saved on a disconnected monitor
cannot restore the window off-screen.

* fix(macos): clear dashboard failure state when history restores a real document

Swipe-back/⌘[ off the failure page commits an http(s) document without
passing through load(); the flag previously stayed set and forced a reload
on the next native command.

* fix(macos): keep in-flight dashboard loads instead of restarting them

An open/update during the launch preload previously cancelled and restarted
the same-URL load; in-flight non-failure documents now count as usable in
the reload decision.

* fix(macos,ui): ⌘K legacy fallback + transient search param filtering

Command palette dispatch now sends a cancelable toggle event and falls back
to the shipped open-search event when no handler acknowledges it, so ⌘K
keeps working against older gateway-served bundles. Route memory strips
one-shot action params (?draft=) before persisting; navigation state like
?session= still restores.

* chore(i18n): register dashboard menu strings + drop unused route-memory export

native:i18n:sync inventory + per-locale artifacts for New Session / Command
Palette…; StoredNativeRoute is module-internal after the considerRouteRestore
refactor (deadcode exports gate).

* chore(i18n): rebaseline raw-copy for relocated lazy-element labels

The lazy-custom-element extraction moved three internal load-failure labels
out of app-host.ts; refresh the keyless raw-copy baseline to match (main's
new ui:i18n:verify gate).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos app: web-ui App: web-ui 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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant