Repository navigation
fix: let Doctor repair a Git checkout install after its first update (2026.12.1) - #205804
Conversation
…penclaw#204676) * fix(doctor): treat a Git checkout's forwarded service as its own A Git checkout install keeps the service that `openclaw gateway install` wrote for the checkout's `dist/index.js`; after the first release update the checkout's entry forwards to the release launcher. Service ownership still read the checkout as the service's package root, while Doctor runs from the release, so `openclaw doctor --fix` and `openclaw update repair` refused with "the service belongs to a different OpenClaw installation" and `gateway status` reported a false CLI/service version drift. Service layout now follows the same forwarding marker the entry follows, and such a definition is kept unchanged like one naming the launcher. * fix(doctor): limit forwarded-service ownership to Git checkouts Follow the forwarding marker only for a Git checkout or linked worktree, resolve the tree's real path before the release guard, require the release entry to exist, and check only the service's entrypoint when keeping its definition. Package trees keep their own service staging. * docs(update): say which installs keep or restage a checkout service (cherry picked from commit 04d9699)
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesRecognize forwarded Git checkout services as belonging to their selected release while preserving their service definitions. Example: A systemd service still starts /home/appuser/openclaw/dist/index.js after the checkout's first release update.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it backports a verified main fix to an affected release branch, and no actionable patch defect was found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherService layout translates installed service commands into effective package identities consumed by Doctor, update repair, and Gateway status. flowchart TD
A[Installed service command] --> B[Checkout entry]
B --> C[Forwarding marker]
C --> D[Release launcher]
D --> E[Selected release]
F[Service layout resolver] --> C
F --> E
F --> G[Doctor repair and status]
Technical reviewBest possible solution: Carry the existing shared identity repair onto the release branch while retaining the package-switch override. Do we have a high-confidence way to reproduce the issue? The release-base resolver demonstrably leaves forwarded checkout entries pointing at the checkout, matching the supplied systemd Doctor refusal; fetched main already contains the repair, and this review ran no target code. Is this the best way to solve the issue? The patch fixes identity at the shared resolver used by the affected consumers, follows the existing forwarder contract, and preserves foreign-installation comparison without adding persistent state or configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f7c8162d8304; fix evidence: commit 04d96995063b, main fix timestamp 2026-11-24T14:30:39Z. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +77, Tests +82, Docs +7. Total +166 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 26, 2026, 1:55 AM ET / 06:55 UTC. |
|
Raw step output from the four Docker cells behind this PR's Evidence section, printed from each cell's own recorded files (paths are inside the containers). Exit codes for Doctor and repair are the R1, red: unmodified `release/2026.11.15` `ae07e2709f3`G1, green: this commit `acd794e06f8`N1, negative control on `acd794e06f8`P1, adjacent guard: npm 2026.11.10 updated by its own updater to a pack of `acd794e06f8` (2026.11.31, unpublished), then Doctor |
0d1f92e
into
openclaw:release/2026.12.1
Port of #204676 (merged to
mainas04d96995063) torelease/2026.11.15.What Problem This Solves
On a Git checkout install,
openclaw doctor --fixfails after the first update with "the service belongs to a different OpenClaw installation", although the Gateway service is the installation's own.openclaw update repairstops at the same refusal, andopenclaw gateway status --deepreports that the service runs an older version than the CLI.release/2026.11.15carries Git release mode (#199706) but not this fix, so every Git install that set up its service before updating to a 2026.11.15 build loses the repair path the update messages point to.User Impact
User impact: on a Git checkout install running a 2026.11.15 release,
openclaw doctor --fixandopenclaw update repairrun their maintenance, andgateway statusstops reporting a false version drift. A service that really belongs to another installation is still refused. No configuration, state or service definition changes.Why This Change Was Made
The branch still has the defect. Service ownership on
release/2026.11.15(ae07e2709f3) follows only a unit that names the release launcher:src/daemon/service-layout.ts:171:return resolveGitReleaseEntrypointForLauncher(entrypoint) ?? entrypoint;src/update/run.ts:476-486(markForwarding) writes the checkout's forwarding marker (.git/openclaw-launcher) on the first Git release update, so the checkout'sdist/index.jsstarts the release, while ownership still reads the checkout as the service's package root.This is one
git cherry-pick -x 04d96995063commit. It makes service layout follow the same forwarding marker the checkout's entry follows, and keeps such a definition unchanged like a unit that names the launcher. The reasoning and design are in #204676.Conflict. The pick conflicts in one expression,
refreshDefinitioninsrc/cli/update-cli/update-command-service-plan.ts, because this branch already has #204835 (a Git install switching back to the npm package rebinds its owned definition). The resolution keeps both intents and is the formmainhas: the package override stays first, and the forwarded-checkout exclusion applies only on the Git side.After the pick,
update-command-service-plan.ts,service-layout.tsanddocs/cli/update/how-updates-run.mdare byte-identical toorigin/main. The hunks ingit-release-paths.tsandgit-release.test.tsare identical to the original commit's; those two files differ frommainonly by latermaincommits this port does not carry. Nothing else frommainrides along (5 files, +176/−10). The commit keeps the original author and the(cherry picked from commit …)line.Update behavior: the fix runs in the release that Doctor and
update repairexecute, so an install gets it with its next ordinaryopenclaw updateto a release that contains it. The installed updater's code is not involved.Evidence
Cells: Linux Docker, real systemd user Gateway from
openclaw gateway install, a Git checkout installed and built at T0 =release/2026.11.15headae07e2709f3(2026.11.15-beta.1), a 512 MiB agent database under 1 MiB/s Gateway-gated writes. Every update isopenclaw update --yes --json(triggerapi, threeupdate.run … actor=gateway-clientjournal lines per cell). T and T+1 are unpublished version bumps (2026.11.15-p1115r.1/.2 in red, 2026.11.15-p1115g.1/.2 in green) of the code under test. Each cell ran once.ae07e2709f3(cell R1)acd794e06f8(cell G1)gateway status --deepdoctor --fix --non-interactive --yesgateway restartupdate repairopenclaw triageExecStart=… /home/appuser/openclaw/dist/index.js gatewayExecStart=… /home/appuser/openclaw/dist/index.js gatewayIn both cells the checkout's
.git/openclaw-launchernames~/.openclaw/git-install/openclaw-launcher.mjs,git-install/openclawlinks to the release Doctor runs from, and after the last step the Gateway served T+1 (/readyz200).RED, unmodified
release/2026.11.15(ae07e2709f3), cell R1:red-R1-replay.mp4
GREEN, this commit (
acd794e06f8), cell G1:green-G1-replay.mp4
The recordings replay each cell's own step outputs; they are not live captures.
Negative control (cell N1, same T0 → T on this commit): a copy of the checkout without the forwarding marker installs the service (
node ~/other-openclaw/openclaw.mjs gateway install --force, older-binary guard waived for that one command), and its Gateway serves (2026.11.15-beta.1,MainPID=11803,/readyz200). Doctor still refuses it: exit 1 in 2.1 s with the unchanged "belongs to a different OpenClaw installation" message, and the same Gateway keeps running.openclaw gateway install --forcefrom the release CLI then writesExecStart=… ~/.openclaw/git-install/openclaw-launcher.mjs gateway, and Doctor passes (exit 0, 62 s). G1 also ran these two steps at its end, but there the copy's Gateway exited (status=78/CONFIG) before Doctor ran, so Doctor took the stopped-service path; that run is not used as evidence.Adjacent guard and published driver (cell P1): npm
openclaw2026.11.10, the currentlatest, with its systemd user service, updated by its own shipped updater to a pack of this commit served as the registry'slatestunder the unpublished version 2026.11.31: exit 0 in 175 s, outage 72 s, serving 2026.11.31 (acd794e). Thenopenclaw doctor --fix --non-interactive --yeswith the Gateway running: exit 0 in 49 s, "Gateway restarted and verified after Doctor maintenance" (PID 4558 → 7871, outage 32 s), unit unchanged (ExecStart=… ~/um/npm/lib/node_modules/openclaw/dist/index.js gateway). An npm tree has no.git, so the new rule does not apply there.Decisive raw lines
Raw step output of all four cells (R1, G1, N1, P1): this comment. The full cell directories are not attached: GitHub's attachment upload accepts media only and rejected the zip.
Checks on
acd794e06f8OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/infra/git-release.test.ts. With this commit's test file on the unmodified branch (ae07e2709f3), 4 of 44 fail: the three forwarding cases (expected { kind: 'foreign' }) and the other-state-directory case (expected '1.0.0' to be '3.0.0'), the same failures fix: let Doctor repair a Git checkout install after its first update #204676 recorded onmain. On this commit, 44 of 44 pass. The test file is carried unchanged; I audited all of it and removed nothing.src/daemon/service-layout.test.ts(15),src/cli/daemon-cli/status.gather.test.ts(61),src/cli/run-main-service-installation.test.ts(8),src/commands/doctor-maintenance.{installation,service-identity,service-inspection}.test.ts(33 + 1 skipped, 4, 2),src/infra/restart-intent.test.ts(13),src/update/convert-service.test.ts(4),src/cli/update-cli/update-command-service-{maintenance,install-root,plan}.test.ts(40, 4, 41), and fix: let a Git install switch back to the npm package #204835's tests, which cover the other side of the conflict:update-command-target.git-to-package.test.ts(3) andupdate-command-original-service.test.ts(50). Alsoupdate-command-checkout-link-switch.test.ts(9),src/commands/doctor-gateway-services.authority.test.ts(21),src/infra/update-runner-git-release.test.ts(39),test/scripts/update-restart-module-outcome.test.ts(1).test/scripts/eager-import-closure.test.ts: 23 of 23 pass with a defaultpnpm install. Under the hoisted install I first used, 8 cases fail withENOENT … packages/markdown-core/node_modules/mdast-util-from-markdown; that is the install layout, not this change.src/cli/update-cli/update-command-rollback.test.ts: 49 passed, 1 failed (excludes a competing config writer …, setgid mode0o2770on macOS). It fails the same way on the unmodifiedae07e2709f3.pnpm tsgo:coreandpnpm tsgo:core:test: pass.node scripts/run-oxlint.mjsandoxfmt --checkon the touched files: clean.git diff --check: clean.scripts/check-session-identity-ratchet.mts --base origin/release/2026.11.15 --no-merge-base): OK.autoreview(Codex, branch mode againstorigin/release/2026.11.15): scoped-clean, no findings. It checked that the resolution keeps fix: let a Git install switch back to the npm package #204835's package override and that forwarding to another installation does not grant ownership.Reproduce
release/2026.11.15(pnpm install,pnpm build:runtime,pnpm add --global openclaw@link:<checkout>), setupdate.channeltodev, and runopenclaw gateway installso the systemd user unit starts<checkout>/dist/index.js.mainat a version bump of the same tree and runopenclaw update --yes.openclaw doctor --fix --non-interactive --yes. Unmodified branch: exit 1, "the service belongs to a different OpenClaw installation". With this commit: exit 0, Gateway restarted and verified.Not proven
update-command-rollback.test.tsfails one macOS-only case locally (also on the base); CI runs it on Linux.src/infra/git-release.test.tsunder Bun, where the file skips itself (a skip that predates fix: let Doctor repair a Git checkout install after its first update #204676). Its regression cases ran under Node locally, as listed above.