Skip to content

refactor(macos): deslop macOS app - #158516

Merged
steipete merged 5 commits into
mainfrom
deslop/l62-macos
Sep 26, 2026
Merged

steipete merged 5 commits into
mainfrom
deslop/l62-macos

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

This maintainer-directed macOS sweep (lane l62) reduces repeated command parsing, connection bookkeeping, native menu plumbing, and value-copying code across related paths.

User Impact

The refactor preserves rendering, user-visible strings, Gateway wire behavior, authentication/pairing, Keychain and permission flows, persisted state, public URLs, and update configuration. No dependencies or shared Apple sources change.

Malformed CLI output containing a closing brace before an opening brace now falls back to normal diagnostic handling instead of crashing the app's JSON extractor.

Why This Change Was Made

  • Use canonical exec command resolution, cwd/argv hashing, env-option parsing, and login/interactive option scanning; retain unchanged allowlist fields while normalizing values.
  • Reuse shared socket-generation, discovery, JavaScript encoding, and payload-decoding helpers; remove retired status/port readers and equality-only test seams.
  • Give Quick Chat menu items one action-lifetime owner, and unify window/area capture settlement while retaining their different visibility timing.
  • Consolidate dashboard message forwarding, script refresh, and local-window configuration without changing registered bridge names or content worlds.
  • Remove redundant onboarding and voice state; reuse existing receipt and permission owners.

Fixes found along the way

The CLI JSON extractor selected the first opening brace and last closing brace without checking their order. A reversed pair constructed an invalid Swift range. The regression covers malformed output and retained noisy service-error extraction.

Compatibility boundary

The update controller, node-service runner, launchd parsing, process environment helpers, runtime lookup, Gateway process manager, and their coupled app-state/command-resolution helpers are unchanged from the main base. The preference-selection path is also unchanged. Their optional cleanup was removed to keep the installed-update path outside this PR. Persisted keys and formats remain unchanged; the retained onboarding receipt cleanup preserves decoded values and serialized keys.

Evidence

Production: 1,134 net lines removed, counting production sources only and excluding Tests and generated code.

Blacksmith Testbox tbx_01m3dvq4xbx6fkmkrx0gh2375q (run) passed node scripts/check-changed.mjs with all then-changed paths, pnpm native:i18n:verify (4,055 entries, unchanged), and pnpm protocol:check:swift on the rebased source. The changed gate ran macOS packaging/lifecycle TypeScript tests in 143.90 seconds. The final scope reductions restore update/service-facing files to that tested main base. All five generated Mermaid resources match a fresh remote build. The lease is stopped.

The parser regression trapped on the original code with Range requires lowerBound <= upperBound (exit 132), then passed both Swift Testing tests, including five malformed-output arguments, on the fixed source. Isolated Foundation swift test wall time was 4.913 seconds including compilation; test execution was 0.001 seconds. The same test file is in the native target.

Apple proof ran locally under the explicit exception, sequentially with nice -n 10 and two jobs. The CLI build passed. The full app rebuild after the scope reduction passed in 128.34 seconds. Native test compilation passed after the final lifecycle scope reduction in 315.29 seconds. --disable-build-manifest-caching corrects SwiftPM's stale source list after a rebase. No app or full native suite ran against operator state. The full suite ran on disposable hosted macOS CI.

nice -n 10 swift build --package-path apps/macos --build-system native --disable-build-manifest-caching --product OpenClaw --jobs 2
nice -n 10 swift build --package-path apps/macos --build-system native --disable-build-manifest-caching --build-tests --jobs 2

Exact-head hosted CI passed on 40976f8821be71bc7bdcfb8698ef5b4a80f2dc7d, including both macOS jobs and the required CI gate. The native test job took 696 seconds including build and the full suite. Earlier validation found two closure-layout lint violations and a non-Sendable menu capture. The fixes preserve layout and carry cancellation through a MainActor-bound Sendable function. No unchecked conformance or suppression was added.

Independent Codex reviews cover the complete refactor and the focused formatting, actor-isolation, and scope-reduction corrections. No accepted actionable findings remain. The initial full review's two claims were rejected against the existing owners: TalkStopReason has only speech/userTap/manual cases, and the Tailscale snapshot initializer already trims passwords.

ClawSweeper's review of the final head reports no actionable findings, no security issues, and no before-merge items. It confirms that the update/service owners behind the earlier compatibility concern are no longer in the patch. This PR remains unmerged for the maintainer handoff.

Remote lease history

All leases used Blacksmith Testbox and are stopped. tbx_01m3d8sm7773d3s4r8swm2rx2b passed the initial localization check, then expired during source preparation. tbx_01m3ddt2w4kt0kvemr53cjybb3 passed the original-failing/fixed-passing Swift parser regression, localization, protocol drift, and changed-file checks. tbx_01m3dvq4xbx6fkmkrx0gh2375q refreshed the rebased-source checks and generated-resource hashes; one harness assertion incorrectly expected the source commit in HEAD rather than the wrapper's transport carrier, and was corrected to check the source bytes while retaining the wrapper's complete source verification.

@clawsweeper

clawsweeper Bot commented Sep 26, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 1:21 AM ET / 05:21 UTC (Revision 7).

ClawSweeper review

What this changes

The branch simplifies macOS Gateway, dashboard, Quick Chat, capture, onboarding, and voice code, and guards JSON extraction against malformed CLI output.

Merge readiness

✅ Ready for maintainer review

Keep open. Current main and the latest release lack the malformed-output crash guard, and this branch remains distinct useful work. I found no actionable defect in the reviewed head.

Priority: P2
Reviewed head: 40976f8821be71bc7bdcfb8698ef5b4a80f2dc7d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused crash coverage and exact-head native validation, with no concrete correctness or security blocker found.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: Repository State identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. The changed extractor feeds launch-agent CLI diagnostics; the PR reports an original-trap/fixed-pass Swift regression and exact-head macOS CI, but no app interaction. Inspected persisted forms and keys remain unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository State identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. The changed extractor feeds launch-agent CLI diagnostics; the PR reports an original-trap/fixed-pass Swift regression and exact-head macOS CI, but no app interaction. Inspected persisted forms and keys remain unchanged.
Evidence reviewed 10 items Introduced parser guard: The PR checks brace order before constructing the Swift substring range.
Current-main behavior: The fetched main revision still slices from the first opening brace through the last closing brace without checking their order.
Latest-release behavior: Release v2026.9.6 also has the unchecked substring range.
Findings None None.
Security None None.

How this fits together

The macOS app receives Gateway messages, CLI output, and local device events. Its native services turn those inputs into connection state, dashboard and chat interactions, device actions, and diagnostics.

flowchart LR
A[Gateway messages and CLI output] --> C[macOS app services]
B[Local devices and permissions] --> C
C --> D{Parse and route}
D --> E[Dashboard and Quick Chat]
D --> F[Native actions and diagnostics]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Other -1226. Total -1226 across 69 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 69 531 1757 -1226
Total 69 531 1757 -1226

Review metrics

Metric Value Why it matters
Parser regression cases 5 malformed inputs, 1 noisy service error The focused test covers both the crash input and retained diagnostic extraction.

Technical review

Best possible solution:

Keep the simplified native owners and the brace-order guard while preserving existing settings, bridge contracts, and approval checks.

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

Yes for the included crash: reversed braces reach an unchecked Swift range on current main. The broader refactor is cleanup rather than a separate bug reproduction.

Is this the best way to solve the issue?

Yes. The range guard belongs at the extractor, and the consolidation generally reuses existing native owners without adding a competing contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded native cleanup with a concrete malformed-output crash fix and limited user impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository State identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. The changed extractor feeds launch-agent CLI diagnostics; the PR reports an original-trap/fixed-pass Swift regression and exact-head macOS CI, but no app interaction. Inspected persisted forms and keys remain unchanged.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Avant: 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 (6 earlier review cycles)
  • reviewed 2026-09-26T01:10:10.755Z sha a7386fd :: blocked before merge. :: none
  • reviewed 2026-09-26T01:17:47.354Z sha a7386fd :: blocked before merge. :: none
  • reviewed September 25, 2026, 11:42 PM ET / September 26, 2026, 03:42 UTC (Revision 3) sha unknown :: blocked before merge. :: none
  • reviewed 2026-09-26T04:24:12.673Z sha a7c5f2f :: blocked before merge. :: none
  • reviewed 2026-09-26T04:30:53.478Z sha a7c5f2f :: blocked before merge. :: none
  • reviewed 2026-09-26T05:03:01.825Z sha 40976f8 :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as ready for review September 26, 2026 01:12
@steipete

Copy link
Copy Markdown
Contributor Author

The optional PostUpdate.swift and OnboardingView+Actions.swift edits have been removed. Both files now match the pinned main base byte-for-byte, so this PR no longer changes the macOS update/repair controller or the preference-selection path cited in the compatibility note. The remaining receipt cleanup preserves decoded values and serialized keys.

The complete app build and native test compilation passed after the scope reduction. The prior reviewed head passed both hosted macOS jobs and the required CI gate; the final head is being checked. The PR body records the compiler/lint corrections, original-failing parser regression, unchanged localization, protocol check, and remote changed-file gate.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 26, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

The node-service runner and its update-facing dependencies are now unchanged from the base: NodeServiceManager.swift, Launchctl.swift, ShellExecutor.swift, BoundedProcess.swift, RuntimeLocator.swift, GatewayProcessManager.swift, CommandResolver.swift, and AppState.swift. PostUpdate.swift and OnboardingView+Actions.swift were already removed from the diff. These restores are byte-for-byte from the pinned main base.

The remaining parser guard is independently proven against malformed output, and the app rebuild passed after the scope reduction. There is no changed restart/status/update control path in those owners. The PR body records this boundary and the retained proof; final native CI is being refreshed.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Sep 26, 2026
@steipete
steipete enabled auto-merge (squash) September 26, 2026 07:32
@steipete
steipete merged commit 79423f7 into main Sep 26, 2026
92 of 94 checks passed
@steipete
steipete deleted the deslop/l62-macos branch September 26, 2026 07:32
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
* refactor(macos): deslop macOS app

* style(macos): align closure captures with opening braces

* fix(macos): isolate model menu invalidation on MainActor

* refactor(macos): leave upgrade and preference paths unchanged

* refactor(macos): preserve installed service lifecycle owners
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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