Skip to content

fix(update): preserve Homebrew service paths - #154494

Merged
RomneyDa merged 1 commit into
extended-stable/2026.8.33from
backport/homebrew-update-ownership
Sep 21, 2026
Merged

RomneyDa merged 1 commit into
extended-stable/2026.8.33from
backport/homebrew-update-ownership

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

Related: #141011

What Problem This Solves

Fixes an issue where users updating a Homebrew formula installation from the 2026.7 train to 2026.8.33 would receive the generic “could not determine global package manager” refusal from openclaw update. It also prevents newly installed or refreshed Gateway and node LaunchAgents from pinning a versioned Homebrew Cellar path that stops resolving after the next brew upgrade.

Why This Change Was Made

This is a branch-native backport of the Homebrew ownership and stable-service-path repair from #141011 / 8db38db91191fd5ff3db2b6398df5299b82d9fb1, originally authored by @maxsxu.

The updater now recognizes only verified openclaw-cli formula layouts and prints the owning brew upgrade openclaw-cli workflow. Service argument generation maps the exact formula package root to Homebrew’s stable opt/openclaw-cli path. npm, pnpm, Bun, source, Windows, unrelated Cellar paths, and npm installs located under a Homebrew prefix keep their existing behavior.

Unlike the newer upstream branch, this release branch does not trust ambient HOMEBREW_PREFIX; custom prefixes are accepted only when the trusted brew executable reports an exact matching brew --prefix. The older release-branch updater error contract is preserved rather than importing newer updater outcome types.

User Impact

Homebrew users get actionable update instructions, and refreshed Gateway/node service definitions survive formula version changes. Existing services that already contain a versioned Cellar path can be repaired after upgrading with openclaw gateway install --force.

No config, environment, SQLite, dependency, package, protocol, or migration surface changes.

Evidence

Pre-fix regressions failed for the intended reasons:

  • src/cli/update-cli/shared.command-runner.test.ts: formula install received the generic package-manager refusal instead of Homebrew guidance.
  • src/daemon/program-args.test.ts: Gateway and node service arguments retained versioned Cellar paths instead of the stable opt path.

Post-fix proof:

  • node scripts/run-vitest.mjs src/cli/update-cli/shared.command-runner.test.ts — 15/15 passed.
  • node scripts/run-vitest.mjs src/daemon/program-args.test.ts — 36/36 passed.
  • node scripts/run-vitest.mjs src/infra/brew.test.ts — 7/7 passed.
  • node scripts/run-vitest.mjs src/daemon/runtime-paths.test.ts — 59/59 passed.
  • pnpm tsgo:core and pnpm tsgo:core:test — passed.
  • targeted core oxlint, pnpm check:coercion-helpers, pnpm check:import-cycles, pnpm docs:check-mdx, pnpm docs:check-links, and git diff --check — passed.
  • pnpm build — passed, including declarations and runtime postbuild.
  • Fresh uncommitted autoreview — scoped-clean, no accepted/actionable findings.

Built-flow proof used an isolated custom-prefix formula fixture with a versioned Cellar package and an opt symlink:

  • Built openclaw update --yes --no-restart exited without mutating the formula and printed brew upgrade openclaw-cli plus the Gateway restart command.
  • Built Gateway and node service argument resolvers both emitted the stable opt/openclaw-cli/.../dist/index.js entrypoint rather than the versioned Cellar path.
  • A real native service mutation was intentionally not performed: the isolated-state safety gate correctly refuses LaunchAgent installation outside canonical operator state, and the host Gateway/service was not touched.

check:changed passed its release-base conflict-marker, ratchet, changelog, dependency, duplicate-coverage, and formatting phases. Its later plugin-boundary report is independently red on this frozen release base because six untouched compatibility records are calendar-due on 2026-09-21; all changed-surface type, lint, import-cycle, docs, test, and build owners were run directly above.

Closeout: production +39/-1, tests +91/-1, docs +16/-0. The positive production delta establishes two required owner boundaries that the release branch lacks: exact formula ownership verification and the shared stable service entrypoint mapping. The existing stable Node helper is Node-formula-specific and cannot represent the OpenClaw package root; reusing it would conflate unrelated ownership contracts.

Backport the Homebrew updater ownership and stable opt-path repair from upstream PR #141011 / commit 8db38db.

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

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

@RomneyDa
RomneyDa marked this pull request as ready for review September 21, 2026 06:12
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes size: S maintainer Maintainer-authored PR labels Sep 21, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 2:30 AM ET / 06:30 UTC (Revision 2).

ClawSweeper review

What this changes

The branch gives Homebrew installations actionable update guidance and generates stable Homebrew paths for Gateway and node services.

Merge readiness

✅ Ready for maintainer review

No blocking findings. This remains a useful extended-stable backport despite the upstream fix on main; the previous data-model migration blocker is unsupported by the diff.

Priority: P2
Reviewed head: b97cc68583a3e8886ebc2040f31328856ce6f213

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable backport with relevant regression coverage and no supported correctness or migration blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external-contributor gate. Its body reports built updater and service-resolver fixture coverage, while explicitly excluding real Homebrew upgrade and native-service restart coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor gate. Its body reports built updater and service-resolver fixture coverage, while explicitly excluding real Homebrew upgrade and native-service restart coverage.
Evidence reviewed 10 items Pinned backport scope: The introduced delta changes Homebrew detection, shared service arguments, regression tests, and update documentation. Live REST metadata confirms the PR remains open at the reviewed head and targets extended-stable/2026.8.33. The verified test merge has the pinned release base followed by the exact PR head.
Shared ownership boundary: The resolver matches the openclaw-cli formula's libexec layout, accepts standard prefixes or an exact executable-reported prefix, and leaves Windows and unrelated paths unchanged. resolveGlobalManager invokes it before package-manager update selection; no new configuration, database schema, persisted record shape, or dependency is introduced.
Service producer and consumers: The mapping occurs once in shared CLI argument construction, reached by both Gateway and node install plans. Wrapper and development paths retain their earlier branches. The existing LaunchAgent serializer writes these arguments without changing its format; the separate stable-Node helper handles the runtime binary rather than the OpenClaw package entrypoint.
Findings None None.
Security None None.

How this fits together

The updater identifies which package manager owns an installation before replacing files. Service installation separately builds the executable arguments saved in operating-system service definitions; both paths now share Homebrew package detection.

flowchart TD
  A[Installed package path] --> B[Homebrew layout and prefix check]
  B --> C[Update command]
  C --> D[Homebrew upgrade guidance]
  B --> E[Stable opt entrypoint]
  E --> F[Gateway and node service arguments]
  B --> G[Existing handling for other installations]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +38, Tests +90, Docs +16. Total +144 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 39 1 +38
Tests 2 91 1 +90
Docs 1 16 0 +16
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 146 2 +144

Review metrics

Metric Value Why it matters
Production versus test growth Production net +38; tests net +90; docs +16 Production growth supplies one shared formula-ownership boundary missing from the release base; the existing Node-binary resolver cannot represent that package contract.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/cli/update-cli/shared.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: partial_overlap
Canonical: #141011
Summary: The merged upstream repair addresses the same Homebrew behavior on main; this PR adapts it for a separate extended-stable branch.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep Homebrew responsible for package replacement and use one formula-path resolver for update guidance and both service types, with documented repair for older service definitions.

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

Yes, for the targeted release base: its service argument owner retains versioned Cellar entrypoints and its updater lacks Homebrew guidance. Source and reported pre-fix regressions establish the path; this review did not execute it, and current main already contains the upstream repair.

Is this the best way to solve the issue?

Yes. A shared formula resolver repairs both service producers and update detection without duplicating platform serializers or importing main's newer updater contracts; reusing the Node-only resolver would conflate distinct package layouts.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This bounded backport improves Homebrew update recovery and prevents version-pinned service entrypoints from breaking after formula upgrades.
  • 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 MEMBER-authored PR is exempt from the external-contributor gate. Its body reports built updater and service-resolver fixture coverage, while explicitly excluding real Homebrew upgrade and native-service restart coverage.

Evidence

What I checked:

  • Pinned backport scope: The introduced delta changes Homebrew detection, shared service arguments, regression tests, and update documentation. Live REST metadata confirms the PR remains open at the reviewed head and targets extended-stable/2026.8.33. The verified test merge has the pinned release base followed by the exact PR head. (b97cc68583a3)
  • Shared ownership boundary: The resolver matches the openclaw-cli formula's libexec layout, accepts standard prefixes or an exact executable-reported prefix, and leaves Windows and unrelated paths unchanged. resolveGlobalManager invokes it before package-manager update selection; no new configuration, database schema, persisted record shape, or dependency is introduced. (src/infra/brew.ts:85, b97cc68583a3)
  • Service producer and consumers: The mapping occurs once in shared CLI argument construction, reached by both Gateway and node install plans. Wrapper and development paths retain their earlier branches. The existing LaunchAgent serializer writes these arguments without changing its format; the separate stable-Node helper handles the runtime binary rather than the OpenClaw package entrypoint. (src/daemon/program-args.ts:218, b97cc68583a3)
  • Regression and compatibility coverage: Read both changed test modules and existing Brew tests. Added service cases cover three standard prefixes, an already-stable path, unrelated Cellar paths, npm, pnpm, Bun, source, and Windows path shapes through both service resolvers. Updater tests cover formula guidance, custom-prefix discovery, and unchanged refusal for an unowned npm-layout root. The supplied body reports failing pre-fix regressions and passing focused suites; this read-only review did not execute tests. (src/daemon/program-args.test.ts:525, b97cc68583a3)
  • Previous blocker resolved by source inspection: The maintainer disposition at fix(update): preserve Homebrew service paths #154494 (comment) correctly distinguishes service argument generation from a stored-data-model migration. The diff changes neither service serialization nor database/config schemas. Existing version-pinned services have a documented repair command in https://docs.openclaw.ai/install/updating#homebrew-formula-installs. (docs/install/updating.md:247, b97cc68583a3)
  • Main implementation and release distinction: GitHub confirms fix(update): support Homebrew installs and preserve stable LaunchAgent paths #141011 merged as 8db38db. Current main retains its Homebrew resolver and service mapping, while the pinned extended-stable base and latest supplied release v2026.9.5 lack the resolver. Local containing tags showed only release-publish tags, not a proven stable release containing the fix. Main implementation therefore does not replace this release-branch backport. (src/infra/brew.ts:85, 67e53329fa72)

Likely related people:

  • maxsxu: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: 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 (1 earlier review cycle)
  • reviewed 2026-09-21T06:20:40.787Z sha b97cc68 :: blocked before merge. :: none

@RomneyDa

Copy link
Copy Markdown
Member Author

ClawSweeper rank-up move disposition for reviewed head b97cc68583a3e8886ebc2040f31328856ce6f213:

  • “Add data-model compatibility proof” — not applicable. This patch does not read, write, migrate, backfill, repair, or change any persisted data model. It changes the package-owner decision in src/cli/update-cli/shared.ts before update mutation begins, and maps the already-resolved executable argument in src/daemon/program-args.ts before service serialization. There is no config, SQLite, state-store, schema, protocol, dependency, or migration delta.
  • Upgrade compatibility is the behavior under test: formula-owned Cellar paths receive Homebrew instructions and stable opt service arguments, while npm/pnpm/Bun/source/Windows/unrelated paths retain their existing outcomes. The pre-fix regressions failed on the frozen release base; the post-fix focused suites, full build, changed-surface checks, and exact-head CI are green.

No migration can or should be added for this code-only owner-boundary repair.

@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa merged commit 1175326 into extended-stable/2026.8.33 Sep 21, 2026
324 checks passed
@RomneyDa
RomneyDa deleted the backport/homebrew-update-ownership branch September 21, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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