Skip to content

fix: restore Gateway restarts after Git updates - #138781

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
jason-allen-oneal:codex/fix-update-restart-bundle
Sep 5, 2026
Merged

vincentkoc merged 2 commits into
openclaw:mainfrom
jason-allen-oneal:codex/fix-update-restart-bundle

Conversation

@jason-allen-oneal

@jason-allen-oneal jason-allen-oneal commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #138760 — Git updates can leave the Gateway stopped after loading a removed restart bundle.

Additional instructions

Allow edits from maintainers is enabled.

What Problem This Solves

Fixes an issue where users updating a Git installation would be left with a stopped Gateway even though the new version built successfully and passed Doctor. Finalization failed before it could launch the new version's restart command, reporting restart-unhealthy / runtime-verification-failed.

Why This Change Was Made

The activation command still dynamically imported dependencies after the updater had replaced its own generated files. This change makes those dependencies eager within the existing preload-before-replacement boundary, covering the Node resolver, update-mode check, and legacy service-install helper without changing restart, ownership, environment, version, or health policy.

User Impact

Git updates can proceed to restart and verify the newly installed Gateway instead of failing on a removed bundle. No new settings, migrations, retries, version rollback, or database changes are introduced; supplied Node runners, service-definition preservation, and safe missing-candidate rejection remain intact.

Evidence

The completed proof below used this patch applied to base dcdbd055c7b4d2c96b7ca96adf6b9ab6fd9ef617; that source tree is recorded by published commit 99aa2f15e2749fd9a9d4657097be22e1f42f3a3d. These local results are separate from subsequent merge-ref CI.

Observed failure

The documented Linux/Node 24.19.0 update went from 2026.8.1 (c6f6055a527e91c5d17b166b81d0023581318526) to 2026.9.1 (0229a108fee749327b2cc60c4d228299dfe2f889). Sanitized local output:

Stopping managed gateway service before git update...
✓ Running doctor checks (244.67s)
✓ Verifying update (8ms)
Gateway service definition left unchanged
Restarting service...
Gateway: restart failed: Error: ENOENT: no such file or directory,
open '<install>/dist/shared-VSNmp8jC.js'
Update Result: ERROR
Reason: restart-unhealthy

The exception occurs in runUpdatedInstallGatewayCommand() while resolving Node, before spawning the candidate. The old implementation can already be cached while its separately emitted namespace facade is not. Fresh-process validation and starting the verified candidate restored Gateway health/RPC without rollback or database repair; that recovery is incident evidence, not a deployment of this patch.

Regression and sibling coverage

The new native-Node process test loads real helper implementations, maps the owner's imports to physical namespace facade files, loads the actual activation owner, deletes/recreates the fixture build directory, then invokes it without an injected Node runner. Restart and install spawn real candidate Node processes and assert their argv, executable, configuration selector, and compile-cache isolation. A missing package-manager candidate must still be rejected safely.

Before the production change, all three new cases failed with ENOENT for removed facade files. Afterward:

node scripts/run-vitest.mjs \
  src/cli/update-cli/update-command-service-command.process.test.ts \
  src/cli/update-cli/update-command-service.test.ts \
  src/cli/update-cli/update-command-service.integration.test.ts \
  src/cli/update-cli/update-command-post-update-recovery.test.ts

Test Files  4 passed (4)
Tests       141 passed (141)

Sibling coverage includes preserved service definitions, candidate version guards, expected Git build identity, stale-launcher recovery, failed-update recovery safety, and macOS/Windows decision paths. These tests do not claim native macOS/Windows service-manager execution.

Real behavior proof

  • Claim: After a Git update replaces the running installation's generated files, the emitted Gateway activation owner can launch the updated candidate's restart and install commands without importing a removed bundle; a missing package-manager candidate still rejects safely.
  • Exercised surface: Production runUpdatedInstallGatewayCommand() from the actual emitted pnpm build output for patch commit 99aa2f15e2749fd9a9d4657097be22e1f42f3a3d. The exact reviewed PR head is 2dc5b10ec533ed70245a03a3f05fb61a8e0c2fc8; its only later change is the test mock correction described below, with no production change to this owner.
  • Scenario / fixture: A disposable copy of the built package used isolated HOME, state, config, workspace, and temporary directories with native ESM imports and no loader hooks or dependency mocks. The proof loaded the emitted activation owner, deleted the fixture's entire dist, installed a recording candidate entrypoint, and invoked restart, install, and missing-candidate paths through real Node subprocesses.
  • Command / environment: Linux with Node 24.19.0, after pnpm build: node /tmp/openclaw-update-restart-built-proof.mjs. The script ran from the checkout root and removed its temporary fixture on exit.
  • Observable result: Restart and install both launched after the fixture build directory was deleted. The candidate processes received the expected Node executable, gateway restart --preserve-definition --json and gateway install --force --json, the isolated config selector, and disabled compile cache. The missing-candidate case rejected as expected.
  • Artifact / trace: Sanitized copied terminal output:
node /tmp/openclaw-update-restart-built-proof.mjs
BUILT_DIST_REPLACEMENT_RESTART_OK
BUILT_DIST_REPLACEMENT_INSTALL_OK
BUILT_DIST_REPLACEMENT_MISSING_CANDIDATE_OK
  • Limits: This proof exercises the emitted production module-loader and subprocess boundary with an isolated fixture. It does not perform a real Git update against an operator installation, invoke native systemd/launchd service management, or restart a live Gateway. Native cross-platform service-manager E2E remains untested. The final head's test-only follow-up was validated separately below.
Reproduce the emitted-code check on Linux after pnpm build

Save this as /tmp/openclaw-update-restart-built-proof.mjs, then run it with Node from the checkout root. It creates and removes only a temporary fixture.

import assert from "node:assert/strict";
import { execFile } from "node:child_process";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import { promisify } from "node:util";

const execFileAsync = promisify(execFile);
const checkout = process.cwd();

if (process.argv[2] !== "--child") {
  const fixture = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-update-built-proof-"));
  try {
    await fs.mkdir(path.join(fixture, "home"));
    await fs.mkdir(path.join(fixture, "state"));
    await fs.mkdir(path.join(fixture, "workspace"));
    // Disposable copy: deletion never touches the source build or live installation.
    await execFileAsync("cp", ["-a", path.join(checkout, "dist"), path.join(fixture, "dist")]);
    await fs.copyFile(path.join(checkout, "package.json"), path.join(fixture, "package.json"));
    await fs.symlink(path.join(checkout, "node_modules"), path.join(fixture, "node_modules"));
    const result = await execFileAsync(process.execPath, [fileURLToPath(import.meta.url), "--child", fixture], {
      cwd: fixture,
      env: {
        PATH: process.env.PATH,
        HOME: path.join(fixture, "home"),
        OPENCLAW_STATE_DIR: path.join(fixture, "state"),
        OPENCLAW_CONFIG_PATH: path.join(fixture, "state", "openclaw.json"),
        OPENCLAW_WORKSPACE_DIR: path.join(fixture, "workspace"),
        NODE_DISABLE_COMPILE_CACHE: "1",
        TMPDIR: fixture,
        TMP: fixture,
        TEMP: fixture,
      },
      timeout: 120_000,
    });
    process.stdout.write(result.stdout);
    process.stderr.write(result.stderr);
  } finally {
    await fs.rm(fixture, { recursive: true, force: true });
  }
} else {
  const root = process.argv[3];
  const dist = path.join(root, "dist");
  const owners = [];
  for (const file of await fs.readdir(dist)) {
    if (file.endsWith(".js")) {
      const contents = await fs.readFile(path.join(dist, file), "utf8");
      if (contents.includes("async function runUpdatedInstallGatewayCommand(")) owners.push(file);
    }
  }
  assert.equal(owners.length, 1);
  const module = await import(pathToFileURL(path.join(dist, owners[0])).href);
  const commands = Object.values(module).filter(
    (value) => typeof value === "function" && value.name === "runUpdatedInstallGatewayCommand",
  );
  assert.equal(commands.length, 1);
  const runCommand = commands[0];
  await fs.rm(dist, { recursive: true });
  await fs.mkdir(dist);
  const receipt = path.join(root, "candidate.json");
  await fs.writeFile(path.join(dist, "index.mjs"), [
    'import fs from "node:fs";',
    `fs.writeFileSync(${JSON.stringify(receipt)}, JSON.stringify({`,
    'args: process.argv.slice(2), node: process.execPath,',
    'config: process.env.OPENCLAW_CONFIG_PATH, cache: process.env.NODE_DISABLE_COMPILE_CACHE,',
    '}));',
  ].join("\n"));
  const params = {
    result: { root, mode: "git" },
    opts: { json: true },
    invocationEnv: process.env,
    timeoutMs: 10_000,
  };
  for (const action of ["restart", "install"]) {
    assert.equal(await runCommand(params, action, true), true);
    const observed = JSON.parse(await fs.readFile(receipt, "utf8"));
    assert.deepEqual(observed, {
      args: ["gateway", action, action === "restart" ? "--preserve-definition" : "--force", "--json"],
      node: process.execPath,
      config: process.env.OPENCLAW_CONFIG_PATH,
      cache: "1",
    });
    console.log(`BUILT_DIST_REPLACEMENT_${action.toUpperCase()}_OK`);
  }
  await fs.unlink(path.join(dist, "index.mjs"));
  await assert.rejects(runCommand({ ...params, result: { root, mode: "npm" } }, "install"), {
    message: "updated install entrypoint not found under " + root,
  });
  console.log("BUILT_DIST_REPLACEMENT_MISSING_CANDIDATE_OK");
}

Build and review

Fresh independent autoreview of the full patch against dcdbd055c7b4d2c96b7ca96adf6b9ab6fd9ef617: scoped-clean through P2, no findings. Review included the unchanged preload boundary and dependency implementations, not just the diff.

pnpm build passed, including native built plugin control-plane loading, CLI bootstrap import guards, plugin SDK export validation, and the Control UI build. No INEFFECTIVE_DYNAMIC_IMPORT warnings were emitted.

Production typechecking, formatting, dependency guards, plugin boundaries, and deprecation checks passed. The full test-typecheck and remaining canonical changed-plan guards have now passed as well. The interrupted serial test-typecheck was resumed using pnpm tsgo:core:test --stripe 1/1 --concurrency 4, which selects all 16 graphs; subsequent guards ran in their canonical order. This is combined local validation evidence, not a claim that the original interrupted wrapper completed.

Production delta: +6/-6 lines (net zero). Test delta: +104/-1 lines; no new production test seam.

CI follow-up

The first merge-ref run for head 99aa2f15e2749fd9a9d4657097be22e1f42f3a3d failed only in checks-node-compact-small-51: three existing service-refresh tests in src/cli/update-cli.test.ts expected installer-stub calls but observed none. The suite still mocked daemon-cli/install.runtime.js, while the repaired activation owner now imports daemon-cli/install.js eagerly.

The same three assertion failures reproduced locally with node scripts/run-vitest.mjs src/cli/update-cli.test.ts -t 'updateCommand service refresh behavior' (3 failed, 2 passed). The follow-up targets the implementation owner with a partial mock: only runDaemonInstall is replaced, while real exports such as mergeInstallInvocationEnv remain available to the existing explicit-wrapper test. Retargeting a whole-module mock initially exposed that sibling dependency; the partial mock preserves it. No assertions, production behavior, or restart safety policy change.

After the final partial-mock correction in 2dc5b10ec533ed70245a03a3f05fb61a8e0c2fc8:

node scripts/run-vitest.mjs src/cli/update-cli.test.ts \
  -t 'updateCommand service refresh behavior|uses an explicit service wrapper when openclaw is absent from PATH'

Test Files  1 passed (1)
Tests       6 passed | 351 skipped (357)

The complete owner and restart/recovery run also passed on the same final source tree:

node scripts/run-vitest.mjs \
  src/cli/update-cli.test.ts \
  src/cli/update-cli/update-command-service-command.process.test.ts \
  src/cli/update-cli/update-command-service.test.ts \
  src/cli/update-cli/update-command-service.integration.test.ts \
  src/cli/update-cli/update-command-post-update-recovery.test.ts

Test Files  5 passed (5)
Tests       498 passed (498)

Targeted formatting and lint pass. Fresh independent review of the final combined fixture correction is scoped-clean through P2 with no findings. CI run 33939582103 passed for head 2dc5b10ec533ed70245a03a3f05fb61a8e0c2fc8, including the previously failing shard and aggregate CI gate. The final observed rollup had no pending or failed checks.

Proof boundary: both the source regression and emitted-code check exercise the native module loader and subprocess boundary, not a real systemd/launchd update end to end. Repeating the operator's real update would replace their installation and disrupt their running Gateway; PR validation deliberately used disposable fixtures instead. The operator's running Gateway, configuration, session history, and databases were not changed for this validation. Native cross-platform service-manager E2E remains untested by this PR.

@clawsweeper

clawsweeper Bot commented Sep 5, 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 cli CLI command changes size: S labels Sep 5, 2026
@jason-allen-oneal
jason-allen-oneal marked this pull request as ready for review September 5, 2026 02:10
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 10:54 PM ET / September 5, 2026, 02:54 UTC.

ClawSweeper review

What this changes

The PR loads Gateway activation helpers before an update replaces its build files and adds regression coverage for launching the updated command afterward.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused repair: current main and v2026.9.1 retain the failing imports. No blocking correctness or security findings were identified, and the supplied emitted-code proof covers the changed activation boundary.

Priority: P1
Reviewed head: 2dc5b10ec533ed70245a03a3f05fb61a8e0c2fc8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-neutral repair with targeted emitted-code proof and useful regression coverage; no blocking patch defects were found.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied Linux/Node 24.19.0 emitted-build transcript exercises the real activation owner after deleting its build directory and observes successful restart/install candidate launches plus safe missing-candidate rejection. That covers the changed module-loading boundary; native service-manager execution remains outside this proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied Linux/Node 24.19.0 emitted-build transcript exercises the real activation owner after deleting its build directory and observes successful restart/install candidate launches plus safe missing-candidate rejection. That covers the changed module-loading boundary; native service-manager execution remains outside this proof.
Evidence reviewed 10 items Verified introduced change: The merge-base-to-head diff contains the activation import changes, one new process regression, and the installer mock correction. Production is +6/-6 lines; tests are +104/-1. Base-branch drift was excluded from attribution.
Current main still needs the repair: The activation helper still dynamically imports shared.js immediately before spawning the candidate and imports recovery/install helpers on the missing-entrypoint path.
Latest release retains the same failure path: The v2026.9.1 source contains the same three delayed imports; the tag resolves to the supplied latest-release commit.
Findings None None.
Security None None.

How this fits together

OpenClaw’s updater stops the managed Gateway, replaces the installation, and launches the updated CLI to restart it. The activation helper connects update finalization to that new process, after which existing checks verify Gateway readiness.

flowchart TD
  A[Update requested] --> B[Preload execution helpers]
  B --> C[Stop Gateway and replace build]
  C --> D[Resolve updated CLI]
  D --> E{Candidate available?}
  E -->|Yes| F[Launch install or restart command]
  E -->|No| G[Existing fallback or explicit rejection]
  F --> H[Verify Gateway readiness]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +103. Total +103 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 6 0
Tests 2 104 1 +103
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 110 7 +103

Review metrics

Metric Value Why it matters
Production versus test LOC Production net 0; tests net +103 The repair changes dependency timing within the existing owner and adds regression coverage without growing production code or introducing a test-only production seam.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #138760
Summary: This PR is the candidate repair for the explicitly linked removed-bundle update failure; the issue should remain open until resolution.

Members:

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

Technical review

Best possible solution:

Keep activation dependencies loaded before build replacement, then launch the candidate under the existing service-ownership and readiness rules.

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

Yes: current source retains imports that can request removed build files after replacement, matching the incident trace and reported failing-before regression. This review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes: the patch repairs the existing preload boundary without changing activation policy. Supplying only a Node runner would leave the other delayed imports exposed, while retries would still request deleted files.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The documented Git-update failure leaves a managed Gateway stopped despite successful build and Doctor checks.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied Linux/Node 24.19.0 emitted-build transcript exercises the real activation owner after deleting its build directory and observes successful restart/install candidate launches plus safe missing-candidate rejection. That covers the changed module-loading boundary; native service-manager execution remains outside this proof.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied Linux/Node 24.19.0 emitted-build transcript exercises the real activation owner after deleting its build directory and observes successful restart/install candidate launches plus safe missing-candidate rejection. That covers the changed module-loading boundary; native service-manager execution remains outside this proof.

Label justifications:

  • P1: The documented Git-update failure leaves a managed Gateway stopped despite successful build and Doctor checks.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied Linux/Node 24.19.0 emitted-build transcript exercises the real activation owner after deleting its build directory and observes successful restart/install candidate launches plus safe missing-candidate rejection. That covers the changed module-loading boundary; native service-manager execution remains outside this proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied Linux/Node 24.19.0 emitted-build transcript exercises the real activation owner after deleting its build directory and observes successful restart/install candidate launches plus safe missing-candidate rejection. That covers the changed module-loading boundary; native service-manager execution remains outside this proof.

Evidence

What I checked:

  • Verified introduced change: The merge-base-to-head diff contains the activation import changes, one new process regression, and the installer mock correction. Production is +6/-6 lines; tests are +104/-1. Base-branch drift was excluded from attribution. (src/cli/update-cli/update-command-service-command.ts:5, 2dc5b10ec533)
  • Current main still needs the repair: The activation helper still dynamically imports shared.js immediately before spawning the candidate and imports recovery/install helpers on the missing-entrypoint path. (src/cli/update-cli/update-command-service-command.ts:60, b78612ac3ac0)
  • Latest release retains the same failure path: The v2026.9.1 source contains the same three delayed imports; the tag resolves to the supplied latest-release commit. (src/cli/update-cli/update-command-service-command.ts:60, ad6fe23aecb9)
  • Existing preload boundary and callers: updateCommand loads update-execution.runtime before mutable execution. Its execution and finalization exports reach the activation helper through static imports; normal restart and failed-update recovery share that helper. This is OpenClaw CLI/Node loading behavior, with no affirmative Codex runtime or protocol dependency. (src/cli/update-cli/update-command.ts:635, 2dc5b10ec533)
  • Existing service contract remains intact: The caller retains ownership checks, definition preservation, candidate delegation, and readiness verification. Documentation explicitly promises stopping before replacement and verifying the restarted Gateway; manual recovery commands do not replace that contract. Public docs: docs/cli/update.md. (docs/cli/update.md:367, 2dc5b10ec533)
  • Regression and sibling coverage: The new process test removes physical facade files after loading the real owner, then checks candidate argv, executable, config selector, compile-cache isolation, and missing-candidate rejection. Existing tests cover version/build verification and preservation. The partial installer mock retains mergeInstallInvocationEnv for the explicit-wrapper test. (src/cli/update-cli/update-command-service-command.process.test.ts:47, 2dc5b10ec533)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@vincentkoc vincentkoc self-assigned this Sep 5, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer pre-merge review is complete for head 2dc5b10ec533ed70245a03a3f05fb61a8e0c2fc8. The issue is valid, the owner-level fix is the best implementation, and the review artifacts are READY FOR /prepare-pr.

Validation:

  • scripts/pr review-init 138781
  • scripts/pr review-checkout-main 138781
  • scripts/pr review-checkout-pr 138781
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base 0d84b12e65e1dc44d515b0c4a12195fa52b7ca9c --max-priority P2 --prompt-file .local/autoreview-prompt.md --dataset .local/autoreview-evidence.md
  • scripts/pr review-validate-artifacts 138781

Fresh autoreview was scoped-clean through P2 with no findings or incomplete scope (confidence 0.96). Exact-head CI run https://github.com/openclaw/openclaw/actions/runs/33939582103 is green, including required openclaw/ci-gate; the latest ClawSweeper review is ready with no findings or rank-up moves.

Before: after a Git update replaced the running installation's generated files, activation could fail before candidate spawn with ENOENT for an old hashed dist/shared-*.js, leaving the Gateway stopped.

After: the activation owner eagerly loads all dependencies inside the existing preload closure. The focused process regression and disposable emitted-build proof delete the old module files, then successfully launch restart/install candidates while retaining explicit missing-candidate rejection. Production LOC is +6/-6; tests are +104/-1.

Known proof gap: no native systemd, launchd, or Scheduled Task end-to-end execution was run. The observed failure and repaired boundary occur before service-manager invocation; existing integration coverage retains ownership and readiness checks.

@vincentkoc
vincentkoc merged commit 24d8119 into openclaw:main Sep 5, 2026
232 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

vincentkoc added a commit to LiuwqGit/openclaw that referenced this pull request Sep 5, 2026
* origin/main:
  fix(gateway): keep webhook ingress retryable during hot reload (openclaw#138627)
  fix: restore Gateway restarts after Git updates (openclaw#138781)
  fix(gateway): stop repeated teardown after WebSocket failures (openclaw#138818)
  fix(gateway): abort exact live runs when cancelling tasks (openclaw#118358)
  refactor(memory): share typed embedding-cache writes (openclaw#138827)
  fix(a2a): preserve tasks while reserving commands for users (openclaw#138731)
  feat: tune inbound batching without reconnecting channels (openclaw#138780)
steipete added a commit that referenced this pull request Sep 6, 2026
Retain the released updater node-runner facade and keep post-core children out of top-level run admission. The parent owns the update result, so finalization cannot leave an independent requested/running record after service recovery.

Preserves the eager preload fix from #138781. Incorporates the frozen-package bridge from #139615; reported in #139383 by @coygeek.

Co-authored-by: Alex Naidis <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
* fix: restore Gateway restarts after Git updates

* test: align update installer mock with eager import
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
Retain the released updater node-runner facade and keep post-core children out of top-level run admission. The parent owns the update result, so finalization cannot leave an independent requested/running record after service recovery.

Preserves the eager preload fix from openclaw#138781. Incorporates the frozen-package bridge from openclaw#139615; reported in openclaw#139383 by @coygeek.

Co-authored-by: Alex Naidis <[email protected]>
RomneyDa pushed a commit that referenced this pull request Sep 19, 2026
* fix: restore Gateway restarts after Git updates

* test: align update installer mock with eager import

(cherry picked from commit 24d8119)
RomneyDa added a commit that referenced this pull request Sep 19, 2026
* fix(update): restore Gateway after partial stop failure

Adapt the service-mutation recovery invariant to the 2026.8 updater owner.

(cherry picked from commit ad682b4)

* fix(update): replace unsupported service Node runtimes

Adapt the recorded-service runtime probe to the 2026.8 daemon install plan.

(cherry picked from commit fe79d36)

* fix(gateway): gateway stays offline after agent restart on Windows (#134549)

* fix(gateway): keep agent restart alive on Windows

* docs(gateway): clarify Windows agent restart routing

---------

Co-authored-by: Josh <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 3a0a623)

* fix: published Linux upgrades leave unchanged gateways stopped (#151049)

* fix(update): preserve service fingerprints across published upgrades

Keep known-empty systemd override metadata out of the fingerprint retained by published updaters through 2026.9.4. Preserve full command metadata for runtime pinning and reject actual protected service changes.

* test: group silence failures with error payload coverage

Keep the required sealed-answer fixture field while moving its related failure-policy cases into the existing error payload test module. Preserve every case and assertion without growing the over-cap payload test file.

(cherry picked from commit 4475640)

* fix(doctor): preserve explicitly configured profile workspaces (#145976)

* fix(doctor): preserve configured profile workspaces

* fix(doctor): avoid assuming workspace ownership

Co-authored-by: ericcaiwx-star <[email protected]>
(cherry picked from commit 1e8ba48)

* fix(plugins): stop relocated install records from shadowing bundled plugins (#144843)

* fix(plugins): stop relocated install records from shadowing bundled plugins

A `path` install record stores an absolute directory. When that directory is
another OpenClaw installation's bundled plugin tree, the record survives the
installation move and is rediscovered as an `origin: "global"` candidate.
`global` outranks `bundled`, so the stale pin won the duplicate-id contest and
the plugin resolved from the old installation. `resolvePluginTrust` then saw
`record.source === "path"` and downgraded it to `origin-path`, which revokes
trusted plugin state and fails trusted-only APIs mid-turn.

`isIntentionalInstalledBundledDuplicate` also suppressed the duplicate warning,
because installed-shadows-bundled is normally deliberate, so the swap was silent.

Treat a plugin directory inside a *different* installation's bundled roots as
stale: it no longer outranks the current bundled copy, and it no longer counts
as an intentional shadow, so the existing duplicate warning reports it.

* fix(plugins): name the stale install record instead of a generic duplicate

The duplicate-id warning reported "global plugin will be overridden by bundled
plugin", which describes the mechanism but gives an operator nothing to act on.
A pin into another installation's bundled tree is a stale record rather than a
deliberate override, so report it as one and name the remedy.

* docs(agents): record that a stored absolute path is not provenance

The stale-pin defect this branch fixes came from a persisted absolute path that
kept conferring bundled status after the installation it named was replaced.
Record the invariant so the next record type does not repeat it.

* fix(plugins): narrow the stale-pin gate to relocated compiled trees

Review of the preceding guard found two ways it misfired.

It answered "foreign" by negating a membership test against the running
package roots, so an install whose root resolves from neither argv nor the
module URL saw every bundled tree as foreign, including its own. Compiled
sibling trees and the module walk-up fallback resolve exactly that way, so the
gate now fails open when the running root is unknown.

It also accepted `<root>/extensions/<id>`, the documented
`plugins install --link` development target, which made a deliberate local
override report as a stale record and told the developer to delete it. Only
compiled `dist`/`dist-runtime` trees travel with an installation, so the shape
check is limited to those, and a plugin inside the configured dev source root is
excluded at the call site, where importing it raises no cycle.

* test(auth): pin external credential refresh timing (#152771)

---------

Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 5ec3614)

* fix(plugins): archive updates fail on development-only dependencies (#143350)

* fix(plugins): isolate npm manifest resolution

* fix(plugins): preserve hook host dependencies

* test(plugins): align npm isolation coverage with CI limits

* fix(plugins): link optional-only OpenClaw host dependencies

* test(gateway): settle companion databases before fixture cleanup

* test(plugins): cover optional hosts in native import preparation

* test(skills): close status watchers before retiring fixture roots

---------

Co-authored-by: Gio Della-Libera <[email protected]>
Co-authored-by: Jason (Json) <[email protected]>
(cherry picked from commit cbf935b)

* fix(gateway): release agent leases when shutdown completes (#151435)

Drain the existing agent database lifecycle during final Gateway retirement before shared state closes. Preserve sibling ownership and surface native-close failures without dropping their lease.

Four new regressions fail on the original code. The repair passes 92 focused cases and an isolated four-case rerun, changed checks, and independent P0-P2 review.

(cherry picked from commit 3381de9)

* fix: restore Gateway restarts after Git updates (#138781)

* fix: restore Gateway restarts after Git updates

* test: align update installer mock with eager import

(cherry picked from commit 24d8119)

---------

Co-authored-by: josh <[email protected]>
Co-authored-by: Josh <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Eric Cai <[email protected]>
Co-authored-by: Gio Della-Libera <[email protected]>
Co-authored-by: Gio Della-Libera <[email protected]>
Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Jason O'Neal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Git update leaves Gateway stopped after loading a removed restart bundle

2 participants