Skip to content

refactor(macos): deslop macOS app second pass - #159031

Merged
steipete merged 4 commits into
mainfrom
deslop/l91-macos2
Sep 26, 2026
Merged

steipete merged 4 commits into
mainfrom
deslop/l91-macos2

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The macOS app still carried duplicated internal parsing, lifecycle, and projection code after the first cleanup pass. This second pass removes 1,074 net production lines while preserving its existing boundaries.

User Impact

Voice Wake now sends the text edited in its transcript overlay; clearing that text dismisses the request instead of sending the original recognition. The remaining changes preserve behavior and appearance. Gateway wire behavior, auth/pairing, Keychain and permission flows, persisted formats, bundle/entitlement/update configuration, URL schemes, and dependency versions are unchanged.

Why This Change Was Made

This pass follows #158516 and keeps one existing owner for each shared operation:

  • Gateway and CLI: share token/password precedence while retaining their different warning rules; reuse normalized remote reads and operator scopes; build endpoints once; dispatch Wizard frames through the captured socket; remove two unused project-root forwarding methods.
  • Node catalogs and workers: keep Codex pages typed through transcript eligibility; reuse closed-object admission; remove validation already performed by the owner; share input/cancel framing, observer registration, and existing location timeout handling.
  • Execution and camera capabilities: reuse the canonical env parser with the validator's existing empty-argument behavior, share shell-display preparation and subprocess environment conversion, synthesize prompt initialization, and share PTZ angle planning. Remove the unused aggregate UVC parser and test the parser actually used by IOKit.
  • Voice and audio: share Core Audio listener ownership, construct route-suppression results once, reuse normalization/cancellation/speech-request owners, remove forwarding wrappers and the duplicate source enum, and share TTS fallback handling.
  • Quick Chat and menus: share popup interaction cleanup, reply-view-model construction, presentation reset, session-action completion, and identical WebKit observations; remove redundant marked-text gating and handwritten descriptor initialization.
  • Canvas: remove the titled window path that had only a test caller, retaining the production anchored panel.
  • App state and onboarding presentation: share identical SSH normalization, enabled-default loading, remote transport writes, and step projection while retaining route-conflict checks. Persisted onboarding receipts are unchanged.

Fixes found along the way

The overlay's edit callback previously updated only presentation state, while Send read a separate coordinator transcript. Edits now update the matching session token. The regression exercises the actual edit/send callbacks and checks that cleared input dismisses without forwarding stale text.

Installed update, app relocation/relaunch, managed Gateway recovery, launchd lifecycle, worker restart policy, and persisted activation receipt changes are excluded. Those owners retain the base implementation. No published-app upgrade behavior is changed or claimed by this PR.

Evidence

Final head: f2949d587ca8b155bd89a70d3af4110469cb2abd. The exact-head CI run passed, including openclaw/ci-gate, localization, all three macOS Node lanes, Swift package tests, and native app tests. Native CI passed 2,296 Swift Testing tests across three isolation partitions, plus the XCTest partition. The native job took 901 seconds; the Swift Testing partitions took 264.134 seconds. Final macOS Periphery also passed.

All local Apple builds ran at nice -n 10, one at a time:

  • swift build --package-path apps/macos --build-system native --product OpenClaw --jobs 4 --disable-automatic-resolution passed (1,755.24 seconds wall).
  • Final-head swift build --package-path apps/macos --build-system native --build-tests --jobs 4 --disable-automatic-resolution passed (846.14 seconds wall), rebuilding both app and tests.
  • xcodebuild -scheme openclaw-mac -configuration Debug -destination platform=macOS -jobs 2 -skipPackageUpdates -disableAutomaticPackageResolution build passed, including discovery (576.03 seconds wall).
  • Final-head xcodebuild -scheme OpenClaw -configuration Debug -destination platform=macOS -jobs 4 -skipPackageUpdates -disableAutomaticPackageResolution build passed (1,233.88 seconds wall).

An audited OS-sandboxed subset passed 73 tests in eight suites on the final head (0.561 seconds test runtime, 9.60 seconds process wall). The new Voice Wake regression took 0.495 seconds, with no timer or network dependency. Removing only the edit-to-coordinator call made that same test fail with recognized words instead of corrected words; restoring the exact candidate bytes made it pass again. This exercises the real edit/request-send callback boundary and empty-text dismissal. No live Gateway delivery or GUI recording is claimed. Operator files, preferences, Keychain services, network access, and helper execution were blocked by the test sandbox.

Blacksmith Testbox tbx_01m3f9m3g0j6mwh3sqs2q2791e verified source f2ae76d05ecb72533c2b04cdabe3910386b92c3f and passed pnpm install --frozen-lockfile, pnpm protocol:check:swift, pnpm native:i18n:verify, 13 explicitly selected import-boundary files (including src/infra/fs-safe-import-boundary.test.ts and the Gateway entry point), and node scripts/check-changed.mjs. The remote run took 464.766 seconds for the command; the lease is stopped. Subsequent changes only fixed Swift lint or removed installer/lifecycle refactors; the tested TypeScript and import contracts are unchanged.

Independent autoreview completed with no accepted findings. Three normalization findings in the initial review were rejected after checking that canonical String.nonEmpty trims whitespace/newlines and returns nil for blank strings. The lint repairs and final scope narrowing each passed fresh scoped review through P2. Two initial CI runs exposed SwiftLint closure-layout/fallthrough issues; these were repaired, and the final run is green.

The final shared Periphery run separately reports exactly the existing ChatScrollCommand.Request.id nonce. Synthesized equality uses it to distinguish same-target requests; deleting it would change behavior. Its explicit-identity repair is already owned by #158587. This PR leaves shared/iOS code and Periphery retain/baseline policy untouched.

Production count excludes Tests/ and generated sources: +723 / -1,797 = 1,074 net lines removed. Tests: +76 / -93 = 17 net lines removed. No changes to apps/shared, apps/ios, SwiftPM manifests, lockfiles, or generated localization inventory.

Consolidate existing parser, projection, lifecycle, and update owners while retaining wire, credential, permission, and persisted-state contracts. Fix Voice Wake sending the original recognition after transcript edits; bind edited text to the current coordinator session.
@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. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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, 4:13 PM ET / 20:13 UTC (Revision 5).

ClawSweeper review

What this changes

The branch consolidates duplicated macOS app and CLI code and makes Voice Wake send text edited in its transcript overlay.

Merge readiness

✅ Ready for maintainer review

Current main still has the Voice Wake edit-and-send defect, and the merged first cleanup pass does not contain this repair. The final scoped branch has no confirmed blocking finding.

Priority: P2
Reviewed head: f2949d587ca8b155bd89a70d3af4110469cb2abd

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The narrowed patch has focused negative-control coverage and successful exact-head native validation, with no confirmed blocker.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The host identifies the author as MEMBER, so the external-contributor proof gate does not apply. The production path is overlay edit to coordinator Send; the PR reports a failing-before and passing-after sandboxed callback test, without claiming live app or Gateway delivery. No stored-data contract changes were identified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The host identifies the author as MEMBER, so the external-contributor proof gate does not apply. The production path is overlay edit to coordinator Send; the PR reports a failing-before and passing-after sandboxed callback test, without claiming live app or Gateway delivery. No stored-data contract changes were identified.
Evidence reviewed 9 items Current-main defect: At the fetched main revision, the overlay edit callback updates presentation text without updating the coordinator transcript that Send reads.
Introduced repair: The overlay edit callback now updates the coordinator session identified by the active token before the existing send path reads that text.
Regression coverage: The native test edits the transcript, checks coordinator state, clears the text, and requests Send; the PR body reports that removing the new coordinator update makes this test fail.
Findings None None.
Security None None.

How this fits together

The macOS app receives speech transcripts, local settings, and Gateway events, then presents native controls and sends actions to the Gateway. This change affects the native state between those inputs and their outgoing actions.

flowchart LR
  A[Voice recognition] --> B[Editable transcript]
  B --> C[Session coordinator]
  C --> D[Gateway message]
  E[Local settings] --> F[Mac connection]
  F --> D
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Other -1091. Total -1091 across 68 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 68 798 1889 -1091
Total 68 798 1889 -1091

Review metrics

None.

Technical review

Best possible solution:

Keep the coordinator as the send-state owner, with overlay edits synchronized by session token and installed lifecycle behavior left to its existing owners.

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

Yes, from source: current main changes overlay text while Send reads separate coordinator text. The PR reports a native callback regression that fails when the repair is removed; this review did not run the app.

Is this the best way to solve the issue?

Yes. Updating the token-matched coordinator session from the overlay callback repairs the existing send path without adding another delivery owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded macOS cleanup with a user-visible Voice Wake correction and limited platform blast radius.
  • 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: The host identifies the author as MEMBER, so the external-contributor proof gate does not apply. The production path is overlay edit to coordinator Send; the PR reports a failing-before and passing-after sandboxed callback test, without claiming live app or Gateway delivery. No stored-data contract changes were identified.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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)

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 (4 earlier review cycles)
  • reviewed 2026-09-26T16:35:53.235Z sha f2ae76d :: blocked before merge. :: none
  • reviewed 2026-09-26T16:51:08.702Z sha f2ae76d :: blocked before merge. :: none
  • reviewed 2026-09-26T19:09:45.823Z sha 7aa0e34 :: blocked before merge. :: none
  • reviewed 2026-09-26T19:37:01.018Z sha f2949d5 :: blocked before merge. :: none

@steipete
steipete marked this pull request as ready for review September 26, 2026 16:43
Use explicit multi-closure labels, share speech fallback and phase cleanup without fallthrough, and delete unused Gateway project-root forwarding methods. Independent scoped review found no actionable issues.
@clawsweeper clawsweeper Bot removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Sep 26, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The final head is f2949d5. Installer/update, relocation/relaunch, managed Gateway recovery, launchd lifecycle, restart policy, and persisted activation receipt changes have been removed. Those implementations match the base revision; the only remaining GatewayProcessManager change deletes two unused forwarding methods.

The PR body now records passing final-head CI and native tests, both Xcode builds, and a real callback-boundary negative control: removing only the overlay-to-coordinator update makes the new regression fail with the original recognized text; restoring it passes. The final audited sandbox run passed 73 tests. No live Gateway delivery or native GUI recording is claimed. Stored formats, auth, permissions, wire behavior, and dependency versions are unchanged.

Please refresh the review against this final scope and evidence. Review only; do not merge or start repair.

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit f72bb2c into main Sep 26, 2026
83 of 84 checks passed
@steipete
steipete deleted the deslop/l91-macos2 branch September 26, 2026 20:22
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
* refactor(macos): deslop macOS app second pass

Consolidate existing parser, projection, lifecycle, and update owners while retaining wire, credential, permission, and persisted-state contracts. Fix Voice Wake sending the original recognition after transcript edits; bind edited text to the current coordinator session.

* refactor(macos): align cleanup with native lint

Use explicit multi-closure labels, share speech fallback and phase cleanup without fallthrough, and delete unused Gateway project-root forwarding methods. Independent scoped review found no actionable issues.

* style(macos): align session action arguments

* refactor(macos): keep installed lifecycle outside cleanup scope
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