Skip to content

refactor(macos): consolidate native app state and handlers - #166558

Merged
steipete merged 2 commits into
mainfrom
deslop/d09-macos-app-20261007
Oct 7, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/d09-macos-app-20261007

Conversation

@steipete

@steipete steipete commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The macOS companion repeats validation, lifecycle bookkeeping, and per-variant handlers across its native features. This maintainer-requested cleanup reduces that duplication without retiring those features.

User Impact

No intended change to features, visual appearance, user-visible text, CLI flags, configuration, protocol payloads, or persisted data. No migration or operator action is required.

Why This Change Was Made

Shared paths now carry their real differences explicitly: catalog validation rules, voice capture modes, socket startup settlement, native action dispatch, and presentation descriptors. State already owned by a task, capture, or parsed configuration is derived from that owner instead of copied into parallel flags. Authority checks, recovery, retry timing, and teardown ordering remain at their existing boundaries.

The file-by-file implementation pass removes 1,399 net production lines (1.38%), including new helpers; tests, fixtures, generated output, and static resources are excluded. Native fallback and the current catalog configuration contract are retained. Existing localization keys and translation memory are unchanged.

Evidence

  • Swift app and complete native test bundle compile successfully with the supported native build command. Disposable macOS CI passed all 2,519 app tests on exact rebased head d8528ffd5496bc67d7723feb539b76882743fb32; the shared-package job also passed. The app test partitions took 260.446s, 7.610s, and 16.250s, excluding compilation.
  • Pinned SwiftFormat, strict SwiftLint, native localization verification, and whitespace checks pass.
  • Runtime import cycles: 0. Full static import cycles: 0.
  • Lint-suppression tests: 3/3 pass; 40.06 seconds wrapper wall time on the rebased head.
  • Independent review: no accepted/actionable P0–P2 findings across both complete review passes.
  • Changed-file checks passed on Blacksmith Testbox, including eight macOS script Vitest shards (96.44 seconds). The one-shot lease stopped cleanly. This proof covers the original consolidation commit. The complete changed-file gate also passed locally on pre-rebase head 747c9c1c50b7c3670d70b7e4ad9d4fb6dea2a880, including Darwin-specific cases; its three script groups took 398.53s, 630.66s, and 754.55s.

Existing tests were retained. Test changes only replace removed internal constructor fields, property accesses, and one-shot test seams with the retained production owner; assertions and cleanup remain intact.

The conflict-only rebase preserves main's canonical configuration repair #166510 within the shared validator. Its new regression assertions remain unchanged. The rebased head passes native app/test compilation (333.63s), full locale parity, formatting, lint, both zero-cycle checks, suppression tests, and two fresh independent review passes.

Landing and CI attribution

Merged by coordinator-authorized admin squash as cb04039f21de4a3183fa3c2af8bd2f567478e327, verified on origin/main. Reviewed/tested head: d8528ffd5496bc67d7723feb539b76882743fb32. Landed reduction remains 1,399 net production LOC.

Complete landing evidence records the concrete native-source path independence, both targeted reruns, every failing job and independent match, all 33 historical failed check-run IDs, and the historical cancelled-context replacement.

Doctor's single authorized rerun passed the exact Doctor-progress case and the complete job (169 passed, 12 existing platform skips). UI's single authorized rerun passed both desktop carriers and all 19 real-Gateway tests in 15 files. Neither job builds or loads a changed Swift/Objective-C file, macOS app, or shared Swift package. The native-protocol step emits ignored Swift text from unchanged TypeScript inputs; it does not compile native code.

Final main-tier attempt 3: 136 successful, 10 failed, 12 skipped jobs. The remaining failures are nine independently matched, unchanged Node/UI roots plus their aggregate. The exhaustive all-attempt census has zero pending checks and no effective cancellation gap; one historical cancelled context job has a verified successful replacement. The original failures remain recorded, and passing reruns are not claimed as source fixes.

No unrelated main-red sources, assertions, timeouts, retries, skips, or suppressions changed in this PR.

@clawsweeper

clawsweeper Bot commented Oct 7, 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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 7, 2026, 9:43 AM ET / 13:43 UTC (Revision 5).

ClawSweeper review

What this changes

The macOS companion shares repeated configuration validation, speech capture resources, socket lifecycle bookkeeping, and native handlers while deriving temporary state from its existing owners.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: this useful consolidation remains distinct from the merged configuration repair, and no concrete introduced correctness defect was found. The previous compatibility concern is resolved by source comparison.

Likely related people: steipete (high-confidence routing) and Vincent Koc (medium-confidence voice-lifecycle routing).

Priority: P3
Reviewed head: d8528ffd5496bc67d7723feb539b76882743fb32

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent consolidation with exact-head native validation and no supported blocking patch finding; the recorded CI landing hold is assessed separately.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository administrator's internal refactor is exempt from ordinary external-contributor runtime proof. Exact-head native CI supplements the source review; no material authority change requires exceptional final-effect proof. Persisted keys, record shapes, defaults, and legacy handling remain equivalent, establishing the no-migration case.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified repository administrator's internal refactor is exempt from ordinary external-contributor runtime proof. Exact-head native CI supplements the source review; no material authority change requires exceptional final-effect proof. Persisted keys, record shapes, defaults, and legacy handling remain equivalent, establishing the no-migration case.
Evidence reviewed 10 items Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced hunks. The recorded test merge has exactly the pinned base parent followed by the reviewed head; unrelated base changes are not attributed to this PR.
Configuration compatibility concern resolved: The shared validator retains catalog enablement independent of supervision, explicit opt-out, strict object keys, required nonblank home paths, SecretInput validation, accepted options, and rejection of retired options. Comparison with fetched main establishes a refactoring of the same contract rather than a new default.
Existing-state compatibility: Preference assignments retain their keys and values. Onboarding record handling preserves current records and the existing legacy-owner stripping behavior; serialization retains the same keys and omission of absent optional values. Update receipts and approval-store updates retain their persisted contracts. No new stored model or migration requirement was identified.
Findings None None.
Security None None.

How this fits together

The macOS companion connects local device capabilities and native controls to the selected OpenClaw Gateway. Its configuration readers, lifecycle owners, and handlers translate user actions and Gateway requests into native operations and status updates.

flowchart LR
  A[Native controls] --> C[Shared state and handlers]
  B[Local configuration] --> C
  D[Gateway requests] --> C
  C --> E[Lifecycle and authority checks]
  E --> F[Device operations]
  E --> G[Gateway replies and native status]
Loading

Before merge

  • Complete next step (P2) - Resolve or independently attribute the desktop node-admission rejection and doctor-progress duration failure before using the inherited-failure landing exception.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: apps/macos/Sources/OpenClaw/CLIInstallPrompter.swift, unknown-truncated-pull-files. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep the shared native owners while preserving configuration acceptance, native fallback, persisted preferences, and teardown ordering.

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

Not applicable: this PR consolidates existing behavior, and source inspection found no concrete introduced failure to reproduce.

Is this the best way to solve the issue?

Yes: shared lifecycle and validation owners remove duplicate bookkeeping while retaining the existing contracts; the earlier blanket compatibility follow-up is no longer supported.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal native-app cleanup with no intended feature, default, or user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 verified repository administrator's internal refactor is exempt from ordinary external-contributor runtime proof. Exact-head native CI supplements the source review; no material authority change requires exceptional final-effect proof. Persisted keys, record shapes, defaults, and legacy handling remain equivalent, establishing the no-migration case.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced hunks. The recorded test merge has exactly the pinned base parent followed by the reviewed head; unrelated base changes are not attributed to this PR. (9473d2cbc9f9)
  • Configuration compatibility concern resolved: The shared validator retains catalog enablement independent of supervision, explicit opt-out, strict object keys, required nonblank home paths, SecretInput validation, accepted options, and rejection of retired options. Comparison with fetched main establishes a refactoring of the same contract rather than a new default. (apps/macos/Sources/OpenClaw/NodeMode/MacNodeCodexThreadCatalog.swift:478, d8528ffd5496)
  • Existing-state compatibility: Preference assignments retain their keys and values. Onboarding record handling preserves current records and the existing legacy-owner stripping behavior; serialization retains the same keys and omission of absent optional values. Update receipts and approval-store updates retain their persisted contracts. No new stored model or migration requirement was identified. (apps/macos/Sources/OpenClaw/Onboarding.swift:377, d8528ffd5496)
  • Lifecycle and authority preservation: The shared socket startup owner preserves generation invalidation, cancellation, listener shutdown, and ordered settlement of previous cleanup and admitted startup work. Reviewed approval, route-lease, and catalog-cache changes retain their rejection and revalidation conditions; no material authority expansion was established. (apps/macos/Sources/OpenClaw/LocalSocketServer.swift:97, d8528ffd5496)
  • Exact-head native validation: GitHub confirms macos-swift (tests) succeeded on d8528ff, including Swift test and the native schema-version contract. The captured PR body reports 2,519 passing native tests and supplies timings. This is supplemental native validation, not a claim of live microphone or GUI proof. (d8528ffd5496)
  • Recorded landing hold: The captured PR body explicitly holds merge because desktop node-admission rejection and the doctor-progress duration failure lack independent matching failures. Passing baseline runs do not establish inheritance. These Node/UI failure paths are outside the introduced macOS-only patch; no causal patch finding or automation-risk label is justified. (d8528ffd5496)

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)

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-10-07T10:41:20.960Z sha 747c9c1 :: blocked before merge. :: none
  • reviewed 2026-10-07T11:06:20.227Z sha d8528ff :: blocked before merge. :: none
  • reviewed 2026-10-07T11:50:51.498Z sha d8528ff :: blocked before merge. :: none
  • reviewed 2026-10-07T12:00:24.250Z sha d8528ff :: blocked before merge. :: none

Share catalog validation, capture resources, socket lifecycle settlement, and native handler variants while retaining existing configuration, wire shapes, user-visible text, and authority checks. Derive parallel state from its existing owners and migrate tests off removed internal seams.
@steipete
steipete force-pushed the deslop/d09-macos-app-20261007 branch from 747c9c1 to d8528ff Compare October 7, 2026 10:57
@steipete
steipete marked this pull request as ready for review October 7, 2026 10:59
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Compatibility review for exact head d8528ffd5496bc67d7723feb539b76882743fb32 is complete. The conflict-only rebase preserves main's canonical Codex configuration repair (#166510): catalog enablement defaults independently of supervision, explicit opt-out remains effective, catalog-home validation stays strict, the newly accepted options and store SecretInput remain supported, and retired options remain rejected. The existing canonical-config fixture and malformed-config assertions are retained.

The full native app job now passes all 2,519 tests on this exact head. The shared-package job passes too. Both checkout and workflow SHA are pinned to this head. The rebase also passed app/test compilation, full locale parity, formatting, strict lint, both zero-cycle checks, suppression tests, and a fresh independent review across two complete passes.

The consolidated configuration reader preserves current main's accepted/rejected values; it does not write configuration. CLIInstallPrompter only shares its existing status assignment and log reporting. Protocol payloads, persisted shapes, native schema version 20, and migration behavior are unchanged by this PR. No operator migration or upgrade action is required.

Broader CI failures remain under individual attribution and are tracked separately in the PR evidence.

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Coordinator-authorized landing evidence for exact head d8528ffd5496bc67d7723feb539b76882743fb32.

The introduced diff is 165 Swift files and one Objective-C file, all under apps/macos/. It removes 1,399 net production LOC. There are no changes to TypeScript/JavaScript, shared Swift-package source, workflows, build scripts, dependencies, protocol/schema, or persisted formats. Exact-head disposable native CI passed 2,519 app tests and shared-package tests; two independent review passes found no accepted/actionable P0–P2 issue.

Concrete path independence

  • Doctor-progress: the original Linux job skipped Build Node test runtime and invoked Node/Vitest through ci-run-node-test-shard.mts. Decoding its actual group specification gives 19 TypeScript test files. The failing test launches the synthetic Doctor fixture using the Node executable, an isolated home/config/state, disabled plugins, and --no-restart. Its child harness spawns Node plus TypeScript/JavaScript arguments. The test, fixture, launch harness, lifecycle, runner and all 19 selected test files have no Swift/Xcode/macOS-app build or load path.
  • UI real Gateway: the recorded build is pnpm build with runtime-only/private-QA selection, producing Node runtime and browser UI. The desktop bootstrap launches Node/Vitest. The test explicitly uses dist/index.js; the admission helper starts Node plus that JS CLI and node run. Worker bundles contain dist/worker/*.mjs. Desktop processes are Linux TigerVNC/Openbox/xterm/SSH, not the macOS companion.
  • Swift grep hits explained: the native-protocol generator is TypeScript bundled by esbuild and executed by Node. It writes ignored apps/shared/OpenClawKit/.build/protocol/GatewayModels.swift as text; all 249 declared generator inputs have zero overlap with the diff, and no Swift compiler consumes the result in either job. The UI swift-*.js asset is CodeMirror syntax highlighting. Swift-toolchain/Xcode filenames in checkout setup belong to an unexecuted platform-only branch. There is no swift build, swift test, swiftc, xcodebuild, native app launch, or shared Swift package load in either actual path.

Authorized reruns and exhaustive attribution

  • Doctor: passed the single authorized rerun, attempt 2/job 112824866282, 13:45:01–13:57:23 UTC. The exact doctor-progress case passed; the complete job passed 169 tests with 12 existing platform skips. No source, test, budget, or selection changes.
  • UI: passed the single authorized rerun, attempt 3/job 112831685365, 13:59:29–14:20:26 UTC. The desktop proof passed both node/SSH carriers; the subsequent real-Gateway suite passed all 19 tests in 15 files. No source, assertion, selection, or budget changed.
  • Only these two logical jobs were requested. GitHub serializes per-run reruns; its rejected concurrent UI request started nothing. Carried-forward jobs receive new attempt-qualified IDs while retaining original execution timestamps; they are not fresh executions.
Failing job Failure Independent evidence / remaining gap
UI real Gateway 1/2 Original desktop worker node-admission RPC rejection Passed the coordinator-authorized one-job rerun, including both desktop carriers and the complete real-Gateway suite. Concrete Node/browser-only path independence is established.
test-types-core-2 Terminal font fixture passes a removed signal argument Identical diagnostic on main.
compact-small-28 Terminal-font E2E missing from serial-owner inventory Same 52/51 inventory and extra file on main.
compact-large-12 Native Talk registration readiness exceeded 1,000ms Same case and preparing-tool-authority error on unrelated PR CI.
compact-large-14 Shared branch graph exceeded the existing 1,000ms assertion Same case/assertion on unrelated PR CI.
compact-large-17 Session-category create admission and patch registration errors Both exact cases match unrelated PR CI.
compact-large-37 Complete yielded outcome timeout and database-custody ENOENT teardown Both match unrelated PR CI.
compact-large-15 Node-upgrade diagnostic mismatch and two SQLite status assertions Diagnostic matches unrelated PR CI; both SQLite parameter cases match main.
compact-large-2 Canonical artifact publication reports session changed Same case/error on main.
compact-small-9 Original doctor-progress observed 3,004ms against <3,000ms Passed the coordinator-authorized one-job rerun above; original failure retained. Concrete Node-only path independence is established.
compact-large-25 Four continuation-owner cases and two archive-placement admission errors All six cases match independent PR/clean-main evidence. Clean main 1b395594318bbd0db6f2467f35b10cc8ac1d30d0 reproduced both exact archive cases and admission-error stacks in one complete-file run (13 passed / 2 failed, 97.813s).
aggregate gate Downstream failure Attempt 1 followed eleven roots; final attempt 3 follows only the nine independently matched roots.

The archive-placement main reproduction used clean main 1b395594318bbd0db6f2467f35b10cc8ac1d30d0, Linux x86_64, Node 24.19.0, pnpm 12.5.1, and the proof wrapper's 077 file mask. Both exact archive cases failed with STATE_DATABASE_READ_ADMISSION_INVALIDATED and their respective projection-read/native-authorization stacks. The target used Node 24.21.0. The environment difference is disclosed; neither archive failure was a permissions error. No failure is hidden by an assertion, timeout, retry, skip, or suppression change.

The historical cancelled PR-context job 112757841686 was replaced by successful attempt-2 job 112788536167 on the same head. Its cancelled history is retained; the replacement supplies the missing proof.

The exact-head, paginated check-runs?filter=all census is complete: 635 historical/current checks, 446 successful, 155 skipped, 33 failed, one historical cancellation, zero pending. The lone historical cancellation has the successful replacement above. There is no effective cancelled or zero-step proof gap. Final main-tier attempt 3 is 136 success / 10 failure / 12 skipped: nine independently matched roots plus the downstream aggregate. The nine carried-forward root results have exactly the same start/end timestamps as their original executions; none was re-executed or newly failed. Every failed check-run ID is enumerated below and attributed by the logical-job table above.

All failed check-run IDs across the three attempts
Logical failing check (all attempts) Check-run IDs retained in the exhaustive census
check-test-types-core-2 112759832882, 112824849542, 112831693176
checks-node-compact-large-12 112759835102, 112824854171, 112831696200
checks-node-compact-large-14 112759835133, 112824853651, 112831696995
checks-node-compact-large-15 112759835223, 112824853386, 112831697484
checks-node-compact-large-17 112759835209, 112824854741, 112831696855
checks-node-compact-large-2 112759842716, 112824862953, 112831708578
checks-node-compact-large-25 112759835117, 112824856322, 112831700410
checks-node-compact-large-37 112759835181, 112824857552, 112831703402
checks-node-compact-small-28 112759834957, 112824848458, 112831690818
checks-node-compact-small-9 112759842755
checks-ui-e2e-real-gateway (1/2) 112759829797, 112824847856
openclaw/ci-gate 112776662729, 112830709177, 112841786210

The latest ClawSweeper review (13:43 UTC) reports no correctness/security findings and confirms unchanged configuration and existing-state contracts. Its procedural CI checklist is addressed by the targeted results and evidence here; compatibility was also confirmed in the earlier maintainer comment.

Admin squash merge is requested under the coordinator's explicit decision, pinned to d8528ffd5496bc67d7723feb539b76882743fb32. Original failures remain recorded; targeted passing reruns are not described as source fixes. All owned proof leases have been released.

@steipete
steipete merged commit cb04039 into main Oct 7, 2026
604 of 638 checks passed
@steipete
steipete deleted the deslop/d09-macos-app-20261007 branch October 7, 2026 14:24
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
…166558)

* refactor(macos): consolidate native app state and handlers

Share catalog validation, capture resources, socket lifecycle settlement, and native handler variants while retaining existing configuration, wire shapes, user-visible text, and authority checks. Derive parallel state from its existing owners and migrate tests off removed internal seams.

* fix(macos): preserve localization keys during consolidation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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