Repository navigation
improve(macos): replace browser cookie-import modal with an inline dashboard banner - #104591
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c3dbd3a47
ℹ️ 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".
| : "System browser profile import is disabled in the local Gateway configuration." | ||
| return .unavailable(title: "No browser login available", message: message) | ||
| } | ||
| self.phase = .offering(status) |
There was a problem hiding this comment.
Recheck mode before publishing refresh results
When a launch/connect/window refresh starts in Local mode and the user switches to Remote before /system-profile-import/status returns, handleConnectionModeChange() hides the banner but this stale continuation still publishes .offering(status). The callers can overlap (MenuBar.swift:83, MenuBar.swift:450, DashboardWindowController.swift:277), and importProfile only checks for .offering, so the remote dashboard can show a host-local import offer and allow the import action after the gateway switch. Recheck isLocalMode() or a refresh generation after the await before setting phase.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c6c7b8ba1e
ℹ️ 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".
| : "System browser profile import is disabled in the local Gateway configuration." | ||
| return .unavailable(title: "No browser login available", message: message) | ||
| } | ||
| self.phase = .offering(status) |
There was a problem hiding this comment.
Preserve in-flight import state before re-offering
When the Settings Import… button calls refresh(force: true) while a banner import is already in .importing, this continuation can publish a new .offering after the status GET returns, replacing the progress/result banner and re-enabling the Import control while the first /profiles/import request is still in flight. Fresh evidence beyond the existing remote-mode race is the new force path in GeneralSettings.swift:128, which has no phase guard; the deleted prompter's isPrompting kept this path blocked until the import finished.
Useful? React with 👍 / 👎.
|
Codex review: stale review; fresh review needed. Summary Next step Review history (2 earlier review cycles)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 358af1eab1
ℹ️ 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.phase = .imported(result) | ||
| } catch { | ||
| self.phase = .failed(message: error.localizedDescription, retry: status) |
There was a problem hiding this comment.
Drop stale import results after mode switches
When the user starts an import in Local mode and switches to Remote before the 120s /profiles/import call returns, handleConnectionModeChange() has already hidden the local-only banner, but this continuation unconditionally republishes .imported/.failed. The dashboard can then show a host-local import result or retry while connected to a remote Gateway; recheck isLocalMode() or a request generation before setting phase.
Useful? React with 👍 / 👎.
| title: "Use your browser logins", | ||
| subtitle: "Copy cookies from \(browsers) into an isolated agent profile. " + | ||
| "Passwords are never touched.", |
There was a problem hiding this comment.
Localize banner copy before rendering from strings
This new banner copy is kept as plain String fields and rendered later via Text(content.title)/Text(content.subtitle), so SwiftUI treats it as verbatim and scripts/native-app-i18n.ts does not put strings like Use your browser logins in apps/.i18n/native-source.json. In localized macOS builds the inline banner stays English even though this replaces a localized alert; wrap the copy in String(localized:)/LocalizedStringResource or otherwise feed it to the native i18n pipeline.
Useful? React with 👍 / 👎.
…shboard banner (openclaw#104591) * feat(macos): replace browser cookie-import modal with dashboard banner * fix(macos): cross-browser menu identity, banner pane ownership, docs map * chore: refresh native i18n inventory * fix(macos): stale import status polls no longer clobber fresher banner state * fix(macos): generation-guard stale import polls; drop dashboard-show poll trigger * fix(macos): session-sticky dismissal and localized banner copy
Closes #104588
What Problem This Solves
The macOS app offered the browser cookie import (from #104057) through a blocking
NSAlertthat fired a few seconds after launch and again on control-channel connect. The modal stole focus from whatever the user was doing, buried import progress and results in follow-up alerts, and looked heavyweight for an optional offer.Why This Change Was Made
An inline, dismissible banner is the established pattern for "import data from your browser" offers in desktop apps with a built-in browser. Moving the offer into the dashboard window keeps it discoverable without interrupting, and lets the same card show progress, the imported-cookie count, and errors inline instead of via stacked alerts.
User Impact
/system-profile-import/dismissendpoint and sticks for the session even if the write is slow or lost; automatic status polls can never resurrect a dismissed offer or clobber a fresher banner state (generation-guarded).String(localized:)and tracked in the native i18n inventory.Screenshots
Placement in the dashboard window (floating, centered, below the titlebar chrome):
(Captured via a headless window harness; the Import button renders with its accent tint and the real app icon in the live app.)
Evidence
BrowserProfileImportPrompter(modalNSAlert+ popup picker + result alerts) is replaced byBrowserProfileImportModel, an@Observablestate machine (hidden → offering → importing → imported/failed) with an injectable transport, plusBrowserProfileImportBannerView(SwiftUI) hosted in the dashboard pane.menuID), a phase-generation guard so stale status polls never clobber or resurrect user-driven state, and session-sticky dismissal (force refresh still overrides). Each has a dedicated regression test.swift test --package-path apps/macos --filter BrowserProfileImport: 15 tests pass (offer gating, refresh outcomes, import success/failure/retry, dismissal persistence/suppression, stale-poll races, banner copy/actions).swift test --package-path apps/macos --parallel: 1039 tests, 133 suites, all pass locally; hosted CI green on this branch.swiftformat --lintandswiftlint(CI config) clean;pnpm native:i18n:checkclean after inventory sync;pnpm docs:map:genrefreshed.docs/platforms/macos.md.