Repository navigation
fix: let Doctor repair a Git checkout install after its first update - #204676
fuller-stack-dev merged 6 commits into
Conversation
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.
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.
|
🦞👀 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 a Git checkout service that forwards to the selected release as belonging to that release without rewriting its service definition. Example: A service starts /home/appuser/openclaw/dist/index.js after its checkout has updated into a managed release.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current service-ownership bug, and no concrete patch defect was found; maintainer-authored work also remains protected from cleanup. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherService layout translates a service command into its effective package root; Doctor, update repair, and status consume that identity for maintenance admission and version reporting. 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: Extend the existing service-layout owner to resolve checkout forwarding while retaining installation comparison and preserving the installed service command. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the ownership mismatch, and the supplied systemd trace demonstrates the corresponding Doctor refusal; this read-only review executed no target code. Is this the best way to solve the issue? The patch repairs the shared identity resolver used by all reported consumers and preserves the existing foreign-installation checks without adding state or configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8656b1e18257. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +78, Tests +82, Docs +7. Total +167 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:
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 24, 2026, 9:04 AM ET / 14:04 UTC. |
|
Merged via squash.
|
…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
…204676) (#205804) * 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)
…out lsof or ss (#204017) * fix: let Doctor drain a release install's Gateway on hosts without lsof or ss A release install's service runs the resident launcher, and the Gateway serves as its child. Maintenance drain accepted that child only from port listener attribution, which needs lsof or ss. Without them Doctor and update repair refused with 'Gateway process changed during maintenance drain' while the same Gateway kept serving. When the listener is unattributed, require the kernel parent of the reporting process to be the service's main process instead. * fix: also drain the launcher's Gateway when ss lists its socket without an owner ss prints a LISTEN row without process details when it cannot see the socket's owner. Treat a busy port whose listener rows all lack a PID like an unattributed one and use the kernel-parent check; rows that name a different PID still refuse. (cherry picked from commit cff8782) Backport review: #205736 changes update cohort settlement and #204676 changes Git service layout; their only overlap is the update docs. Neither is a prerequisite for resident-child proof. Co-authored-by: vincentkoc <[email protected]> Co-authored-by: RomneyDa <[email protected]>
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. The update messages and docs send users toopenclaw doctor --fixas the repair step, so every Git install that set up its service before updating loses that repair path.User Impact
User impact: on a Git checkout install,
openclaw doctor --fixandopenclaw update repairrun their maintenance while the Gateway keeps serving, andgateway statusstops reporting a false version drift. A service that really belongs to another installation is still refused, as before. No configuration, state or service definition changes.Why This Change Was Made
The installer runs
openclaw gateway installfrom the checkout, so the service starts<checkout>/dist/index.js. A Git release update deliberately keeps that definition: it writes a forwarding marker into the checkout (.git/openclaw-launcher), and the checkout's entry imports the release launcher, which starts the selected release. Doctor runs from that release and compares its own package root with the service's. Service ownership read the service's package root from the entry path alone, saw the checkout, and called the service foreign.Service layout already maps a unit that names the launcher to the release the launcher selects. It now does the same for a Git checkout entry that forwards to the launcher, reading the marker by the same rules as
release-launcher-forward.mjs: the checkout has.gitand the forwarder module, the marker names an existing launcher, the tree is not itself a release, and the selected release entry exists. Such a definition is kept unchanged, like a unit that names the launcher. Package trees are left to their own service staging.Update behavior: the fix runs in the release that Doctor and
update repairexecute, so an install reaches it with its next ordinaryopenclaw update; the installed updater's code is not involved. Nothing is left for a person to do.Evidence
Both cells: Linux, real systemd user service from
openclaw gateway install, a Git checkout installed and built at T0 =60d2ac66bb9(main), a 512 MiB agent database under 1 MiB/s Gateway-gated writes, CLIopenclaw update --yes --json(triggerapi, Gatewayupdate.run), T and T+1 are version-bump commits on top of the tested code.60d2ac66bb9(cell R1)218af41e4b9(cell G2)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 the Gateway served the target build after every step (/readyz200).Negative control (cell N1, same T0 → T on this head): 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). Doctor still refuses it: exit 1 in 2.1 s with the unchanged "belongs to a different OpenClaw installation" message, and the Gateway keeps serving.openclaw gateway install --forcefrom the release CLI then writesExecStart=… ~/.openclaw/git-install/openclaw-launcher.mjs gateway, and Doctor passes (exit 0, 78 s). (G2 tried the same step first; there the older-binary guard blocked the copy's install, so the unit stayed this checkout's and Doctor correctly ran.)Adjacent guard and published driver (cell P1): npm
openclaw2026.11.7 with its systemd user service, updated by its own shipped updater to a pack of this head (version-bumped to 2026.11.30, served as the registry'slatest): exit 0 in 158 s (triggercli, outage 57 s), serving 2026.11.30. Thenopenclaw doctor --fix --non-interactive --yeswith the Gateway running: exit 0 in 99 s, "Gateway restarted and verified after Doctor maintenance" (PID 5091 → 12768, outage 82 s). The npm package has no.git, so the new forwarding rule does not apply there.Regression tests (
src/infra/git-release.test.ts, "classifies a checkout service whose tree …"): 8 cases throughinspectManagedGatewayServiceBeforeUpdateandsummarizeGatewayServiceLayoutwith real release trees, launchers and markers. On the base production code the three forwarding cases fail (expected { kind: 'foreign' }) and the other-state-directory case reports the checkout's version; on this head all 44 tests in the file pass.Recordings (raw lines from each cell's own step outputs, host paths removed):
RED, base main, cell R1:
red-R1-replay.mp4
GREEN, this head, cell G2:
green-G2-replay.mp4
Decisive raw lines
Checks on this head
All on
218af41e4b9, the head the cells ran. The later commits are a docs wording fix and merges of main that touchsrc/commands/models/*and Doctor's tool-schema inspection, not service ownership, so the cells were not rerun:OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjsonsrc/infra/git-release.test.ts,src/daemon/service-layout.test.ts,src/cli/daemon-cli/status.gather.test.ts,src/cli/run-main-service-installation.test.ts,src/commands/doctor-maintenance.{installation,service-identity,service-inspection}.test.ts,src/infra/restart-intent.test.ts,src/update/convert-service.test.ts,src/cli/update-cli/update-command-service-{maintenance,install-root}.test.ts,src/commands/doctor-gateway-services.authority.test.ts,src/infra/update-runner-git-release.test.ts,test/scripts/update-restart-module-outcome.test.ts,test/scripts/eager-import-closure.test.ts: 15 files passed (Node runtime;git-release.test.tsskips itself under the default Bun test runtime).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 base115e7114dea.pnpm tsgo:core,pnpm tsgo:test:src: pass.oxlintandoxfmt --checkon touched files: pass.check-session-identity-ratchet.mts --base origin/main --no-merge-base,pnpm check:baseline-ratchets: pass.pnpm check:docs,git diff --check: pass.node scripts/check-changed.mjs: every lane passes except the dead-export scan, which flagsscripts/lib/release-fast-track-publication.mts(fastTrackValidationSnapshot,releaseFastTrackDigest), not touched here.Also observed, not changed here: the two other symptoms seen in earlier cells (a CLI update ending
failed/interruptedatprepare:installwhile the same run kept going, and a following update hanging inprepare:ui-build) came from an installed driver older than #204215 and #204512. On current main the same cell had both updates exit 0 (333 s, 323 s) with 11.6 s and 6.8 s outages, and the no-op update returned in 7.2 s.Update proof rules (#203915), from the cells' raw logs and the landing checks.
openclaw update --yes --jsonwithoutOPENCLAW_UPDATE_PACKAGE_SPEC,--tag,--no-restartor a shortened--timeout. In R1 and G2 the Git release hops record triggerapi, and each journal has three[gateway] update.run <runId> actor=gateway-clientlines; N1 has one. P1's update was the shipped 2026.11.7 updater (triggercli).openclaw gateway install. After each step the cell saved the full unit file, the release link, the serving version and build ID, and the database marker rows. The forwarding marker andMainPIDare in the step outputs quoted above.NeedDaemonReloadwas not captured.60d2ac66bb9and head218af41e4b9.git diff 218af41e4b9 5ec5da4bd3c -- src/infra/git-release-paths.ts src/daemon src/cli/update-cli src/updateis empty, so the receipts cover the final head. Publicnpm view openclaw dist-tagsat landing:latest2026.11.8,beta2026.11.10-beta.3,extended-stable2026.10.33..git, so the new rule cannot apply there.src/daemon/service-layout.ts,src/infra/git-release-paths.tsandupdate-command-service-plan.tsare identical betweenv2026.11.7andv2026.11.8.src/update/launcher.ts,run.ts,preflight.tsorconvert-service.ts.src/infra/git-release.test.tsunder Bun inchecks-node-changed-6, where the file skips itself (Tests 44 skipped (44)). That skip predates this PR (feat(update): run Git checkout installs from releases behind the release link #199706), so CI did not run its regression cases. They pass under Node on the exact head (OPENCLAW_VITEST_RUNTIME=node, 44 of 44).update-command-rollback.test.tspasses 50 of 50 in CI (Linux,checks-node-changed-2); its setgid failure is macOS-only. The dead-export scan (scripts/check-deadcode-exports.mts) now passes with 0 entries on the exact head, andscripts/lib/release-fast-track-publication.mtsis identical there and on currentmain.Not proven
WorkingDirectory=<checkout>still resolves to the checkout;gateway installwrites absolute entries.openclaw update --channel stable) with this forwarding service: not run. The service now gets the same verdict as a unit that names the launcher, so it follows that existing path.autoreviewdoes not run on this machine; an independent reviewer read the diff and test file instead.http 401).