Skip to content

feat(macos): host the Gateway on bundled Bun - #161709

Merged
steipete merged 11 commits into
mainfrom
steipete/mac-app-hosted-gateway
Oct 1, 2026
Merged

steipete merged 11 commits into
mainfrom
steipete/mac-app-hosted-gateway

Conversation

@steipete

@steipete steipete commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Launching OpenClaw.app should start its included Gateway without downloading Node or installing a separate CLI.

User Impact

Fresh bundled setups prepare a private runtime in the selected profile and host the Gateway as an app child. Quitting the app stops it. Bundled onboarding prepares the included payload instead of offering installation channels or running install-cli.sh; unbundled DEBUG setup keeps its existing flow.

Existing background services retain their lifecycle and runtime selection. App-owned Bun services update to one matching concrete build for Bun, package and SQLite. Operator runtime paths remain unchanged and produce an update instruction. The persistence control and managed-Node migration follow in #161779.

An onboarded local default or named profile with exact/unset install policy and surviving app-managed Node files records service hosting even when the published app removed its LaunchAgent while paused. Initial paused recovery only records that intent. Active recovery retains the surviving Node command; B2b performs the two-step migration. Channel-policy and external installations stay external.

Why This Change Was Made

BundledRuntime owns atomic profile seeding, the terminal shim and health-gated collection of unused builds. Only the terminal shim follows runtime/current. GatewayProcessManager owns attach-first startup, hosting intent, existing readiness and serialized shutdown. The child supervisor holds the stdin lifeline, backs off after crashes and drains its process group on quit.

Updates and service mutations bind concrete command paths to their current service files. A retained resume command carries intent; current local or remote service ownership is checked separately before dispatch. Changes to the selected command, service definition, generated environment, update selection or local attach-only state stop the stale operation. A custom terminal CLI alone does not revoke an established bundled service. Remote Mac node services retain their independent owner. Pause refuses unreadable or unretainable commands before uninstalling. The original selected service definition is carried through Pause, install and reinstall into the final synchronous process preflight; dispatch cannot adopt a replacement definition as new authority.

Background connection recovery can repair an already active lifecycle, but cannot resume a paused or inactive one. Exhausting the child's five-failure budget clears activation intent so recovery cannot silently reset that budget. Core remains responsible for package updates, backups and schema migration. Native read-only admission accepts legitimately absent config state at schemas 1–5, retains existing old-version pins and rejects malformed schema-6+ state.

Evidence

The subsequent full CI run on 0dcff59b completed 2,400 tests / 278 suites in 222.595s: the earlier four failures and both previously unfinished tests passed. It exposed one additional two-case pause fixture that expected uninstall for an independent attachment and supplied a non-restorable managed command. That final fixture is now corrected, retaining stopped/ownership assertions and cleaning its retained preference. Its exact three baseline issues were reproduced; the fixed two cases passed (0.063s / 9.58s wall) and five focused tests / 18 cases passed (0.973s / 7.79s wall) after a 66.48s build. Codex review is clean through P2. Current-head CI run 36794496019, attempt 2, passed after one documented, authorized macOS-job rerun for the inherited scheduling/AX timeout (evidence comment #issuecomment-5922506504). Both effective CI/security gate projections are green. The retry is not a claim that the intermittent test-harness hazard was fixed; no merge exception is used.

CI on the preceding head recorded four native lifecycle assertions before its macOS deadline; iOS passed. The two-file fixture correction is now proved and reviewed: onboarding supplies a restorable Node/entrypoint command, and recovery models active/unpaused intent with matching named-profile listener/service ownership and orderly teardown. The original four tests reproduced the failures, then passed (13 cases, 0.491s / 6.76s wall); 11 surrounding cancellation/protocol/Talk/response and inactive/paused/crash-budget controls passed (1.629s / 8.28s wall), after a 26.04s build. No product code changed, no assertions were weakened and no CI exception was used. The previously unfinished pure readiness case and three neighboring cases pass unchanged; the provider case creates native windows and was subsequently verified in disposable CI (18 cases / 1.131s). The latest current-head CI outcome is recorded above.

Current head: a5e30b2688c24d964dd011ce46c81d5c800bdd61. The rebuild preserves the merged prerequisites' final entitlement/host-contract fixes, native SQLite retry and repinned Bun fork; old unsquashed prerequisite ancestry is excluded. Original feature authorship/message is preserved. The public tree equals the final reviewed candidate. Cumulative Codex review, ownership-handoff review and final fixture reviews are clean through P2; all accepted findings are resolved. The latest corrections change tests only, so the completed signed live proof below covers byte-identical production source.

  • The latest ownership-handoff build passed in 39.27s wall; its 16 regression cases passed in 0.078s test / 5.60s wall, after reproducing 24 intended failed assertions on the prior behavior. The cases preserve unreadable/unretainable services and reject changed plist/environment/wrapper custody at the final daemon preflight, with unchanged and absent-service controls. These are intercepted native boundary tests, not physical launchd proof. The pause sibling replay passed 14 cases / 5.14s wall; the full focused A filter passed 56 tests / 9 suites, 1.637s / 6.64s wall, and Periphery remained empty (4.76s).

  • Earlier captured updater/daemon, policy/identity and recovery matrices also passed; each defect was reproduced on the preceding implementation.

  • Actual tagged-schema proof reproduces the schema-3 rejection before the fix, then admits that database without changing bytes; schema-5 pins remain readable and malformed schema-6/metadata cases are rejected. Shared native admission passed 21 tests, 0.134s / 4.10s wall.

  • pnpm tsgo:scripts, scoped strict Swift lint/format, native localization verification and diff checks passed. Broad lint also reports an unchanged DashboardManager.swift length violation outside this correction scope. Earlier unchanged runtime-staging proof passed 123 tests / 69.97s wall, including the install-owner marker.

  • Earlier signed build-update proof covered reseed/reinstall/health/GC, retention of the immediately previous build and byte-identical preservation of an operator runtime pin. This is same-version build-update proof, not a schema-upgrade claim.

  • The ordinary Foundation-signed combined package on c9b578fab4ec built in 411.29s, with Bun revision 1.4.3-canary.1+57fadf566, matching concrete runtime/package/SQLite paths and the required Bun signing entitlement.

  • Final ordinary Dashboard cycle (b2-rebuild-smoke-e0e33da6, port 53155) passed through the actual checkbox: concrete Bun child startup (19.13s, and 10.80s after the rejection fixture); ON installed a healthy LaunchAgent in 8.82s, with runtime/entrypoint/SQLite from one concrete build. Service 17098 survived app quit (0.36s) and an independent health probe (0.76s). OFF removed the LaunchAgent and started child 18687 in 25.90s; app quit drained that child and its descendants in 4.10s. Profile-scoped ps checks found Bun and no Node. All final live profiles, services, defaults, task Keychain rows, PATH additions and port reservations were cleaned.

  • Final published paused-upgrade proof used a real npm 2026.9.7 Node service, verified health, then its published uninstall. The final ordinary app recorded service hosting and stayed idle for 20.21s with no Node CLI, runtime seed, plist or listener. After a stopped-app unpause and normal launch, Bun service 15859 became healthy in 22.33s. The same service survived app quit (0.36s) and passed an independent health probe (0.71s); the synthetic generated service setting was retained.

  • Final operator-replacement proof suspended only the identified app-descendant status process during the actual Dashboard app→service transition, inserted a synthetic operator plist, then resumed it. Its exact bytes remained intact, no service loaded and no listener appeared, including after app quit. This is actual install-boundary rejection; the final synchronous preflight race matrix is separately covered by native tests. The error-window capture was unavailable after the Dashboard reconnected; no visible-error claim is made for this cell.

  • Final ordinary PostUpdate proof preserved an external operator runtime pin, service PID and byte-identical plist/environment/wrapper, with the requested update-it-yourself message visible. Restoring the task's app-owned pin then launching the new app reseeded/reinstalled to concrete c9b578fab4ec Bun/package/SQLite in 23.84s; the healthy service survived app quit. New and immediately previous builds remained present. Older-build deletion was proven in the earlier same-version build-update cell, not relabeled as final-head deletion proof.

  • Final source-tree rollback proof used a Foundation-signed scratch app with only a DEBUG entry hook and failure-injection harness. Its production owner tree equals combined head c9b578fab4ec; the ordinary packaged app is separate. The real published 2026.9.7 Node service passed native health, then concrete-build Bun passed native health before one injected failure. Node was restored and passed native health at 38.96s; after the harness exited, independent Node CLI health passed in 0.91s (40.05s total). Runtime/entrypoint/SQLite came from one Bun build. The retained Node/npm files and synthetic generated environment remained available. The isolated service/profile/defaults/port reservation were cleaned.

The full native suite was not run on the operator desktop. All local native execution used signed isolated profiles and an audited OS sandbox, or explicitly scoped live task profiles/ports. Legacy settings already discarded by older Pause behavior cannot be recovered; core-generated service environments are retained by their existing owner.

The inspected synthetic onboarding captures remain valid for the unchanged page. A private DEBUG NSHostingView harness rendered the actual page because SwiftUI ImageRenderer did not render its scroll view; the harness is not committed.

Before After
Onboarding before bundled preparation Onboarding with bundled preparation

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations extensions: qa-lab extensions: codex size: XL labels Sep 30, 2026
@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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 30, 2026
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 8:18 PM ET / October 1, 2026, 00:18 UTC (Revision 12).

ClawSweeper review

What this changes

The branch makes OpenClaw.app prepare and host its bundled Bun Gateway for fresh Mac setups while retaining existing service and update behavior, with accompanying onboarding, packaging, native-state, test, and documentation changes.

Merge readiness

✅ Ready for maintainer review

Current main still lacks app-hosted Gateway startup, and the open follow-on PR depends on this work. The prior review’s stale PR-body concern is resolved; I found no remaining actionable defect in the pinned head.

Priority: P2
Reviewed head: a5e30b2688c24d964dd011ce46c81d5c800bdd61

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Detailed signed-app observations and focused upgrade checks support a broad but coherent Mac lifecycle change.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body reports a signed combined Mac app exercising the changed Gateway owner through child startup, service switching, published Node recovery, operator-replacement rejection, and rollback, with observed health and shutdown results; inspected screenshots separately show onboarding copy. Optional receipt decoding, older-schema admission tests, and the published-install scenario support existing-state compatibility.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body reports a signed combined Mac app exercising the changed Gateway owner through child startup, service switching, published Node recovery, operator-replacement rejection, and rollback, with observed health and shutdown results; inspected screenshots separately show onboarding copy. Optional receipt decoding, older-schema admission tests, and the published-install scenario support existing-state compatibility.
Evidence reviewed 11 items Current main: The fetched main documentation still says the Gateway remains external and bundled hosting is subsequent work.
Release context: The latest supplied release tag points to a September 29 commit, before this PR; current main still documents the behavior as missing.
App-owned lifecycle: The introduced supervisor launches the bundled Gateway with a stdin lifeline and owns bounded shutdown and restart handling.
Findings None None.
Security None None.

How this fits together

OpenClaw.app includes a Bun runtime and Gateway package. The Mac app selects an existing listener or service, or starts a Gateway child, then reports health and recovery results to onboarding and update flows.

flowchart LR
A[Mac app bundle] --> B[Profile runtime copy]
B --> C{Hosting choice}
D[Existing listener or service] --> C
C --> E[App Gateway child]
C --> F[Background service]
E --> G[Health and recovery]
F --> G
G --> H[Onboarding and update status]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +15, Docs +66, Other +5225. Total +5306 across 43 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 16 1 +15
Docs 2 106 40 +66
Config 0 0 0 0
Generated 0 0 0 0
Other 40 5536 311 +5225
Total 43 5658 352 +5306

Review metrics

Metric Value Why it matters
Code growth by role production +2,667 net lines; tests +2,561 net lines The substantial native growth covers runtime seeding, supervision, service custody, and upgrade handling described in the PR.
Stored-state surface 3 native preference keys added; 2 optional receipt fields added Hosting intent and update recovery now persist across launches, making existing-state compatibility material.

Stored data model

Persistent data-model change detected: database schema: scripts/stage-mac-runtime.sh, migration/backfill/repair: apps/macos/Sources/OpenClaw/CLIInstaller+BundledPreparation.swift, migration/backfill/repair: apps/macos/Sources/OpenClaw/GatewayProcessManager+Policy.swift. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep service custody and rollback checks at the Mac lifecycle boundary, then review the separate Dashboard preference and managed-Node migration as the follow-on change.

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

Not applicable: this PR adds a Mac hosting mode rather than reporting a broken existing contract. The submitted signed-app observations exercise the proposed behavior.

Is this the best way to solve the issue?

Yes: it extends the existing bundled runtime and Mac lifecycle owners while preserving external and operator-managed installations. The user control and Node migration remain a distinct follow-on change.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports a signed combined Mac app exercising the changed Gateway owner through child startup, service switching, published Node recovery, operator-replacement rejection, and rollback, with observed health and shutdown results; inspected screenshots separately show onboarding copy. Optional receipt decoding, older-schema admission tests, and the published-install scenario support existing-state compatibility.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add feature: ✨ showcase: ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. A Mac app that can start its included Gateway without a separate runtime download removes a substantial first-run dependency.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports a signed combined Mac app exercising the changed Gateway owner through child startup, service switching, published Node recovery, operator-replacement rejection, and rollback, with observed health and shutdown results; inspected screenshots separately show onboarding copy. Optional receipt decoding, older-schema admission tests, and the published-install scenario support existing-state compatibility.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove proof: 📸 screenshot: Current real behavior proof evidence kind is live_output.

Label justifications:

  • P2: Self-contained Mac setup is a substantial improvement, while current onboarding still has a supported external-service path.
  • merge-risk: 🚨 compatibility: The default hosting path and persisted Mac update state affect upgrades from existing Node services and operator runtime selections.
  • merge-risk: 🚨 security-boundary: The app now carries service-file custody across asynchronous work before spawning service-changing CLI commands.
  • merge-risk: 🚨 availability: App-owned Gateway startup, crash recovery, and shutdown change when a local Gateway runs.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • feature: ✨ showcase: ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. A Mac app that can start its included Gateway without a separate runtime download removes a substantial first-run dependency.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports a signed combined Mac app exercising the changed Gateway owner through child startup, service switching, published Node recovery, operator-replacement rejection, and rollback, with observed health and shutdown results; inspected screenshots separately show onboarding copy. Optional receipt decoding, older-schema admission tests, and the published-install scenario support existing-state compatibility.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports a signed combined Mac app exercising the changed Gateway owner through child startup, service switching, published Node recovery, operator-replacement rejection, and rollback, with observed health and shutdown results; inspected screenshots separately show onboarding copy. Optional receipt decoding, older-schema admission tests, and the published-install scenario support existing-state compatibility.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • vincentkoc: 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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-30T18:11:59.570Z sha 106cc4e :: blocked before merge. :: [P1] Preserve paused Node-service hosting on first upgrade
  • reviewed 2026-09-30T18:25:15.267Z sha 106cc4e :: blocked before merge. :: [P1] Preserve paused Node-service hosting on first upgrade
  • reviewed 2026-09-30T19:09:24.480Z sha ed591e2 :: needs real behavior proof before merge. :: [P1] Recheck legacy service ownership before installing it | [P2] Move schema checks into native database admission
  • reviewed 2026-09-30T19:51:45.557Z sha baa05a4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-30T20:27:57.559Z sha b6fa0ac :: needs real behavior proof before merge. :: [P1] Recheck retained service ownership before updater spawn
  • reviewed 2026-09-30T21:55:55.060Z sha 63e8fc3 :: needs real behavior proof before merge. :: [P1] Refuse Pause when the service command cannot be retained | [P1] Carry original service custody into Bun reinstall
  • reviewed 2026-09-30T22:19:59.805Z sha 406c724 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-30T23:26:34.453Z sha 0dcff59 :: needs changes before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebuilt head a26cd3dca0adc58e7837122ee3b339a7f81fe4fa preserves current main's bundled Bun signing entitlement and fixes legacy PostUpdate receipt state loss. The matching-version receipt retains incomplete Gateway work, notification attempts, and in-flight notification state while acquiring its runtime build ID. The receipt-store regression fails on the previous owner and passes with the fix; Codex branch review is clean through P2. Please review this exact rebuilt head.

@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 30, 2026
Prepare the bundled runtime inside each app profile and run fresh Gateways as app-owned children with readiness checks, bounded shutdown, and crash recovery. Keep terminal commands on the current shim while services pin matching concrete runtime, package, and SQLite builds. Reseed app-owned installations after updates and preserve operator runtime selections. Bundled onboarding no longer downloads Node or runs the CLI installer.
@steipete
steipete force-pushed the steipete/mac-app-hosted-gateway branch from a26cd3d to 106cc4e Compare September 30, 2026 17:50
Give onboarding a restorable managed Node command and isolate its retained state. Model an active, unpaused Gateway with matching listener and service ownership in recovery fixtures, and retire startup before teardown. Preserve the original recovery and cancellation assertions.
Use a restorable managed Node command and assert that Pause uninstalls only the managed service. Preserve the stopped-state and installation checks, model named-profile ownership, and restore retained preferences after the fixture.
@clawsweeper clawsweeper Bot added feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Oct 1, 2026
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

The current-head CI timeout has no recorded assertion failure and no final suite summary. The macOS job completed its build, then reached the 30-minute deadline while provider cancellation preserves the pending terminal reply and stale readiness wait cannot clear a newer launch failure were unfinished. The newly corrected pause fixture had not run. The preceding full native run completed all 2,400 tests, including these cases, before reporting the separate pause-fixture assertions now corrected.

I compared the actual tested merge trees (e42ff6ea9957ad5c78377ad02728ef9b85d1fe73 versus 6e64e05e4fc782184961e2b2642c5b72d12a023e). Across native/shared sources the only delta is the later pause test; provider tests, support, production code, package pins, workflow and native runner are unchanged. The changed fixture and surrounding ownership/cancellation controls pass locally.

There is a concrete inherited scheduling hazard in the test machinery: pinned swift-concurrency-extras routes global tasks—including Task.detached and overlapping out-of-scope tasks—to the main executor inside withMainSerialExecutor (its own tests explicitly verify this). The provider test wraps its body in that helper, then its failure cases invoke synchronous self-process Accessibility inspection from Task.detached, specifically intending to keep MainActor free. These constructs predate this PR in #135041. This supports an inherited suite scheduling/AX interaction; there is no blocked-thread sample, so I am not claiming a confirmed AX stack or runner-infrastructure fault.

Under the work order's unrelated/local-passing-delta policy, I am requesting one rerun of the macOS job and its required dependencies on unchanged head a5e30b2688c24d964dd011ce46c81d5c800bdd61. No CI bypass or passing-result claim is made. A repeated unexplained timeout will not be waved through.

@steipete
steipete merged commit 271702b into main Oct 1, 2026
301 of 303 checks passed
@steipete
steipete deleted the steipete/mac-app-hosted-gateway branch October 1, 2026 01:16
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 1, 2026
* feat(macos): host the Gateway on bundled Bun

Prepare the bundled runtime inside each app profile and run fresh Gateways as app-owned children with readiness checks, bounded shutdown, and crash recovery. Keep terminal commands on the current shim while services pin matching concrete runtime, package, and SQLite builds. Reseed app-owned installations after updates and preserve operator runtime selections. Bundled onboarding no longer downloads Node or runs the CLI installer.

* fix(macos): preserve legacy app update retry receipts

* fix(macos): preserve Gateway update and service ownership

* fix(macos): preserve paused legacy Gateway service hosting

* fix(macos): defer service migration inspection to hosting controls

* fix(macos): revalidate service authority and admit runtime pin reads

* fix(macos): preserve legacy updater authority and older state reads

* fix(macos): preserve service ownership and paused intent

* fix(macos): bind service changes to retained ownership

Preserve a service when Pause cannot retain its command, and carry the originally selected service definition through install, uninstall, and restart dispatch. Surface refused teardown without overwriting a replacement service.

* test(macos): model active recovery and restorable services

Give onboarding a restorable managed Node command and isolate its retained state. Model an active, unpaused Gateway with matching listener and service ownership in recovery fixtures, and retire startup before teardown. Preserve the original recovery and cancellation assertions.

* test(macos): preserve ownership in pause fixtures

Use a restorable managed Node command and assert that Pause uninstalls only the managed service. Preserve the stopped-state and installation checks, model named-profile ownership, and restore retained preferences after the fixture.
steipete added a commit that referenced this pull request Oct 15, 2026
#173117)

* refactor(apps): consolidate Android and Linux lifecycle paths

Share transcript-content serialization without changing persisted JSON bytes,
and move identical camera/chat JPEG resizing and recycling into one owner.
Stop re-encoding an oversized JPEG when neither quality nor size can change.
Reuse the first wide-area DNS SRV response instead of requesting it again for
an address already present in its additional records.
Use the discovery receiver handle as its liveness authority and inline the
single-caller logind connection wrapper.

Best-effort tradeoffs accepted

- Swarm pagination no longer rescans a moving roster four times. The feature's
  #113850 tests synthesize moving offsets, not a human actual-use incident;
  skipped workers refresh on the next session event. Strictly advancing offsets
  also make a separate seen-offset set unnecessary.
- Synchronous swarm projection now runs inside its existing lock rather than
  publishing through a second snapshot/revalidation path (#113850). There is
  no asynchronous gap to defend, and async response ownership checks remain.
- Wear startup uses the active connection slot, not a third promotion map and
  claim-order counters. #116593/#116592 describe a source/emulator timing audit,
  not an independent human incident. Production requests are actor-serialized;
  reconnect exactly during prior-owner retirement may keep the reserved channel
  instead of the newest one. Restarting Talk recovers. Normal reconnect, audio
  owner settlement, physical generations and FIFO writes remain.
- Wear peer registrations no longer carry generations (#109341/#109433).
  The removed regression forced a deferred send failure after rediscovery;
  a stale failure can now evict that peer until discovery or its next request.
- Read-only Wear Pulse polling no longer has a second request generation or
  synchronous duplicate route checks (#122123 initial feature/synthetic tests).
  One canceled poller owns the work; phone/agent/session/route checks remain.
- Discovery no longer has an independent alive flag or cleanup generation
  (#108115 synthetic adversarial review). Cleanup finishes before the receiver
  handle becomes finished, so a replacement cannot lose its snapshot.

No signing, permission, dependency, schema, durability or Gateway protocol
changes. The standalone session-memory backend is untouched.

Net production reduction: 214 lines, excluding tests and 12 removed inline Rust
test lines. The scope pass and two fresh independent passes found no further
sound bulk cuts. Below-500 branch handoff for coordinator bundling.

Baseline regression proof: the original JPEG algorithm encodes the same input
42 times; original DNS discovery makes PTR/SRV/SRV/TXT requests despite resolving
the expected public endpoint. Both new regressions failed on those exact counts.

Independent final review: scoped-clean, no actionable P0-P2 findings. Runtime
and Madge cycles: zero. Lint-suppressions: 3/3 passed. Check-changed repository
invariants and native schema gate passed; corrected Android fixture formatting
passed its focused ktlint replay. Tauri all-targets build/tests passed on macOS:
325 unit and 7 native lifecycle tests.

Linux-only build/logind proof remains for coordinator CI: the shared Testbox
allocation queued and was stopped without executing commands; no active lease.
No release gate dispatched, Apple target touched or hosted sandbox test run.

Android proof: 229 focused phone tests passed across the complete batch and
repaired discovery-class replay, plus 7 Wear lifecycle tests. Phone Play,
third-party and Wear debug APK builds passed. Full discovery replay passed
16 tests plus 2 DNS TXT tests, with no errors, failures or skips. The initial
full-class failure was a fixture singleton leak, fixed with a shadow-owned
factory/reset; endpoint and packet assertions remain unchanged.

* refactor(ios): share manual gateway security rows

Use one rendering owner for the identical Settings and onboarding TLS picker
and helper text. Preserve each original binding setter, transport policy,
forced-TLS disabling, typography and row order. Keep security behavior tests;
consolidate duplicate typography checks at the shared rendering owner.

Regenerate the shrinking native source inventory: six label sites become three
with the same IDs and strings. No translation memory or public contract changes.

Independent P0-P2 review is scoped-clean. SwiftFormat and canonical source lint
pass. Native platform builds and focused tests remain in progress.

Best-effort tradeoffs accepted: none; rendering consolidation only.

* refactor(apple): share presentation rows and remove duplicate task bookkeeping

Use cancellation already owned by Quick Chat reads and hover-card avatar/progress
tasks instead of a second request ID or generation comparison. Keep queued
subscription generations, route checks and all write-patch settlement.

Share media-unavailable rendering and notification priority translation while
preserving typography, strings, modifier order, sound policy and authorization.
Trust the process-lifetime LiveActivity singleton and the onboarding Candidate
already passed by its owning ForEach. The exhaustive hydration switch still
rejects idle and disconnected states; only its duplicate early guard is removed.

Best-effort tradeoffs accepted: none added by this equivalent-owner batch.
The branch's ReplayKit SDK duplicate-completion and seeded-runtime re-read
tradeoffs remain documented in the initial consolidation commit.

Source lint, formatting, parse, localization verification and lint-suppressions
pass. Independent P0-P2 review's hydration finding is declined because the
retained exhaustive switch returns false for both cited states. Native builds
and focused tests remain in progress; app-hosted macOS execution is excluded.

* refactor(apple): consolidate chat transport and capture lifecycle

Share common chat RPC application logic while retaining platform route authority
and non-retrying macOS compaction. Replace ReplayKit's startup phase machine
with awaited start/stop settlement, share speech-resource teardown, and remove
redundant identity/observer bookkeeping and DEBUG forwarding fixtures.

Best-effort tradeoffs accepted:
- ReplayKit duplicate startup completions are unsupported. The introducing
  lifecycle PR #103072 cites synthetic coverage, not a human duplicate-callback
  incident; a violated SDK single-completion contract now fails visibly.
- A same-user runtime mutation after seed validation is no longer re-read.
  Feature PR #161709 cites fixture proof, not a report requiring that duplicate
  validation; the next normal resolution validates concrete state again.

No signing, entitlement, bundle ID, permission, protocol, schema, or dependency
changes. Phase E session memory is untouched. Native build/test verification
is still running; app-hosted macOS execution requires a disposable OS environment.

* refactor(wear): retain pulse polling lifecycle guards

Drop the wave-5 pulse polling simplification after independent review raised uncertainty around late non-cancellation errors. Restore the production owner and lifecycle test byte-for-byte to the bundle base; keep the rest of the Android/Linux and Apple bundle unchanged.

* refactor(apps): retain established Wear and screenshot paths

Drop Wear channel claim cleanup after review identified stale claims displacing newer active Talk owners. Restore its complete lifecycle regressions. Drop ChatProTab and OpenClawBrand cleanup after the hosted iPad screenshot timeout did not reproduce in serial exact head/base replays; no claim of a proven timeout repair. Keep independent Android DNS and JPEG performance fixes and the remaining y18/y19 native-app cleanup.

* refactor(apps): drop Linux lifecycle cleanup from bundle

Apply the coordinator drop-hunks rule after the Linux onboarding Review permissions test reached Connection Settings instead of Native permissions. Routing owners are unchanged; without conclusive Linux replay, restore all y18 Linux runtime files to origin/main ace1908. Preserve Android and Apple cleanup, including the DNS and JPEG fixes. Park the original Linux hunks separately for native investigation; no timeout repair or inherited-red attribution claimed.

* refactor(apps): drop shared chat RPC consolidation

Restore the existing iOS/macOS adapters, shared extension and tests after the exact-head shared Periphery intersection reported the moved pager and metadata identities unused in both consumers. Apply the coordinator drop-hunks rule rather than suppressing the scanner or rerunning CI for green. Preserve route/server-lease authority and macOS no-retry compaction.

* refactor(android): drop chat cleanup after native fixture failure

Apply the coordinator changed-path drop rule after ChatCompletedWorkLayoutTest.completedWorkSummaryKeepsEarlierToolFailureVisible timed out waiting for refreshed tool-error history in third-party CI. Restore chat models, cache, controller, swarm and associated test deltas as one conservative unit. No causal timing repair or inherited-main attribution is claimed. Keep both Android DNS and JPEG fixes and retained Apple cleanup.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
openclaw#173117)

* refactor(apps): consolidate Android and Linux lifecycle paths

Share transcript-content serialization without changing persisted JSON bytes,
and move identical camera/chat JPEG resizing and recycling into one owner.
Stop re-encoding an oversized JPEG when neither quality nor size can change.
Reuse the first wide-area DNS SRV response instead of requesting it again for
an address already present in its additional records.
Use the discovery receiver handle as its liveness authority and inline the
single-caller logind connection wrapper.

Best-effort tradeoffs accepted

- Swarm pagination no longer rescans a moving roster four times. The feature's
  openclaw#113850 tests synthesize moving offsets, not a human actual-use incident;
  skipped workers refresh on the next session event. Strictly advancing offsets
  also make a separate seen-offset set unnecessary.
- Synchronous swarm projection now runs inside its existing lock rather than
  publishing through a second snapshot/revalidation path (openclaw#113850). There is
  no asynchronous gap to defend, and async response ownership checks remain.
- Wear startup uses the active connection slot, not a third promotion map and
  claim-order counters. openclaw#116593/openclaw#116592 describe a source/emulator timing audit,
  not an independent human incident. Production requests are actor-serialized;
  reconnect exactly during prior-owner retirement may keep the reserved channel
  instead of the newest one. Restarting Talk recovers. Normal reconnect, audio
  owner settlement, physical generations and FIFO writes remain.
- Wear peer registrations no longer carry generations (openclaw#109341/openclaw#109433).
  The removed regression forced a deferred send failure after rediscovery;
  a stale failure can now evict that peer until discovery or its next request.
- Read-only Wear Pulse polling no longer has a second request generation or
  synchronous duplicate route checks (openclaw#122123 initial feature/synthetic tests).
  One canceled poller owns the work; phone/agent/session/route checks remain.
- Discovery no longer has an independent alive flag or cleanup generation
  (openclaw#108115 synthetic adversarial review). Cleanup finishes before the receiver
  handle becomes finished, so a replacement cannot lose its snapshot.

No signing, permission, dependency, schema, durability or Gateway protocol
changes. The standalone session-memory backend is untouched.

Net production reduction: 214 lines, excluding tests and 12 removed inline Rust
test lines. The scope pass and two fresh independent passes found no further
sound bulk cuts. Below-500 branch handoff for coordinator bundling.

Baseline regression proof: the original JPEG algorithm encodes the same input
42 times; original DNS discovery makes PTR/SRV/SRV/TXT requests despite resolving
the expected public endpoint. Both new regressions failed on those exact counts.

Independent final review: scoped-clean, no actionable P0-P2 findings. Runtime
and Madge cycles: zero. Lint-suppressions: 3/3 passed. Check-changed repository
invariants and native schema gate passed; corrected Android fixture formatting
passed its focused ktlint replay. Tauri all-targets build/tests passed on macOS:
325 unit and 7 native lifecycle tests.

Linux-only build/logind proof remains for coordinator CI: the shared Testbox
allocation queued and was stopped without executing commands; no active lease.
No release gate dispatched, Apple target touched or hosted sandbox test run.

Android proof: 229 focused phone tests passed across the complete batch and
repaired discovery-class replay, plus 7 Wear lifecycle tests. Phone Play,
third-party and Wear debug APK builds passed. Full discovery replay passed
16 tests plus 2 DNS TXT tests, with no errors, failures or skips. The initial
full-class failure was a fixture singleton leak, fixed with a shadow-owned
factory/reset; endpoint and packet assertions remain unchanged.

* refactor(ios): share manual gateway security rows

Use one rendering owner for the identical Settings and onboarding TLS picker
and helper text. Preserve each original binding setter, transport policy,
forced-TLS disabling, typography and row order. Keep security behavior tests;
consolidate duplicate typography checks at the shared rendering owner.

Regenerate the shrinking native source inventory: six label sites become three
with the same IDs and strings. No translation memory or public contract changes.

Independent P0-P2 review is scoped-clean. SwiftFormat and canonical source lint
pass. Native platform builds and focused tests remain in progress.

Best-effort tradeoffs accepted: none; rendering consolidation only.

* refactor(apple): share presentation rows and remove duplicate task bookkeeping

Use cancellation already owned by Quick Chat reads and hover-card avatar/progress
tasks instead of a second request ID or generation comparison. Keep queued
subscription generations, route checks and all write-patch settlement.

Share media-unavailable rendering and notification priority translation while
preserving typography, strings, modifier order, sound policy and authorization.
Trust the process-lifetime LiveActivity singleton and the onboarding Candidate
already passed by its owning ForEach. The exhaustive hydration switch still
rejects idle and disconnected states; only its duplicate early guard is removed.

Best-effort tradeoffs accepted: none added by this equivalent-owner batch.
The branch's ReplayKit SDK duplicate-completion and seeded-runtime re-read
tradeoffs remain documented in the initial consolidation commit.

Source lint, formatting, parse, localization verification and lint-suppressions
pass. Independent P0-P2 review's hydration finding is declined because the
retained exhaustive switch returns false for both cited states. Native builds
and focused tests remain in progress; app-hosted macOS execution is excluded.

* refactor(apple): consolidate chat transport and capture lifecycle

Share common chat RPC application logic while retaining platform route authority
and non-retrying macOS compaction. Replace ReplayKit's startup phase machine
with awaited start/stop settlement, share speech-resource teardown, and remove
redundant identity/observer bookkeeping and DEBUG forwarding fixtures.

Best-effort tradeoffs accepted:
- ReplayKit duplicate startup completions are unsupported. The introducing
  lifecycle PR openclaw#103072 cites synthetic coverage, not a human duplicate-callback
  incident; a violated SDK single-completion contract now fails visibly.
- A same-user runtime mutation after seed validation is no longer re-read.
  Feature PR openclaw#161709 cites fixture proof, not a report requiring that duplicate
  validation; the next normal resolution validates concrete state again.

No signing, entitlement, bundle ID, permission, protocol, schema, or dependency
changes. Phase E session memory is untouched. Native build/test verification
is still running; app-hosted macOS execution requires a disposable OS environment.

* refactor(wear): retain pulse polling lifecycle guards

Drop the wave-5 pulse polling simplification after independent review raised uncertainty around late non-cancellation errors. Restore the production owner and lifecycle test byte-for-byte to the bundle base; keep the rest of the Android/Linux and Apple bundle unchanged.

* refactor(apps): retain established Wear and screenshot paths

Drop Wear channel claim cleanup after review identified stale claims displacing newer active Talk owners. Restore its complete lifecycle regressions. Drop ChatProTab and OpenClawBrand cleanup after the hosted iPad screenshot timeout did not reproduce in serial exact head/base replays; no claim of a proven timeout repair. Keep independent Android DNS and JPEG performance fixes and the remaining y18/y19 native-app cleanup.

* refactor(apps): drop Linux lifecycle cleanup from bundle

Apply the coordinator drop-hunks rule after the Linux onboarding Review permissions test reached Connection Settings instead of Native permissions. Routing owners are unchanged; without conclusive Linux replay, restore all y18 Linux runtime files to origin/main c975ae3. Preserve Android and Apple cleanup, including the DNS and JPEG fixes. Park the original Linux hunks separately for native investigation; no timeout repair or inherited-red attribution claimed.

* refactor(apps): drop shared chat RPC consolidation

Restore the existing iOS/macOS adapters, shared extension and tests after the exact-head shared Periphery intersection reported the moved pager and metadata identities unused in both consumers. Apply the coordinator drop-hunks rule rather than suppressing the scanner or rerunning CI for green. Preserve route/server-lease authority and macOS no-retry compaction.

* refactor(android): drop chat cleanup after native fixture failure

Apply the coordinator changed-path drop rule after ChatCompletedWorkLayoutTest.completedWorkSummaryKeepsEarlierToolFailureVisible timed out waiting for refreshed tool-error history in third-party CI. Restore chat models, cache, controller, swarm and associated test deltas as one conservative unit. No causal timing repair or inherited-main attribution is claimed. Keep both Android DNS and JPEG fixes and retained Apple cleanup.
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 feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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