Skip to content

fix(node): broken Node service suggests repairing the Gateway - #129545

Merged
steipete merged 2 commits into
mainfrom
codex/qa-node-service-correct-repair-command-20260825
Aug 27, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/qa-node-service-correct-repair-command-20260825

Conversation

@steipete

@steipete steipete commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The shared service-start code told operators to repair the Gateway when the broken installed service was a Node host. The earlier version of this PR changed the running-service hint to node restart, but native testing showed that restart does not rebuild a stale Node service definition: it retains the missing executable and can leave the service failed.

Both stopped and already-running Node services now recommend openclaw node install --force when their installed definition needs repair. Gateway keeps its existing recovery commands.

Why This Change Was Made

The fix stays in the shared lifecycle message owner. It derives the service command through the existing profile/container-aware formatter and selects restart only when the caller supplies the repair callback that can rebuild the definition. Node has no such callback; Gateway does. Redundant hint temporaries are removed, and structured install hints retain kind=install. No service lifecycle behavior, profile selection, or ownership guard changes.

Source at 32f18a840e4c1ddfff77639154d50790756ffef3:

Combined delta against 18c801daa1165f0bb7f30576b52f6642ff023233: production +8/-8, net 0; tests +91/-48, net +43. Only the lifecycle owner and its existing test file change.

Verification

  • Fail-first against the previous PR patch: four regression failures expected Node install --force but received restart. Tests now use an actually missing executable, without supplying the artificial expectedPort that the real Node caller never passes.
  • Lifecycle, response, Node daemon, Node registration, and profile suites: 188 tests passed. The final test-title clarification was followed by another 46/46 lifecycle pass; these are a rerun, not additional unique tests.
  • Full local changed-file gate: passed, including formatting, core production/core-test typechecks, type-aware changed-file lint, guards, Knip, and zero runtime import cycles. The first attempt resolved the wrong transitive Pako version because this worktree lacked its UI workspace dependency link; linking the matching private pinned install fixed the setup, without changing dependencies or source.
  • Fresh combined Codex autoreview: no accepted/actionable findings. Root review also checked the complete two-file change and the final test-title-only edit.
  • Pinned-dependency Linux pnpm build: passed. Actual native-service proof and an independent source-blind operator validation both passed. The runtime contains the production bytes in the published head; the final subsequent source edit only clarified a test title.

The native proof used Blacksmith Testbox, a dedicated disposable OS account with its canonical HOME/state and systemd user manager, and a credential-free environment. A task-owned executable was started by a real native unit and then deleted while its process remained running. No operator services were used. This proves the missing-executable recovery path; it is not provider, Gateway connectivity, or package-publication proof.

Native CLI and service evidence

Redacted excerpts from the captured native runs; isolated paths/PIDs are replaced and unrelated output fields are omitted. openclaw was invoked through the supplied built CLI executable. The old and new commands were exercised on the candidate's unchanged lifecycle implementation, not on a separately built historical binary.

The earlier proposed command did not repair the definition:

$ openclaw node restart --json
{
  "action": "restart",
  "ok": true,
  "result": "restarted",
  "service": {
    "label": "systemd user",
    "loaded": true,
    "loadedText": "enabled",
    "notLoadedText": "disabled"
  }
}

Captured native observation:
staleDefinitionRetained: true
nativeState: failed

The independent operator then followed the new hint exactly, replacing only the executable spelling with the supplied built CLI path:

$ openclaw node start
Node service already running, but its installed service definition needs repair: service command points at a missing path: <isolated-home>/openclaw-node.service-old-runtime; run `openclaw node install --force` to apply.
Node service already running (pid <original-pid>).

$ openclaw node install --force
Installed systemd service: <isolated-home>/.config/systemd/user/openclaw-node.service
Previous unit backed up to: <isolated-home>/.config/systemd/user/openclaw-node.service.bak

$ systemctl --user is-active openclaw-node.service
active

$ systemctl --user show openclaw-node.service ...
MainPID=<repaired-pid>
Id=openclaw-node.service
ActiveState=active
SubState=running

$ systemctl --user cat openclaw-node.service
[Service]
ExecStart=<isolated-home>/bin/node <isolated-home>/runtime/dist/index.js node run --host 127.0.0.1 --port 18789 --no-tls

$ openclaw node start
Node service already running (pid <repaired-pid>).

The JSON start also had no repair warning afterward. Native PID, process start time, loaded ExecStart, and the on-disk unit were checked independently of CLI success. Before repair, human/JSON starts preserved the original process and definition. Gateway human/JSON starts still recommended openclaw gateway restart and retained their original process/definition; Gateway repair was not executed. Profile and container formatting were checked separately and together, with container context winning.

A wrapper unexpectedly synchronized the source checkout despite --no-sync, so independent validation paused. The production source hash still matched the built candidate, and all dist mtimes preceded that sync. Validation resumed against a separate copied runtime mounted read-only. Its 11,793-file dist digest matched before copying, after copying, and after validation: f05c8768990097e5c7b2e05855850d678b67c4102824879cee2001e4ea79b42e. No pre-sync aggregate digest is claimed.

Cleanup passed: both disposable services, the test accounts, canonical state, runtime copies, and mounts were removed. The Testbox was stopped and its provider status independently read back as completed.

Explicit Scope / Follow-up

Node named-profile service support and actionable ownership refusal remains a separate follow-up. The actual openclaw --profile work node install --force --json command is rejected by the existing guard:

Node install failed: Error: service management skipped: named profiles cannot override OPENCLAW_SYSTEMD_UNIT for Linux service management. Unset OPENCLAW_SYSTEMD_UNIT so OpenClaw derives the native service identity from OPENCLAW_PROFILE to install or rewrite the gateway service, or keep this profile runtime-only without a native service.

The Node adapter supplies the fixed Node service identity itself; unsetting the caller's selector does not remove it. Existing history and the native install-identity contract do not establish named-profile Node service support. This PR does not weaken that guard or discard profile context. Default native repair is proved; profile command formatting is proved; named-profile installation and actual container dispatch are not claimed.

Provenance

The stopped-service Gateway install hint was added in 3b1a020ebaec, authored and committed by @steipete on 2026-05-02; GitHub returned no associated PR. The running-service Gateway restart warning was added by #110583, commit fab3cdf1d8e2e716e006d6840ba34bcb1d347c4a, authored by @steipete and merged by @steipete on 2026-07-18. This PR is also authored by @steipete. Provenance was verified through live commit patches/PR metadata because local blame stops at a shallow-history boundary.

The latest ClawSweeper request for current-base focused proof and actual operator output is addressed above. Exact-head hosted CI and the final maintainer landing decision remain required; this body does not claim that the PR is merged.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S maintainer Maintainer-authored PR labels Aug 25, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 25, 2026, 2:49 PM ET / 18:49 UTC.

ClawSweeper review

What this changes

The PR derives Node and Gateway repair commands from the service being acted on, preserving active profile or container formatting.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked until real behavior proof is added - 3 items remain

No blocking code findings: this is the shared-owner fix for the confirmed Node guidance defect. It needs inspectable after-fix terminal or JSON output before merge; likely related people: Shakker (high confidence).

Priority: P2
Reviewed head: da6cb3fd430504b2278c285bbbe6aa18c6e561b8

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused owner-boundary patch and regression coverage are sound, but observable after-fix proof is absent.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR describes isolated lifecycle runs but supplies no inspectable after-fix terminal output, log, recording, or artifact; add redacted Node and Gateway output before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR describes isolated lifecycle runs but supplies no inspectable after-fix terminal output, log, recording, or artifact; add redacted Node and Gateway output before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Current-main defect: Current main hard-codes Gateway commands in both repair outcomes even though the owner accepts a generic service noun.
Shared-owner repair: The branch creates one formatted command from the existing service identity and uses it for running-service restart guidance and repair-required install hints.
Node caller and formatter contract: The Node adapter passes Node into the shared owner; the established formatter injects valid container or profile scope at the CLI root.
Findings None None.
Security None None.

Live Verification

Command: pnpm test src/cli/daemon-cli/lifecycle-core.test.ts

Result: PASS (completed)

$ node --import tsx scripts/test-projects.mts src/cli/daemon-cli/lifecycle-core.test.ts
[test] starting test/vitest/vitest.cli.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129545-Biz9uH/target

 ✓  cli  src/cli/daemon-cli/lifecycle-core.test.ts (46 tests) 5472ms

 Test Files  1 passed (1)
      Tests  46 passed (46)
   Start at  18:50:18
   Duration  6.89s (transform 5.28s, setup 992ms, import 69ms, tests 5.47s, environment 0ms)

[test] passed 1 Vitest shard in 12.68s
$ node --import tsx scripts/test-projects.mts src/cli/daemon-cli/lifecycle-core.test.ts
[test] starting test/vitest/vitest.cli.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129545-Biz9uH/target

 ✓  cli  src/cli/daemon-cli/lifecycle-core.test.ts (46 tests) 2598ms

 Test Files  1 passed (1)
      Tests  46 passed (46)
   Start at  18:50:32
   Duration  3.29s (transform 1.75s, setup 443ms, import 16ms, tests 2.60s, environment 0ms)

[test] passed 1 Vitest shard in 8.96s

Assertions:

  • NOT OBSERVED expect_output: correct Node service restart command — command exited successfully; expected output was not observed in the captured pane
  • NOT OBSERVED expect_output: fails Node service start with its own install hint when repair is required — command exited successfully; expected output was not observed in the captured pane

How this fits together

Node and Gateway CLI lifecycle commands delegate service checks and recovery guidance to a shared lifecycle owner. That owner emits formatted install or restart commands in human and JSON responses.

flowchart LR
  A[Node or Gateway command] --> B[Service adapter]
  B --> C[Shared lifecycle owner]
  C --> D{Service needs repair}
  D --> E[Command formatter]
  E --> F[Terminal or JSON guidance]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR describes isolated lifecycle runs but supplies no inspectable after-fix terminal output, log, recording, or artifact; add redacted Node and Gateway output before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The PR body reports isolated lifecycle runs but provides no inspectable terminal output, logs, recording, or artifact demonstrating the corrected command; real-behavior proof remains required before merge.
  • Complete next step (P2) - Add the required observable after-fix proof; no code repair is currently identified.
Agent review details

Security

None.

PR surface

Source -2, Tests +36. Total +34 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 8 -2
Tests 1 84 48 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 90 56 +34

Review metrics

Metric Value Why it matters
Production versus tests production +6/-8 (net -2); tests +84/-48 (net +36) The correction reduces production code while adding table-driven owner-boundary coverage for service and scope variants.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/cli/daemon-cli/lifecycle-core.test.ts, migration/backfill/repair: src/cli/daemon-cli/lifecycle-core.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the single service-identity-derived command path and attach redacted after-fix Node and Gateway lifecycle output before merging.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the single service-identity-derived command path and attach redacted after-fix Node and Gateway lifecycle output before merging.

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

Yes—current main passes serviceNoun: "Node" into a shared owner that emitted Gateway commands in both relevant repair paths; the added tests target those deterministic outputs.

Is this the best way to solve the issue?

Yes—the shared lifecycle owner already owns the service identity and command construction, so deriving guidance there fixes Node and preserves Gateway without a Node-specific workaround.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4f18aeabf3d3.

Labels

Label changes:

  • add P2: This fixes misleading recovery guidance for a broken installed Node service, with limited blast radius.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR describes isolated lifecycle runs but supplies no inspectable after-fix terminal output, log, recording, or artifact; add redacted Node and Gateway output before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This fixes misleading recovery guidance for a broken installed Node service, with limited blast radius.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR describes isolated lifecycle runs but supplies no inspectable after-fix terminal output, log, recording, or artifact; add redacted Node and Gateway output before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • Shakker: Current-main blame assigns the two hard-coded recovery command lines to this lifecycle-core introduction commit. (role: introduced current lifecycle-owner behavior; confidence: high; commits: 9b04f8233215; files: src/cli/daemon-cli/lifecycle-core.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted terminal or JSON output showing corrected Node and unchanged Gateway repair guidance.

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.

@steipete
steipete force-pushed the codex/qa-node-service-correct-repair-command-20260825 branch from da6cb3f to 32f18a8 Compare August 27, 2026 02:47
@steipete

Copy link
Copy Markdown
Contributor Author

The PR body now contains actual built-CLI and native-systemd proof at 32f18a840e4c1ddfff77639154d50790756ffef3, including an independent operator executing the printed repair. That testing exposed and corrected the earlier node restart suggestion: Node needs install --force to replace a stale definition; Gateway retains its repair-capable restart. Full changed checks and 188 focused tests pass. Named-profile Node installation is explicitly excluded and recorded as a separate ownership/support follow-up; its guard is unchanged.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete steipete self-assigned this Aug 27, 2026
@steipete
steipete merged commit c64a640 into main Aug 27, 2026
202 checks passed
@steipete
steipete deleted the codex/qa-node-service-correct-repair-command-20260825 branch August 27, 2026 03:09
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…aw#129545)

* fix(node): target node service in repair commands

* fix(node): recommend reinstalling stale service definitions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant