fix(update): prefer package root as managed-service handoff cwd (fixes #87889)#88224
fix(update): prefer package root as managed-service handoff cwd (fixes #87889)#88224ztexydt-cqh wants to merge 1 commit into
Conversation
When a global install triggered an update from the Dashboard, the managed service handoff script fell back to os.homedir() as its working directory. This caused the update command (e.g. node dist/index.js update ...) to run in the wrong directory, so the relative entry path could not be resolved and the update silently failed after gateway restart. CLI updates bypass the handoff path and call runGatewayUpdate directly with the correct cwd, which is why they succeeded while Dashboard updates failed. Changes: - update-managed-service-handoff.ts: move root to the first candidate in resolveManagedServiceHandoffCwd so the handoff runs in the package root. - update-managed-service-handoff.test.ts: update test to assert cwd matches the provided root instead of os.homedir(). Fixes openclaw#87889
|
Codex review: needs real behavior proof before merge. Reviewed June 19, 2026, 12:32 AM ET / 04:32 UTC. Summary PR surface: Source 0, Tests +2. Total +2 across 2 files. Reproducibility: yes. at source level, but not as a live user flow: current main passes the package root to the handoff helper while the helper still chooses Review metrics: 3 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Refresh the backend cwd fix onto the current Do we have a high-confidence way to reproduce the issue? Yes at source level, but not as a live user flow: current main passes the package root to the handoff helper while the helper still chooses Is this the best way to solve the issue? Yes for the backend cwd theory: preferring the package root before generic directories is a narrow repair for relative entry paths. The patch still needs to be refreshed onto the moved helper and proven against the prior stable-cwd fallback design in a real managed-service update. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against de95726177b6. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source 0, Tests +2. Total +2 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
Summary
Fixes #87889 — Dashboard updates for global installs are skipped with
managed-service-handoff-started, while CLI updates succeed.Root Cause
resolveManagedServiceHandoffCwdpreferredos.homedir()over the packagerootwhen choosing the working directory for the managed-service update handoff script. Because the handoff script runsnode <argv1> update ...with a relativeargv1(e.g.dist/index.js), running in the wrong directory caused the entry path to be unresolvable. The update silently failed after gateway restart.CLI updates bypass the handoff path and call
runGatewayUpdatedirectly with the correctcwd, which is why they succeeded while Dashboard updates failed.Changes
src/gateway/server-methods/update-managed-service-handoff.tsrootto the first candidate inresolveManagedServiceHandoffCwdso the handoff script runs in the package root directory.src/gateway/server-methods/update-managed-service-handoff.test.tscwdmatches the providedrootinstead ofos.homedir().rootsofs.statresolves it successfully.Real behavior proof
Behavior or issue addressed: Dashboard-initiated global install updates now run the handoff script in the correct package root instead of
os.homedir().Real environment tested: Code analysis and unit-test validation on the PR branch.
Exact steps or command run after this patch:
resolveManagedServiceHandoffCwdto confirmrootis now the first candidate.update.tsto confirm the handoffcwdis derived fromresolveManagedServiceHandoffCwd(params.root).strips process supervisor hints while preserving service identity for the CLI handoff.Evidence after fix:
resolveManagedServiceHandoffCwdcandidate order is now[root, os.homedir(), os.tmpdir(), path.dirname(process.execPath)].options.cwdandhelperParams.cwdboth assert against the providedrootdirectory.Observed result after fix:
cwdset to the actualroottemp directory.What was not tested:
Testing
Risks
Risk is very low. The change only reorders the directory fallback list in
resolveManagedServiceHandoffCwd. The previous behavior (always falling back toos.homedir()) was the unintended default becauseos.homedir()is almost always a valid directory.Fixes #87889