Skip to content

feat(macos): add a --no-activate launch flag for background automation - #163758

Merged
steipete merged 1 commit into
mainfrom
steipete/mac-no-activate-launch
Oct 2, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/mac-no-activate-launch

Conversation

@steipete

@steipete steipete commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Automation launches of the macOS app steal focus while opening chat, dashboards, approvals, and overlays.

Solution

Parse --no-activate once in the launch plan and route app activation/window ordering through AppActivation. Automation windows use normal-level back ordering; existing attached sheets may become key inside the inactive app. Standalone confirmations use the existing alert presenter, preserving their response actions and accessory controls.

Defer interaction-requiring Keychain access, file dialogs, permission requests, WebKit media consent, update UI, and external navigation through existing recoverable errors/logs. Sparkle uses the existing disabled-updater implementation during automation. Legacy Keychain queries require process-wide interaction suppression before app initialization: query-only suppression does not protect legacy items. Preserve the flag on app-initiated relaunches.

SwiftLint supports scoped custom rules, so the activation-owner rule rejects direct activation/front-order calls outside the owner without adding a source-scanning test.

Impact

--no-activate --chat and --no-activate --dashboard support background Accessibility and window-ID capture. Normal launches keep their existing focus behavior. Operations needing deferred dialogs require relaunching without the flag, granting access, and retrying.

This is a behavior-only automation change, with no normal UI visual change; no screenshots are needed. The operator explicitly prohibited app/GUI/browser launches, so validation uses builds, source/API contract inspection, and pure tests instead of live desktop proof.

Evidence

  • Migrated direct focus/presentation calls: 72 → 0 outside the owner (19 app activations, 19 key/front calls, 7 unconditional front calls, 2 controller presentations, 3 deminiaturizations, 1 external paste-target activation, 5 Finder reveals, and 16 external opens). Also routed all 28 standalone modal-alert calls.
  • Native and plain OpenClaw builds; native test compilation.
  • 12 focused pure tests across activation, launch-plan parsing, and Keychain failure handling. The deny-default OS sandbox blocks operator files, desktop/preferences/Keychain services, networking, fork, and extra executables; negative controls verified those denials. Test runtime: 0.004 seconds; process wall time: 2.056 seconds.
  • Isolated native Security API probe: interaction setter/getter both return success and interaction remains disabled; no saved Keychain items were read.
  • Changed-file SwiftLint and SwiftFormat; custom-rule negative controls; native i18n verification; docs formatting; git diff --check.
  • Changed-check planning passed using the existing maintained tooling installation. Native UI-suite execution is left to CI; no app, GUI, or browser was launched locally.
  • Codex autoreview: scoped-clean at P0–P2 after fixing the Finder-activation finding and its sibling navigation paths.
  • Maintainer proof decision for ClawSweeper’s native-validation request and Rank-up move: accept the documented no-GUI validation scope for this opt-in flag, as required by the approved work order. Live app/AX/window-order proof is intentionally waived for this landing; it remains unverified, not claimed as passing. ClawSweeper found no introduced correctness or security defect. The source/API audit, builds, sandboxed pure tests, and CI are the accepted evidence.
  • Production: +552/−166 (net +386), providing the launch policy, activation owner, and required system/dependency deferrals. Tests: +261/−164 (net +97), including relocation of the existing Gateway setup suite; docs/tooling: +35. No runtime schema or persistent setting added.
Files with migrated focus calls

All paths below are in apps/macos/Sources/OpenClaw/:

AppNavigationActions.swift, ApplicationRelocator.swift, CanvasWindowController+Window.swift, ControlChannel.swift, DashboardAlertPresenter.swift, DashboardManager+Routes.swift, DashboardManager.swift, DashboardWindowController.swift, DebugActions.swift, DeviceSettingsPanels.swift, ExecApprovalsPromptPresenter.swift, GatewayBrowserOnboardingController.swift, NativeConversationView.swift, NotifyOverlay.swift, Onboarding.swift, OverlayPanelFactory.swift, PairingApprovalCenter.swift, PostUpdate.swift, QuickChatController.swift, QuickChatWindowPicker.swift, TalkOverlay.swift, VoiceWakeOverlayController+Window.swift, and WebChatSwiftUI.swift.

Additional external-navigation call sites: CanvasWindowController+Navigation.swift, ControlUIDocumentHost+NavigationPolicy.swift, DebugSettings.swift, GatewayBrowserSignInProgress.swift, NativeConversationBridge.swift, OnboardingAISetupSheet.swift, OnboardingAISetupView.swift, SessionActions.swift, SystemSettingsURLSupport.swift, and TailscaleService.swift. SwiftUI links in About, onboarding, and Tailscale views also use the policy.

Keep automation windows behind the active app through one focus owner. Defer interactive system dialogs and external navigation with recoverable existing errors and logs. Preserve normal launch behavior and document background Accessibility and window-ID capture.
@clawsweeper

clawsweeper Bot commented Oct 2, 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.

@steipete
steipete marked this pull request as ready for review October 2, 2026 20:05
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos size: XL labels Oct 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 4:25 PM ET / 20:25 UTC (Revision 2).

ClawSweeper review

What this changes

Adds a macOS --no-activate launch flag that keeps automation windows behind other apps and defers interactive dialogs and external navigation.

Merge readiness

✅ Ready for maintainer review

The PR remains useful and has no identified blocking correctness defect. The documented maintainer waiver resolves the previous native runtime proof request; desktop focus behavior remains explicitly unverified.

Priority: P2
Reviewed head: e2d0b851700f87ae411747efef2fbdb577b0d91c

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is coherent with no identified blocker; runtime confidence remains limited under the accepted proof waiver.
Proof confidence 🦐 gold shrimp (3/6) Override: The recorded maintainer decision waives live app/Accessibility/window-order evidence for this landing. Builds, sandboxed pure tests, and a Security API probe are supplemental evidence for AppActivation and launch-time interaction suppression; actual desktop focus remains unverified. No stored-data contract changes require migration proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Overridden Override: The recorded maintainer decision waives live app/Accessibility/window-order evidence for this landing. Builds, sandboxed pure tests, and a Security API probe are supplemental evidence for AppActivation and launch-time interaction suppression; actual desktop focus remains unverified. No stored-data contract changes require migration proof.
Evidence reviewed 9 items Pinned introduction inspected: Reviewed the merge-base-to-head introduced hunks, separating them from base-branch drift. The original head's raw commit records parent 72471f9.
Single activation owner: AppActivation preserves foreground calls when activation is allowed and otherwise orders windows at normal level behind other applications. Alert responses remain connected to their existing completion handlers.
Distinct capability absent from current main: Current main supports --background-only, which suppresses automatic presentation, but lacks the new activation policy that permits background chat/dashboard windows. No matching replacement appeared in the bounded recent-PR read.
Findings None None.
Security None None.

How this fits together

The macOS app translates launch arguments and navigation requests into native windows, permission prompts, and external application launches. The new activation owner applies the selected focus policy throughout the process.

flowchart TD
  A[Launch arguments] --> B[Launch policy]
  C[Chat and dashboard requests] --> D[Activation owner]
  B --> D
  D --> E[Normal foreground presentation]
  D --> F[Background window ordering]
  B --> G[Defer interactive system dialogs]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Docs +26, Other +492. Total +518 across 73 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 2 26 0 +26
Config 0 0 0 0
Generated 0 0 0 0
Other 71 822 330 +492
Total 73 848 330 +518

Review metrics

Metric Value Why it matters
Launch surface 1 new opt-in flag; 0 persisted settings Existing launches retain their activation default without a settings migration.
Production versus test growth production net +386; tests net +97 The body justifies production growth through the shared activation owner and system-dialog deferrals; test growth includes relocation of existing coverage.

Technical review

Best possible solution:

Keep background automation as an explicit process-level opt-in, with one activation owner and documented recovery for deferred interactions.

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

Not applicable as a new launch mode; source shows the existing foreground presentation paths, but desktop focus behavior was not exercised in this read-only review.

Is this the best way to solve the issue?

Yes. A shared activation owner addresses later window presentations that --background-only and launcher flags alone do not cover, while preserving the normal launch default.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded macOS automation improvement with an explicit opt-in and no demonstrated urgent regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Override: The recorded maintainer decision waives live app/Accessibility/window-order evidence for this landing. Builds, sandboxed pure tests, and a Security API probe are supplemental evidence for AppActivation and launch-time interaction suppression; actual desktop focus remains unverified. No stored-data contract changes require migration proof.

Evidence

What I checked:

  • Pinned introduction inspected: Reviewed the merge-base-to-head introduced hunks, separating them from base-branch drift. The original head's raw commit records parent 72471f9. (e2d0b851700f)
  • Single activation owner: AppActivation preserves foreground calls when activation is allowed and otherwise orders windows at normal level behind other applications. Alert responses remain connected to their existing completion handlers. (apps/macos/Sources/OpenClaw/AppActivation.swift:95, e2d0b851700f)
  • Distinct capability absent from current main: Current main supports --background-only, which suppresses automatic presentation, but lacks the new activation policy that permits background chat/dashboard windows. No matching replacement appeared in the bounded recent-PR read. (apps/macos/Sources/OpenClaw/AppLaunchPresentationPolicy.swift:143, e3df0defba44)
  • Latest release comparison: The launch policy in v2026.9.7 also lacks --no-activate; this is new functionality rather than a demonstrated shipped fix. (apps/macos/Sources/OpenClaw/AppLaunchPresentationPolicy.swift, c074824a27c9)
  • Accepted native proof scope: The captured PR body explicitly records acceptance of builds, source/API inspection, sandboxed pure tests, and CI for this opt-in flag, waiving live app/Accessibility/window-order proof for this landing. This directly disposes of the previous review's sole rank-up request. Repository State identifies the author as MEMBER; the live REST response reports CONTRIBUTOR, so the role discrepancy is retained rather than silently reconciled. (e2d0b851700f)
  • Documented opt-in limitations: The documentation states that permission requests, file dialogs, interactive Keychain operations, update dialogs, and external navigation are deferred, with relaunch-and-retry recovery. The accepted waiver covers the unchanged reviewed head; these limitations are not new unresolved acceptance requests. Public docs: docs/platforms/mac/webchat.md. (docs/platforms/mac/webchat.md:426, e2d0b851700f)

Likely related people:

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

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-10-02T20:11:44.605Z sha e2d0b85 :: blocked before merge. :: none

@steipete
steipete enabled auto-merge (squash) October 2, 2026 20:23
@steipete
steipete merged commit ad23b88 into main Oct 2, 2026
166 of 169 checks passed
@steipete
steipete deleted the steipete/mac-no-activate-launch branch October 2, 2026 20:38
@steipete

steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

vincentkoc added a commit that referenced this pull request Oct 2, 2026
* commit '79be075e5aa46be9e42dbd53ed6e30e81469210a': (33 commits)
  fix(ui): keep selected-text comment input readable while scrolling (#163772)
  test(memory): open corpus database explicitly
  fix: bound Doctor migration capture to plugin data (#163780)
  fix(ui): gate system information at the shared reader (#160982)
  chore(db): reclassify worker inventory sites with caller evidence (#163754)
  refactor(channels): deslop Slack and Matrix (#163740)
  fix(agents): reject empty sessions_search queries in the tool schema (#129120)
  perf(nodes): load only what a worker turn needs (#160442)
  test(cli): assert concise Gateway failure copy in CLI process tests (#163649)
  refactor(discord): deslop discord (#163728)
  fix(workboard): make Sessions boards work on multi-agent Gateways (#163761)
  test(gateway): add sustained heap retention diagnostics (#163764)
  test(ui): disambiguate session filter controls
  refactor(plugins): deslop imessage, mattermost, and voice-call (#163767)
  fix(qa): run Telegram plugin source in --source-gateway userbot runs (#163718)
  feat(macos): add a --no-activate launch flag for background automation (#163758)
  fix(agents): preserve host authority across module reloads (#163725)
  perf(gateway): serve the listener before multi-gigabyte store validation and honor clean-close receipts at startup (#163690)
  fix: keep video widgets scrollable and preload initial frames (#163762)
  feat(memory): add a provider-neutral memory provider runtime (#162175)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
openclaw#163758)

Keep automation windows behind the active app through one focus owner. Defer interactive system dialogs and external navigation with recoverable existing errors and logs. Preserve normal launch behavior and document background Accessibility and window-ID capture.
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 3, 2026
* commit '1fda703fb4d3630e4633461967b2a2186e8f15fd': (33 commits)
  fix(ui): keep selected-text comment input readable while scrolling (openclaw#163772)
  test(memory): open corpus database explicitly
  fix: bound Doctor migration capture to plugin data (openclaw#163780)
  fix(ui): gate system information at the shared reader (openclaw#160982)
  chore(db): reclassify worker inventory sites with caller evidence (openclaw#163754)
  refactor(channels): deslop Slack and Matrix (openclaw#163740)
  fix(agents): reject empty sessions_search queries in the tool schema (openclaw#129120)
  perf(nodes): load only what a worker turn needs (openclaw#160442)
  test(cli): assert concise Gateway failure copy in CLI process tests (openclaw#163649)
  refactor(discord): deslop discord (openclaw#163728)
  fix(workboard): make Sessions boards work on multi-agent Gateways (openclaw#163761)
  test(gateway): add sustained heap retention diagnostics (openclaw#163764)
  test(ui): disambiguate session filter controls
  refactor(plugins): deslop imessage, mattermost, and voice-call (openclaw#163767)
  fix(qa): run Telegram plugin source in --source-gateway userbot runs (openclaw#163718)
  feat(macos): add a --no-activate launch flag for background automation (openclaw#163758)
  fix(agents): preserve host authority across module reloads (openclaw#163725)
  perf(gateway): serve the listener before multi-gigabyte store validation and honor clean-close receipts at startup (openclaw#163690)
  fix: keep video widgets scrollable and preload initial frames (openclaw#163762)
  feat(memory): add a provider-neutral memory provider runtime (openclaw#162175)
  ...
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 P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant