Skip to content

fix: restore Git release selection after a macOS self-install refusal - #200876

Open
roboclaw-bot wants to merge 2 commits into
mainfrom
roboclaw/ur-200833
Open

roboclaw-bot wants to merge 2 commits into
mainfrom
roboclaw/ur-200833

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Reported by @hannesrudolph.

Work sessions

Linked for team reference; these sessions aren’t public.

What Problem This Solves

A dashboard update that first converts a macOS Git installation to the release launcher can select its target before launchd refuses the service rebind. The old Gateway stays healthy, but the selected target has never started and cannot recover through the launcher. This PR repairs that refused-update settlement; Gateway-initiated conversion itself still needs an external native service context.

Related: #200833.

User Impact

The refused conversion fails explicitly, preserves the serving Gateway, records the external-shell service action as owed, and restores the captured previous release selection when its exact trial is still unstarted. Started trials, newer publications, replaced links, and changed fallback builds retain their recovery facts. The LaunchAgent self-install guard remains intact.

Why This Change Was Made

The release publication owner now returns the selected link identity, previous release identity, and exact initial trial identity/content. Its compensation uses the existing release-link compare-and-switch operation under the original update executor. The service-recovery owner invokes it only for the native pre-write self-install refusal during conversion, then returns failure instead of proceeding with target activation or plugin convergence.

This rollback is safe for this refusal because the native guard precedes definition publication and service stop, and the unchanged initial trial proves the launcher has not imported the target. Git-release startup migrations and post-activation plugin convergence have not run. This restores selection only; it performs no service restart or data rollback. The installed updater must contain the repair.

The handoff currently starts a detached child on macOS; its separate service launcher is systemd-only. detached: true changes the process session, without proving escape from launchd ancestry or resource-coalition membership. The existing macOS restart/park handoff also spawns a detached shell, accepts only lifecycle modes, and cannot execute a service-definition rebind. The root-spawner-v1 capability check binds the command/executor/root; it does not grant native same-service installation. Service-command root verification and live Gateway build-ID verification remain separate activation requirements. Both observed builds reported 2026.11.4, so version equality is insufficient.

Evidence

  • The combined owner-boundary regression was red on base 9618c4116960556e5519dd4c3eee404423a93318: the real native guard refused installation, only launchctl reads occurred, and the target remained selected. It is green with the repair, retaining the incumbent PID/build/readiness facts and owed action without verifying the target.
  • Started-trial, newer-publication, replaced-link, and changed-fallback refusals pass. Existing external conversion fixtures, already-converted activation, same-version build-ID checks, and startup recovery pass.
  • Retained implementation proof at 883e996ccb263ef650f5a537fed03170aa481024: all 94 distinct focused tests across five named files passed, including the combined refusal regression and service caller suite (39 tests, 9.02 seconds). Node sibling proof: 93 tests, 28.63 seconds.
  • Current test-only repair at 5fa21d8475b66bb2d22af95a45abc11c1f7f9c70: the named conversion regression passes (1 test, 7.68 seconds including setup; test body 162 ms). Touched-file CI-core typed oxlint, formatting, and git diff --check pass. Production code is unchanged.
  • Prior CI run 44205334762, job 134470592691 failed mock-exports on 883e996ccb263ef650f5a537fed03170aa481024: the runtime mock replaced the real exports. It now forwards the real module and preserves unaffected defaultRuntime methods, overriding only log and error. No isolation annotation, baseline, or script was changed. The old run is not green proof for this head; current-head CI is pending.
  • CI-core typed oxlint of all eight touched TypeScript files, formatting, and git diff --check pass. No broad local build/test/type/lint run was used.
  • pr-simplify: selection stays with the existing release owner; service compensation stays with the existing recovery owner. No executor, config, persistent store, protocol bump, service-guard exception, or parallel pointer manager was added. Against the task base: production +118 lines, tests +247 lines, docs +9 lines. The growth carries exact publication evidence and refusal settlement; no existing owner was duplicated.
  • Independent autoreview: Shared autoreview (Codex), medium reasoning, P0–P2, complete local snapshot against 9618c4116960556e5519dd4c3eee404423a93318, committed unchanged as 883e996ccb263ef650f5a537fed03170aa481024: scoped-clean, no actionable findings. Native observations and CLI child transport remain fixture boundaries. Fresh review of the test-only repair against 883e996ccb263ef650f5a537fed03170aa481024, committed unchanged as 5fa21d8475b66bb2d22af95a45abc11c1f7f9c70: scoped-clean at P0–P2; the reviewer verified the module spread against the scanner contract. The original production review remains applicable.
  • Native macOS and stable-to-candidate upgrade proof were not run; this Linux lane has no native macOS host and allocates no remote host. PR CI supplies broad build/test coverage; its runtime and result are pending.
Focused validation commands and cost
# Current test-only CI repair:
timeout 180 node scripts/run-vitest.mjs src/cli/update-cli/update-command-git-release.test.ts --maxWorkers=1

# Retained implementation proof at 883e996ccb263ef650f5a537fed03170aa481024:
timeout 180 node scripts/run-vitest.mjs src/cli/update-cli/update-command-git-release.test.ts src/cli/update-cli/update-command-service.test.ts --maxWorkers=1

OPENCLAW_VITEST_RUNTIME=node OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1 timeout 180 node scripts/run-vitest.mjs src/infra/git-release.test.ts src/infra/update-runner-git-release.test.ts src/cli/update-cli/update-command-verification.test.ts src/cli/update-cli/update-command-service.test.ts --maxWorkers=1

OPENCLAW_LINT_TOOL=oxlint timeout 120 node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/cli/update-cli/update-command-git-release.test.ts src/cli/update-cli/update-command-service.ts src/cli/update-cli/update-command-service-recovery.ts src/infra/git-release.ts src/infra/git-release.test.ts src/infra/update-run-result.ts src/infra/update-runner-git-release.ts src/infra/update-runner-git-release.test.ts

The modified release-owner test bodies total about 4.5 seconds and the runner test bodies about 0.74 seconds; their combined Node shard wall time was 10.95 seconds, including imports and worker setup. At the implementation head, the regression body took 174 ms and its two-file caller run took 9.02 seconds including setup. The current test-only repair run took 7.68 seconds including setup, with a 162 ms test body. Current-head CI seconds are pending.

The first sibling run exposed two synthetic Linux service fixtures without the manager UID required by the current planner. Supplying that native observation repaired the fixtures; no service-identity guard or expected result was relaxed. The conversion runner's smoke fixture now reports its candidate's actual version so the test also proves successful publication, rather than only observing the earlier fallback-build call.

Current-source trace and native acceptance procedure

Current main was rechecked through the GitHub API at b08cf89ca9ecb601e519d130c4a7ec3457c0a1ab (11 commits after the task base); none of those commits changes the affected owners. The source links below pin the equivalent earlier main snapshot 82a38fb2fe944b76c0604bb8ee1e0697404e64cd. API history identifies #199706 (6747b1ec5ae3de93c92c50d37b51c33ee3370d50) as the release-conversion introduction.

The production route is update.run → managed handoff → Git-release publication → service reconciliation/activation. The native membership guard checks ancestry and native containment, including reparented children. A never-started target bypasses the launcher's startup recovery.

The focused regression composes publication, restart orchestration, the real LaunchAgent installer/native guard, selection compensation, and real update-history/owed-step owners. Native observations and child transport are fixtures. It does not prove a real launchd handoff escapes its job or that a native successor starts.

Native proof must use a dedicated macOS test account/installation and the reviewed updater build:

  1. Begin with the loaded LaunchAgent launching <checkout>/dist/index.js, with no existing release-launcher conversion. Record pnpm openclaw gateway status --deep --json, including .rpc.server.buildId, the native PID, the plist bytes, and checkout dist/build-info.json. Use a distinct target build with the same package version.
  2. Click Update in that Gateway's Control UI. During rebind, capture the Gateway/helper/updater/installer PID and PPID chain, ps -o pid,ppid,pgid,sess,command -p <pids>, read-only launchctl print gui/$(id -u)/<label>, and read-only launchctl print pid/<pid>. If PID inspection is denied, retain that result and the existing native coalition fallback's observation. Capture which ancestry/containment branch makes isCurrentProcessInsideLaunchdService return true/false. Do not unset markers or issue native service mutations outside the service owner.
  3. For the refused path, require the same old PID/build to remain reachable with /readyz HTTP 200, the previous release selected, the owned unstarted trial retired, an explicit failed result, and service-definition owed with the external-shell action. A changed or started trial must remain available for its existing recovery owner.
  4. A future activation repair needs proof that an existing legitimate executor runs outside the original launchd job. Then repeat the combined dashboard conversion: the loaded definition must name the stable launcher, a successor PID must report the target build ID, service-root verification must pass, and the trial must settle. A matching package version or a capability-check exit code is insufficient. Without that external-context proof/design, stop before introducing an executor or authority surface.
  5. Separately verify conversion from an independently opened external terminal using pnpm openclaw update --yes, then another dashboard update after conversion. Compare target build IDs and confirm the already-converted launcher definition remains unchanged. Finally exercise a latest-stable-to-candidate upgrade in the same isolated native installation before claiming upgrade proof.

Restore only the captured, never-started conversion selection after the native self-install refusal. Keep the previous Gateway serving, preserve changed trial recovery, and report the owed external service action.

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

clawsweeper Bot commented Nov 18, 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 cli CLI command changes size: M labels Nov 18, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 18, 2026
Forward the real runtime module and defaultRuntime methods while mocking only log and error. Repair the mock-exports CI failure without isolation annotations or baseline changes.

Co-authored-by: steipete <[email protected]>
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 18, 2026
@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Restores the previous Git release selection when macOS refuses the first LaunchAgent conversion before the target starts.

Example: A dashboard update selects target-build while serving-build remains running as PID 4242, then launchd installation is refused.

  • Before: The target remains selected with an unstarted trial while PID 4242 continues serving the old build.
  • After: The previous release is selected again, the unchanged unstarted trial is removed, and the update fails with the external service action recorded as owed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) A useful, focused patch with no identified introduced defect, but fixture-based validation does not satisfy the required native behavior and upgrade proof.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: A refused dashboard conversion leaves a target selected that never started while the previous Gateway continues serving.
Reason: The maintainer-authored direction addresses a concrete recovery defect and explicitly leaves successful conversion with the linked issue.

Regression provenance

Regression provenance — verified: source commit 6747b1ec5ae3 by Ayaan Zaidi; canonical PR #199706 (blame-to-merge-commit).

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this maintainer-authored PR provides useful recovery for a confirmed failed-conversion path; source review found no discrete introduced defect.

Priority: P1
Reviewed head: 5fa21d8475b66bb2d22af95a45abc11c1f7f9c70

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted native macOS dashboard-refusal evidence showing restored selection, retired unstarted trial, unchanged serving PID/build/readiness, and an explicit failed outcome, plus latest-stable upgrade evidence preserving settings and data.
Agent review details

How this fits together

The managed updater publishes a Git release, then reconciles the native Gateway service; the release owner compensates a refused conversion while the service owner records failure and preserves the incumbent Gateway.

flowchart TD
 A[Dashboard update] --> B[Managed updater]
 B --> C[Git release publication]
 C --> D[Native service rebind]
 D --> E[Self-install refusal]
 E --> F[Restore unstarted selection]
 F --> G[Failed update with owed action]
Loading

Technical review

Best possible solution:

Keep refused-conversion recovery in the existing release and service owners, preserving the native safeguard and the separate activation work in #200833.

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

The linked report supplies native refusal and build-ID traces, and current source confirms publication precedes rebinding without compensation; this review ran no target code.

Is this the best way to solve the issue?

This is a focused recovery repair: publication captures its own compensation evidence, service recovery invokes it at the pre-write refusal boundary, and every production hunk serves that invariant.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Git release publication and trial recovery keeps the original intent (6747b1e: Move Git installs behind a stable release link, with launcher-owned recovery after failed target starts.)
  • Service reconciliation and deferred repair keeps the original intent (89924a8: Keep failed service-definition refreshes recorded as owed rather than forgetting them after an update.)
  • Failed restart observation keeps the original intent (97c7b35: Preserve verified service facts and original failure outcomes during managed update recovery; the changed run reference retains the captured executor context.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 6747b1e adds src/infra/git-release.ts:82 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6747b1ec5ae3; files: src/infra/git-release.ts)
  • Peter Steinberger: Raw commit 56689a9 adds src/cli/update-cli/update-command-service.ts:508 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 56689a9fd666; files: src/cli/update-cli/update-command-service.ts)
  • Jason (Json): Raw commit 89924a8 adds src/cli/update-cli/update-command-service.ts:529 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 89924a893846; files: src/cli/update-cli/update-command-service.ts)

PR surface

Source +118, Tests +247, Docs +9. Total +374 across 9 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 5 131 13 +118
Tests 3 253 6 +247
Docs 1 9 0 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 393 19 +374

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.

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +131/-13 LOC; tests +253/-6 LOC Growth carries publication evidence and refused-conversion compensation, with a combined owner-boundary regression and distinct recovery-preservation cases.

Root-cause cluster

Relationship: partial_overlap
Canonical: #200833
Summary: The canonical issue covers successful dashboard conversion and refused-conversion recovery; this PR implements the recovery portion.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Two reported Git-install profile updates failed activation and left an unstarted target selected, although their previous Gateways remained available.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

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 17, 2026, 7:40 PM ET / November 18, 2026, 00:40 UTC.

This branch has not been deployed

No deployments
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 P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant