Skip to content

fix(macos): preserve service runtime when installation loses authority - #193122

Merged
tideclaw-bot merged 2 commits into
mainfrom
fix/macos-stable-bun-install-authority
Nov 5, 2026
Merged

tideclaw-bot merged 2 commits into
mainfrom
fix/macos-stable-bun-install-authority

Conversation

@tideclaw-bot

@tideclaw-bot tideclaw-bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #186107

What Problem This Solves

Fixes: a canceled or superseded macOS Gateway installation can replace the live service runtime before rejecting the operation, and failed-install cleanup can overwrite a newer runtime replacement.

User Impact

Service updates preserve the installed executable when installation authority is withdrawn, and preserve a newer executable if another installation replaces it before failure cleanup. The stable Automation-grant path and per-build package/SQLite selection remain unchanged. No configuration migration or user action is introduced.

Why This Change Was Made

Prepare the candidate and backup privately, then recheck current update authority, cancellation, and captured service custody immediately before publication. Bind publication and rollback to the relevant file identity instead of unconditionally replacing the live path. Retain existing equal-byte no-op and partially successful first-install behavior.

This repairs the stable-runtime implementation from #186107 while preserving its contributor history. The short cross-process check-to-rename race remains outside this narrow repair; this is not a general filesystem transaction or protection against in-place edits/adversarial inode reuse.

Evidence — November 5, 2026

  • Signed head: 806d1a28986f50a1f132ba5feaed8e9500565e8c, tree 85e102dce62cca081ffca14ca5c93e78c0c294be. Independent source reviews approved the original repair and the three-file compilation/fixture/layout correction; assertions and production behavior are preserved.
  • Exact-head native CI 41956773640, attempt 1: actual checkout verified as this head, distinct from workflow harness 06951a90db7ff9265e31e67c8042053764e76289.
  • Passed: build artifacts, native/control-UI localization and generated parity, macOS packages (OpenClawKit: 2,483 tests / 222 suites; Swabble: 12 XCTest cases), release app build, and SwiftFormat.
  • GatewayProcessManagerTests and BundledRuntimeTests actually executed and passed, including all five authority-withdrawal cases, both rollback cases, and existing stable-runtime consumers. The new parameterized tests took 2.460 and 0.400 seconds respectively.
  • Broader native tests failed: job 127021576379, completed 03:27:56 UTC, reported 11 issues across DashboardNativeBrowserFailureTests (stop-settlement timeout), DashboardExperienceTests (handoff route expectation), and DashboardCloseShortcutTests (close scope timeout/window and panel expectations). Nine issues match failures in scheduled main run 41955318723, job 127014157987; the two stop-settlement timeout issues remain unclassified. Unchanged source alone is not inherited-failure proof. Bundled recovery was skipped after failure, and broader non-native CI accounting remains in progress.
  • SwiftLint's existing advisory handling returned success, but three length violations remain in unchanged DashboardManager/GatewayConnection source. This is not violation-free lint or baseline-execution proof. SwiftFormat reported no required changes.
  • Original repair patch SHA-256: e670d461c3ba4cd8c3da9f18425b30b597269f11b64f19f39302b31b2c6aaeba, based on aa401d8fbdd5ac7eb2755022744f33e996fae85b. Reviewed follow-up delta: 2f62be945ea1f9bb34c1277fa95a56b1bc9474cf715e6cd108c10e387ee15928.
  • git diff --check and test-line ratchet passed: 6,476,480 <= 6,476,564 (84 slack); no baseline/allocation changes. App/shared-kit assertion counts remain 428/1,544.

Open for review, not yet qualified to merge: focused runtime proof and builds pass, but the remaining failed-CI disposition is unresolved. Baseline-red execution, real launchd/TCC behavior, and signed stable-to-candidate upgrade remain unproved; those limitations are not claims of completed qualification. Generic installed-CLI upgrade evidence for a separate updater repair does not establish these native claims. No workflow change is part of this repair.

Prepare the stable service Bun privately, revalidate installation authority
before publication, and only roll back the executable this attempt owns.
Preserve newer replacements and existing first-install settlement behavior.

Related: #186107

Co-authored-by: RomneyDa <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 5, 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026
@clawsweeper

clawsweeper Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR prepares the macOS service executable privately, rechecks installation authority before publication, and preserves newer replacements during rollback.

Example: Installation of build B is canceled while build A uses runtime/service/bun.

  • Before: The canceled installation can replace the stable executable before rejecting the operation.
  • After: Cancellation is checked before publication, leaving build A's executable intact.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The source repair is coherent and narrowly scoped, but its changed native behavior has no qualifying execution evidence.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A rejected or failed macOS Gateway installation can change the executable used by the installed service or overwrite a newer replacement.
Reason: Preserving the installed runtime after authority withdrawal is a clear correctness requirement, and the collaborator-authored PR supplies direction while retaining the documented stable-path behavior.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this maintainer-authored PR open: it addresses a source-verifiable runtime ownership defect still present on main, and no definite introduced bug was found.

Priority: P2
Reviewed head: 765f9e6a4c5123c58065e0d89f9eea55a7010c0c

Before merge

  • Add real behavior proof - Authority-chain proof required: GatewayLaunchAgentManager consumes caller authority and captured service custody before BundledRuntime publishes runtime/service/bun; supply redacted production-path output showing an allowed install succeeds, cancellation or operator supersession before publication leaves the executable unchanged, and failed settlement preserves a newer replacement. Added tests intercept daemon execution and have no supplied current-head run; the PR explicitly leaves live launchd behavior unproved. Historical signed-update evidence in fix(macos): iMessage replies stop after app updates until Automation is re-granted #186107 covers Automation continuity, not these changed rejection and settlement paths. Redact credentials and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - No concrete bypass was found, but executable publication under withdrawn authority still needs final-effect proof.
  • Resolve merge risk - Before merge, the PR owner must establish that withdrawn installation authority prevents the final executable replacement and that failure settlement preserves an operator's newer replacement through the production path.

Findings

None.

Tests

  • Missing end-to-end proof: Missing evidence covers current-head native compilation and regression execution, baseline-red results, production-path allowed and withdrawn-authority publication plus replacement-safe settlement, and a signed v2026.10.10-to-candidate upgrade with existing settings and data intact.
Agent review details

How this fits together

The macOS app coordinates Gateway installation through GatewayLaunchAgentManager, while BundledRuntime owns executable preparation and publication at the stable service path.

flowchart TD
  A[App update or hosting change] --> B[GatewayLaunchAgentManager]
  B --> C[Private executable preparation]
  C --> D[Current authority checks]
  D --> E[Stable executable publication]
  E --> F[Bundled CLI installation]
  F --> G[Identity checked settlement]
Loading

Technical review

Best possible solution:

Retain the existing installation and runtime owners, publish only after their current authority checks, and restore only the executable owned by the failed attempt.

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

Current-main source exposes both premature executable publication and unconditional rollback; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch is a focused root-cause repair: private preparation separates expensive work from publication, existing authority owners retain the decision, and file identity limits rollback without introducing a competing owner.

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Qualify the existing repair (recommended)
    The PR owner supplies production-path evidence for an allowed installation, withdrawn authority before publication, and failure settlement after a newer executable replacement.
  2. Retain the draft
    Keep the PR unmerged until a qualified macOS environment can exercise the executable publication boundary.

Provenance checked

Testing

Proof path: none.

Security

Needs attention: No concrete bypass was found, but executable publication under withdrawn authority still needs final-effect proof.

Evidence

What I checked:

PR surface

Source +64, Tests +93. Total +157 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 106 42 +64
Tests 2 96 3 +93
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 202 45 +157

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: The repair addresses a concrete but bounded macOS service-installation defect without evidence of a widespread current outage.
  • add merge-risk: 🚨 security-boundary: The changed operation publishes an executable at a path carrying macOS Automation permissions, making current installation authority consequential at the filesystem effect.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: The repair addresses a concrete but bounded macOS service-installation defect without evidence of a widespread current outage.
  • merge-risk: 🚨 security-boundary: The changed operation publishes an executable at a path carrying macOS Automation permissions, making current installation authority consequential at the filesystem effect.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Show allowed installation and withdrawn-authority rejection at the final executable publication boundary, including preservation of a newer replacement during settlement.
  • Provide current-head native build and regression results, including baseline-red evidence.
  • Demonstrate a signed stable-to-candidate upgrade with existing settings and data preserved.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 4, 2026, 9:04 PM ET / November 5, 2026, 02:04 UTC.

Preserve throwing fixture reads outside Swift Testing macros, align standalone-session expectations with their owner, and reuse the bootstrap join. Format the service-runtime initializer without changing behavior.

Co-authored-by: RomneyDa <[email protected]>
@tideclaw-bot
tideclaw-bot marked this pull request as ready for review November 5, 2026 03:40
@tideclaw-bot
tideclaw-bot merged commit 9b03ac8 into main Nov 5, 2026
155 checks passed
@tideclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

@tideclaw-bot
tideclaw-bot deleted the fix/macos-stable-bun-install-authority branch November 5, 2026 16:50
tideclaw-bot added a commit that referenced this pull request Nov 5, 2026
Adopt complete #186107 and the four native-owner repairs from merged #193122. Preserve existing beta documentation and exclude unrelated main-only chat fixtures. Exact-candidate qualification remains with release CI.

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
openclaw#193122)

* fix(macos): preserve service runtime when installation loses authority

Prepare the stable service Bun privately, revalidate installation authority
before publication, and only roll back the executable this attempt owns.
Preserve newer replacements and existing first-install settlement behavior.

Related: openclaw#186107

Co-authored-by: RomneyDa <[email protected]>

* fix(macos): repair native qualification fixtures

Preserve throwing fixture reads outside Swift Testing macros, align standalone-session expectations with their owner, and reuse the bootstrap join. Format the service-runtime initializer without changing behavior.

Co-authored-by: RomneyDa <[email protected]>

---------

Co-authored-by: RomneyDa <[email protected]>
wangmiao0668000666 pushed a commit to wangmiao0668000666/openclaw that referenced this pull request Nov 6, 2026
openclaw#193122)

* fix(macos): preserve service runtime when installation loses authority

Prepare the stable service Bun privately, revalidate installation authority
before publication, and only roll back the executable this attempt owns.
Preserve newer replacements and existing first-install settlement behavior.

Related: openclaw#186107

Co-authored-by: RomneyDa <[email protected]>

* fix(macos): repair native qualification fixtures

Preserve throwing fixture reads outside Swift Testing macros, align standalone-session expectations with their owner, and reuse the bootstrap join. Format the service-runtime initializer without changing behavior.

Co-authored-by: RomneyDa <[email protected]>

---------

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant