Skip to content

fix: let Git checkouts inside containers update again - #203586

Closed
fuller-stack-dev wants to merge 8 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-container-checkout
Closed

fuller-stack-dev wants to merge 8 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-container-checkout

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Since #203194, openclaw update refuses every Git checkout on a host that has /.dockerenv (or container, DOCKER_CONTAINER or OPENCLAW_CONTAINER set). It fails with container-install, "This installation belongs to a container image. Update the image instead." A checkout that someone cloned and built inside a container or devbox is not part of any image, and the updater before #203194 updated it. Today it cannot update at all, and the next action it names is wrong for it.

User Impact

A Git checkout inside a container updates through openclaw update, update.run and automatic updates like any other checkout. The run records a warning:preflight step, and openclaw update prints it: whatever is not on a mounted volume is reset when the container is recreated from its image, so keep the checkout and the state directory on volumes or build the new version into the image. If only the state directory is on a volume, the warning also says that the image's original build may refuse the upgraded state after a recreate. Nothing else changes. OpenClaw's own image is a package install and is still skipped with container-image-install. Nix and Homebrew refusals are unchanged.

A Gateway with OPENCLAW_SUPERVISOR_MODE=external now refuses update.run on a Git install with external-supervisor-update-required, as the package route, openclaw update and automatic updates already do. #203194's Git route had dropped that check, and container deployments are where external supervisors are common.

A Gateway that is a container's main process, with no service manager or launcher above it, cannot start a new release without stopping the container: the update restart hands off to a detached successor and exits, which ends the container. update.run and automatic Git updates now refuse that case with restart-unavailable before anything is prepared, and the message names the step that works: openclaw update --no-restart in the container, then restart the container. "Main process" means PID 1 or a direct child of the container's init shim or shell, since that exit ends the container. A Gateway started with docker exec has no parent inside the container and hands off as it does on a host. A Gateway under systemd, launchd or the release launcher inside a container is also unaffected; the green cell below is that case.

Why This Change Was Made

Why the refusal existed. It came in with #203194 as one preflight line ("container installs refused before any change"). I found no other reasoning for it in the PR description, the review thread or the docs. The case where it is right is an install that lives in the image layer, where an in-place change is lost when the container is recreated.

Evidence that the line cannot see that case.

  • src/update/preflight.ts runs only for Git installs on main. Every caller of prepareUpdate routes installKind === "git": update-command.ts, update-run.ts and update-startup-auto-run.ts.
  • OpenClaw's own image (Dockerfile) ships a package at /app with no .git. The existing update-command admission already skips it as container-image-install (resolveUnmanagedUpdateInstallReason), before src/update is reached.
  • So on main the check refused only checkouts that someone cloned into a container. It also treated OPENCLAW_CONTAINER as evidence of a container. That variable is the host-side --container <name> target (src/cli/container-target.ts), and inside the container the CLI clears it.

Rule. A container signal alone never refuses. Preflight uses the existing detector, isContainerEnvironment() (/.dockerenv, /run/.containerenv, container cgroups, Fly). Inside a container it continues and returns a warning, which the run records. Every refusal that follows (Nix, Homebrew, writable prefix, tools, dirty checkout, Node engine, disk space) still applies, in the same order.

What stays refused. An image-owned install: the official image, and any package root without a package-manager owner. Those are skipped by the existing admission owner with "Pull or build the target Docker/container image, then redeploy it with the same state/config mounts". The green cell below checks this.

Alternatives rejected.

  • Keep refusing unless the checkout is on a volume, by reading mountinfo. Mount layouts vary (bind mounts of a subdirectory, Kubernetes, Podman), so the rule would be brittle. A recreated container loses an unmounted checkout's changes, but no state is at risk. The updater before feat(update): Git installs update through prepared releases and a resident launcher #203194 updated these checkouts too.
  • Refuse only on an image marker. The official image sets no marker that the Git path could ever see, because the official image is not a Git checkout.

Update behavior. This changes the updater inside the release path, so it applies once the installed CLI or Gateway has this code. An installed build from #203194 (merged 2026-11-22, main only) up to this change still refuses its next update inside a container, because the refusal runs in the installed code. That one hop cannot be patched from here. Remove /.dockerenv as root for that update (Docker recreates it with the container), which is the control row below, or pull and build the checkout by hand once. Every later update uses this rule. No schema, config, protocol, dependency or retention change.

Evidence

Real Linux container with systemd as PID 1, a lingering user manager and a real user bus. A user systemd Gateway service, a Gateway-gated writer on a 256–512 MiB agent database, and 1,000 marker rows checked by count, SHA-256 and PRAGMA quick_check after every step. Synthetic state only. The checkout was cloned and built inside the container, and its home is a volume.

Run Commit /.dockerenv Result Wall Gateway outage Data
RED: update to the next commit base a1aa1276017 present exit 1, container-install, "Update the image instead"; Gateway untouched 2.2 s 0 intact
RED: repeat base present same refusal 2.2 s 0 intact
Control: same cell, marker removed only base removed exit 0, succeeded, serving the target build 384 s 12.3 s intact
GREEN: update to the next commit head a631d9991b9 present exit 0, succeeded, serving the target build, warning:preflight recorded 369.8 s 11.9 s intact
GREEN: no-op repeat head present exit 0, already-current 6.5 s 0 intact
GREEN: package root in the container (image shape) head present exit 0, skipped, container-image-install, "Pull or build the target Docker/container image..." 4.3 s 0 n/a

"Data intact" means the 1,000 marker rows kept the same count and SHA-256 (69cb2f12…), and quick_check returned ok before and after every step. The same green rows also passed at two earlier heads: 039ac631f2d (369 s, 11.8 s outage) and 91087630aff (380 s, 11.8 s outage).

Red and green terminal recordings, and the raw head output: recordings and green raw logs at the head. Raw red and control output: red and control. Full logs are not attached because the artifact store rejects uploads from this machine.

Tests (src/update/prepare.test.ts):

  • New: a checkout inside a container goes through runReleaseUpdateCli with a real Git fixture and state database. It ends with a pending trial and exit 0, records the warning, and prints it. The fixture presents both container signals, the shared detector and the /.dockerenv marker the base preflight reads, so on the base it fails with status: failed (container-install).
  • New (update-run.test.ts): a Gateway that is a container's main process refuses update.run with restart-unavailable and the --no-restart next step, and prepares nothing (red on the base handler, which accepted the run). Negative controls: the same container under a supervisor (the release launcher) prepares the release, and so does a Gateway started with docker exec.
  • New (update-run.test.ts): an externally supervised Gateway answers update.run with external-supervisor-update-required and prepares nothing. Red on the base handler, which accepted the run.
  • New: a Nix install is still refused inside a container. This guards the order: the warning must not skip the refusals that follow it.
  • Added a negative control to the existing build-failure case: outside a container, no warning is recorded.
  • Removed: the /.dockerenv fs.access spy and the container/DOCKER_CONTAINER/OPENCLAW_CONTAINER stubs. Production no longer reads them. The module mock of isContainerEnvironment replaces them, so no case depends on the host's container status. Also removed: the old "refuses a Docker marker" case, whose behavior is retired on purpose.

Checks: node scripts/run-vitest.mjs src/update/ src/gateway/server-methods/update-run.test.ts (44 passed), pnpm tsgo:core, pnpm tsgo:core:test, oxlint and oxfmt on the touched files, pnpm check:baseline-ratchets (all ok, including session-identity, mock-exports and test-lines +42), pnpm check:docs, git diff --check.

Review: ClawSweeper's local review round 3 rated overall F, proof C, patch F. Its findings, and what I did:

  • (P2) A devbox whose PID 1 is sleep infinity would be refused. Fixed: the refusal now needs PID 1 or a direct child of PID 1.
  • (P1) A container signalled only by container=systemd-nspawn goes undetected, where main used to refuse it. Not changed: the shared detector does not read that variable, and adding it would change every caller of the detector. Listed under "Not proven".
  • (P2) The Control UI maps restart-unavailable to package wording. Not changed: that is a UI change, and it needs its own screenshots.
  • (P2) Automatic updates count a skipped refusal outside the failure backoff. Not changed: the refusal happens before anything is prepared and costs one check.

Round 2 raised the container main-process restart (fixed above) and asked that openclaw update print the warning even when it stops following a run at its --timeout (done, covered in cli.test.ts). Round 1 raised the supervisor gap (fixed above), asked that the warning cover a recreated image refusing upgraded state (added), and asked that the regression test exercise the base's own signal (done). autoreview cannot run here. The worktree sits under a shared temp directory, and its Codex preflight refuses that. A fresh independent reviewer found no P0 or P1 issues. Its two P2 findings are fixed: the step is now a warning: step, so reports, the Control UI and the warning headline show it, and the negative control above is new.

Not proven:

  • Recreating a container and watching the checkout fall back to the image's build. The warning text describes that case.
  • An externally supervised Git Gateway, and a container whose main process is the Gateway, end to end: both refusals are covered by handler tests only. The --no-restart, then restart-the-container path is not run.
  • Automatic updates share the same refusal helper (describeUpdateRestartUnavailable); that caller has no test of its own.
  • An upgrade from the latest stable release: 2026.11.6 still runs the older in-place updater, which never reaches this preflight.
  • CI: checks-node-changed-compact-large-9-1 fails on src/flows/doctor-health.legacy-update.test.ts, three cases. They fail the same way on main without this change, and open PRs chore(test): align latent-red tests with one-time admission and no-auto-disable cron #203560 and fix: restore two OpenClaw regression suites #203569 fix them. Main will be merged in once they land.
  • Kubernetes on cgroup v2 and systemd-nspawn: the existing detector may not report a container there. No warning is printed, and the main-process refusal does not apply. A Gateway that is PID 1 of such a container would hand off to a detached successor, as on main before feat(update): Git installs update through prepared releases and a resident launcher #203194.
  • macOS and Windows containers (not applicable). A uid-mismatched checkout on a volume ("dubious ownership").

A container marker alone no longer refuses a Git update. A checkout cloned into a container updates as before openclaw#203194, and the run records a warning:preflight step saying that anything outside mounted volumes is reset when the container is recreated. Image installs stay skipped by the existing container-image-install admission.
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

RED raw logs: base a1aa1276017 (origin/main at the time), real-systemd container, Git checkout cloned and built inside it, /.dockerenv present. Raw stdout of openclaw update --yes --json, unedited.

RED refused: exit 1, stdout
{
  "runId": "c04c7e38-1b5f-4e36-8787-fc4714e58b72",
  "createdAtMs": 1795367847731,
  "updatedAtMs": 1795367847978,
  "trigger": "api",
  "phase": "finished",
  "status": "failed",
  "reason": "container-install",
  "origin": {
    "deliveryContext": {
      "channel": "webchat"
    },
    "nextAction": "This installation belongs to a container image. Update the image instead.",
    "cause": "unknown"
  },
  "target": {
    "kind": "git",
    "version": "2026.11.6",
    "sha": "fe6f54abf2e17c8ec83ebe6d9173eec62206f32b"
  },
  "before": {
    "version": "2026.11.6"
  },
  "after": {},
  "steps": [
    {
      "step": "requested",
      "status": "completed",
      "startedAtMs": 1795367847731,
      "endedAtMs": 1795367847970
    },
    {
      "step": "notice:ack",
      "status": "skipped",
      "endedAtMs": 1795367847818,
      "detail": "no delivery target"
    },
    {
      "step": "staging",
      "status": "failed",
      "startedAtMs": 1795367847970,
      "endedAtMs": 1795367847978,
      "failureFacts": [
        {
          "check": "update",
          "code": "update-failed"
        }
      ]
    }
  ],
  "verification": {
    "noticeDelivered": false
  },
  "repair": [],
  "confirmedAtMs": null,
  "finishedAtMs": 1795367847978,
  "downtimeMs": null
}
RED refused-again: exit 1, stdout
{
  "runId": "e89d1988-d918-45a8-b027-e541945b5ac2",
  "createdAtMs": 1795367853113,
  "updatedAtMs": 1795367853248,
  "trigger": "api",
  "phase": "finished",
  "status": "failed",
  "reason": "container-install",
  "origin": {
    "deliveryContext": {
      "channel": "webchat"
    },
    "nextAction": "This installation belongs to a container image. Update the image instead.",
    "cause": "unknown"
  },
  "target": {
    "kind": "git",
    "version": "2026.11.6",
    "sha": "fe6f54abf2e17c8ec83ebe6d9173eec62206f32b"
  },
  "before": {
    "version": "2026.11.6"
  },
  "after": {},
  "steps": [
    {
      "step": "requested",
      "status": "completed",
      "startedAtMs": 1795367853113,
      "endedAtMs": 1795367853234
    },
    {
      "step": "notice:ack",
      "status": "skipped",
      "endedAtMs": 1795367853156,
      "detail": "no delivery target"
    },
    {
      "step": "staging",
      "status": "failed",
      "startedAtMs": 1795367853234,
      "endedAtMs": 1795367853248,
      "failureFacts": [
        {
          "check": "update",
          "code": "update-failed"
        }
      ]
    }
  ],
  "verification": {
    "noticeDelivered": false
  },
  "repair": [],
  "confirmedAtMs": null,
  "finishedAtMs": 1795367853248,
  "downtimeMs": null
}
Control: same cell after only /.dockerenv was removed: exit 0, stdout
{
  "runId": "b7124cb1-a9a9-40cb-bd2f-17436c9f8177",
  "createdAtMs": 1795367860111,
  "updatedAtMs": 1795368240096,
  "trigger": "api",
  "phase": "finished",
  "status": "succeeded",
  "reason": null,
  "origin": {
    "deliveryContext": {
      "channel": "webchat"
    },
    "cause": "none"
  },
  "target": {
    "kind": "git",
    "version": "2026.11.6",
    "sha": "fe6f54abf2e17c8ec83ebe6d9173eec62206f32b"
  },
  "before": {
    "version": "2026.11.6"
  },
  "after": {
    "version": "2026.11.6",
    "buildId": "2026.11.6-fe6f54abf2e1-2026-11-22T17-17-57.538Z"
  },
  "steps": [
    {
      "step": "requested",
      "status": "completed",
      "startedAtMs": 1795367860111,
      "endedAtMs": 1795367860230
    },
    {
      "step": "notice:ack",
      "status": "skipped",
      "endedAtMs": 1795367860150,
      "detail": "no delivery target"
    },
    {
      "step": "staging",
      "status": "completed",
      "startedAtMs": 1795367860230,
      "endedAtMs": 1795368195481
    },
    {
      "step": "prepare:git-resolve-target",
      "status": "completed",
      "startedAtMs": 1795367860368,
      "endedAtMs": 1795368240096
    },
    {
      "step": "prepare:worktree",
      "status": "completed",
      "startedAtMs": 1795367860392,
      "endedAtMs": 1795368240096
    },
    {
      "step": "prepare:install",
      "status": "completed",
      "startedAtMs": 1795367863502,
      "endedAtMs": 1795368240096
    },
    {
      "step": "prepare:build",
      "status": "completed",
      "startedAtMs": 1795367876888,
      "endedAtMs": 1795368240096
    },
    {
      "step": "prepare:ui-build",
      "status": "completed",
      "startedAtMs": 1795368150236,
      "endedAtMs": 1795368240096
    },
    {
      "step": "validating",
      "status": "completed",
      "startedAtMs": 1795368195481,
      "endedAtMs": 1795368199427
    },
    {
      "step": "plugins",
      "status": "completed",
      "startedAtMs": 1795368196605,
      "endedAtMs": 1795368199387
    },
    {
      "step": "activating",
      "status": "completed",
      "startedAtMs": 1795368199427,
      "endedAtMs": 1795368199443
    },
    {
      "step": "restarting",
      "status": "completed",
      "startedAtMs": 1795368199443,
      "endedAtMs": 1795368240096
    }
  ],
  "verification": {
    "booted": true,
    "runningVersion": "2026.11.6",
    "runningBuildId": "2026.11.6-fe6f54abf2e1-2026-11-22T17-17-57.538Z",
    "noticeDelivered": false
  },
  "repair": [],
  "confirmedAtMs": null,
  "finishedAtMs": 1795368240096,
  "downtimeMs": null
}
Per-step summary (cell sampler): outages and per-directory disk
   outages: 0 total 0.0s longest 0.0s
== refused: exit=1 killed=False wall=2.211s
   outages: 0 total 0.0s longest 0.0s
   disk MiB peak/after: checkout +0/0, gitinstall +0/0, state +5/5, captures +0/0, tmp +0/0, pnpmstore +0/0, cache +0/0
== refused-again: exit=1 killed=False wall=2.204s
   outages: 0 total 0.0s longest 0.0s
   disk MiB peak/after: checkout +0/0, gitinstall +0/0, state +0/0, captures +0/0, tmp +0/0, pnpmstore +0/0, cache +0/0
== control: exit=0 killed=False wall=383.718s
   outages: 1 total 12.3s longest 12.3s
   disk MiB peak/after: checkout +7/7, gitinstall +5020/4875, state +5018/4874, captures +0/0, tmp +35/35, pnpmstore +2984/2984, cache +0/0
== control-observe: exit=None killed=None wall=60.015s
   outages: 0 total 0.0s longest 0.0s
   disk MiB peak/after: checkout +0/0, gitinstall +0/0, state +0/-0, captures +0/0, tmp +0/0, pnpmstore +0/0, cache +0/0

@clawsweeper

clawsweeper Bot commented Nov 22, 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 docs Improvements or additions to documentation size: S labels Nov 22, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 22, 2026
…hen state outlives the image

The Git update.run route now refuses an externally supervised Gateway with external-supervisor-update-required, as the package route and automatic updates do. The container warning also says that an image recreated with its original build may refuse upgraded state.
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Nov 22, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 22, 2026
@clawsweeper

clawsweeper Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR lets Git checkouts inside containers update with a persistence warning while preserving image-install and external-supervisor restrictions.

Example: A Git checkout on a mounted volume runs openclaw update inside Docker with /.dockerenv present.

  • Before: The update fails with container-install and incorrectly tells the user to update the image.
  • After: The checkout updates through the release launcher and records a warning about container recreation.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The source repair is focused and has meaningful regression coverage, but inspectable after-fix runtime proof is missing and exact-head CI has an unattributed failure.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A user who cloned and built OpenClaw inside a container cannot update the checkout and receives image-redeployment guidance that does not fit the installation.
Reason: The failure is concrete, the repair is narrow, and maintainer authorship supplies the direction decision for replacing refusal with an explicit persistence warning.

Regression provenance

Regression provenance — verified: source commit be5f7fad9dfe by Ayaan Zaidi; canonical PR #203194 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a confirmed update regression still present on main, with no definite introduced code defect found.

Priority: P1
Reviewed head: 91087630aff83eef70fb84f971997c6aba08c496

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Attach the referenced after-fix container update recording or logs, including warning output, image-install skipping, supervisor refusal, and a latest-stable upgrade with settings and data preserved; the regression test's baseline failure is described but not shown.
Agent review details

How this fits together

The update subsystem receives CLI, Gateway, and automatic update requests, checks installation ownership and prerequisites, prepares a release, and hands activation to the resident launcher.

flowchart TD
  A[CLI or automatic update] --> C[Update admission]
  B[Gateway update request] --> C
  C --> D[Git update preflight]
  D --> E[Warning in update ledger]
  D --> F[Prepare and validate release]
  F --> G[Launcher trial and Gateway restart]
Loading

Technical review

Best possible solution:

Keep the focused preflight warning and existing installation-ownership checks, with release preparation and activation remaining under their current owners.

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

The current-main preflight directly establishes the failure for /.dockerenv, and the contributor supplied matching refusal logs plus a successful marker-removed control; this review ran no target code.

Is this the best way to solve the issue?

The patch fixes the mistaken environment-based refusal at its existing owner, preserves the other prerequisite checks, and adds focused coverage without new production machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 34ce936db81e.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit be5f7fa adds src/update/run.ts:119 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: be5f7fad9dfe; files: src/update/run.ts)
  • Jason (Json): Raw commit 32d629f adds docs/cli/update/how-updates-run.md:1594 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 32d629f3ef0b; files: docs/cli/update/how-updates-run.md)

PR surface

Source +28, Tests +63, Docs +7. Total +98 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 45 17 +28
Tests 2 85 22 +63
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 137 39 +98

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P1: Current main blocks updates for otherwise valid Git checkouts inside containers, and supplied runtime logs confirm the failure.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: Current main blocks updates for otherwise valid Git checkouts inside containers, and supplied runtime logs confirm the failure.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 22, 2026, 1:39 PM ET / 18:39 UTC.

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

GREEN raw logs: PR head 91087630aff, same real-systemd container and reproduction, /.dockerenv present throughout. Raw stdout, unedited.

GREEN update: exit 0, 380.4 s
{
  "runId": "17e34065-94ab-4d58-b2c1-8610e5fbddad",
  "createdAtMs": 1795372412895,
  "updatedAtMs": 1795372790113,
  "trigger": "api",
  "phase": "finished",
  "status": "succeeded",
  "reason": null,
  "origin": {
    "deliveryContext": {
      "channel": "webchat"
    },
    "cause": "none"
  },
  "target": {
    "kind": "git",
    "version": "2026.11.6",
    "sha": "5a1954cfa82aee932770f02a4c27d4aa8c83f222"
  },
  "before": {
    "version": "2026.11.6"
  },
  "after": {
    "version": "2026.11.6",
    "buildId": "2026.11.6-5a1954cfa82a-2026-11-22T18-33-49.378Z"
  },
  "steps": [
    {
      "step": "requested",
      "status": "completed",
      "startedAtMs": 1795372412895,
      "endedAtMs": 1795372413124
    },
    {
      "step": "notice:ack",
      "status": "skipped",
      "endedAtMs": 1795372412970,
      "detail": "no delivery target"
    },
    {
      "step": "staging",
      "status": "completed",
      "startedAtMs": 1795372413124,
      "endedAtMs": 1795372747489
    },
    {
      "step": "warning:preflight",
      "status": "completed",
      "endedAtMs": 1795372413244,
      "detail": "OpenClaw is running in a container. The update continues, but whatever is not on a mounted volume is reset when the container is recreated from its image. Keep this installation and ~/.openclaw on volumes. If only the state directory is on a volume, the image's original build may refuse the upgraded state after a recreate, so build the new version into the image first."
    },
    {
      "step": "prepare:git-resolve-target",
      "status": "completed",
      "startedAtMs": 1795372413255,
      "endedAtMs": 1795372790113
    },
    {
      "step": "prepare:worktree",
      "status": "completed",
      "startedAtMs": 1795372413268,
      "endedAtMs": 1795372790113
    },
    {
      "step": "prepare:install",
      "status": "completed",
      "startedAtMs": 1795372416310,
      "endedAtMs": 1795372790113
    },
    {
      "step": "prepare:build",
      "status": "completed",
      "startedAtMs": 1795372428770,
      "endedAtMs": 1795372790113
    },
    {
      "step": "prepare:ui-build",
      "status": "completed",
      "startedAtMs": 1795372703508,
      "endedAtMs": 1795372790113
    },
    {
      "step": "validating",
      "status": "completed",
      "startedAtMs": 1795372747489,
      "endedAtMs": 1795372751221
    },
    {
      "step": "plugins",
      "status": "completed",
      "startedAtMs": 1795372748537,
      "endedAtMs": 1795372751207
    },
    {
      "step": "activating",
      "status": "completed",
      "startedAtMs": 1795372751221,
      "endedAtMs": 1795372751227
    },
    {
      "step": "restarting",
      "status": "completed",
      "startedAtMs": 1795372751227,
      "endedAtMs": 1795372790113
    }
  ],
  "verification": {
    "booted": true,
    "runningVersion": "2026.11.6",
    "runningBuildId": "2026.11.6-5a1954cfa82a-2026-11-22T18-33-49.378Z",
    "noticeDelivered": false
  },
  "repair": [],
  "confirmedAtMs": null,
  "finishedAtMs": 1795372790113,
  "downtimeMs": null
}
GREEN noop: exit 0, 6.5 s
{
  "runId": "6aefd4cc-9c89-4cbb-bcc7-7e32e167dc3d",
  "createdAtMs": 1795372796812,
  "updatedAtMs": 1795372799474,
  "trigger": "api",
  "phase": "finished",
  "status": "skipped",
  "reason": "already-current",
  "origin": {
    "deliveryContext": {
      "channel": "webchat"
    },
    "cause": "none"
  },
  "target": {
    "kind": "git",
    "version": "2026.11.6",
    "sha": "5a1954cfa82aee932770f02a4c27d4aa8c83f222"
  },
  "before": {
    "version": "2026.11.6"
  },
  "after": {},
  "steps": [
    {
      "step": "requested",
      "status": "completed",
      "startedAtMs": 1795372796812,
      "endedAtMs": 1795372796914
    },
    {
      "step": "notice:ack",
      "status": "skipped",
      "endedAtMs": 1795372796842,
      "detail": "no delivery target"
    },
    {
      "step": "staging",
      "status": "skipped",
      "startedAtMs": 1795372796914,
      "endedAtMs": 1795372799474
    },
    {
      "step": "plugins",
      "status": "completed",
      "startedAtMs": 1795372796919,
      "endedAtMs": 1795372799465
    }
  ],
  "verification": {
    "noticeDelivered": false
  },
  "repair": [],
  "confirmedAtMs": null,
  "finishedAtMs": 1795372799474,
  "downtimeMs": null
}
GREEN image-shape: exit 0, 4.1 s
release=/home/appuser/.openclaw/git-install/releases/e55d019f-b001-4c4e-8546-3a03b63df377/openclaw
ls: cannot access '/home/appuser/imgapp/.git': No such file or directory
{
  "status": "skipped",
  "mode": "unknown",
  "root": "/home/appuser/imgapp",
  "reason": "container-image-install",
  "before": {
    "version": "2026.11.6"
  },
  "steps": [
    {
      "name": "requested",
      "command": "openclaw update",
      "cwd": "/home/appuser/imgapp",
      "durationMs": 0,
      "exitCode": 0,
      "stderrTail": "Installation ownership could not be determined. Run openclaw gateway status --deep and npm root -g; retry openclaw update from the owning installation or reinstall using the original method.\nRoot: /home/appuser/imgapp; Git metadata: absent or unreadable; node_modules layout: outside node_modules, local node_modules present; package.json name: openclaw. Service unit target: not inspected (service management unavailable). Inspected package-manager owners: package root: /home/appuser/imgapp (resolved: /home/appuser/imgapp); npm root -g: /usr/local/lib/node_modules; pnpm root -g: /home/appuser/um/pnpm-home/global/v11; npm install layout: no global prefix. Pull or build the target Docker/container image, then redeploy it with the same state/config mounts. No package changes or Gateway restart were attempted.",
      "failureFacts": [
        {
          "check": "installation-inspection",
          "code": "installation-unclassified",
          "message": "Installation ownership could not be determined. Run openclaw gateway status --deep and npm root -g; retry openclaw update from the owning installation or reinstall using the original method."
        }
      ]
    }
  ],
  "durationMs": 0,
  "reportPath": "/home/appuser/um/tmp/openclaw-update-report-xRTXBE/639254bb-886f-4c23-97fc-51446049bf4f.md"
}
update-exit=0
dockerenv-present
Per-step summary: Gateway outages and per-directory disk
   outages: 0 total 0.0s longest 0.0s
== update: exit=0 killed=False wall=380.359s
   outages: 1 total 11.8s longest 11.8s
   disk MiB peak/after: checkout +7/7, gitinstall +5020/4875, state +5023/4879, captures +0/0, tmp +36/36, pnpmstore +2983/2983, cache +0/0
== noop: exit=0 killed=False wall=6.488s
   outages: 0 total 0.0s longest 0.0s
   disk MiB peak/after: checkout +0/0, gitinstall +0/0, state +0/0, captures +0/0, tmp +0/0, pnpmstore +0/0, cache +0/0
== image-shape: exit=0 killed=None wall=4.117s
   outages: 0 total 0.0s longest 0.0s
Marker rows, hash and quick_check before and after
--- installed: exit=None wall=0.0s
    marker rows=1000 sha256=69cb2f125f43dd66ff7fb271bc725437ec250e627b5d310424636a07f9f6a806 quick_check=ok
--- update: exit=0 wall=380.4s
    marker rows=1000 sha256=69cb2f125f43dd66ff7fb271bc725437ec250e627b5d310424636a07f9f6a806 quick_check=ok
--- noop: exit=0 wall=6.5s
    marker rows=1000 sha256=69cb2f125f43dd66ff7fb271bc725437ec250e627b5d310424636a07f9f6a806 quick_check=ok

…into a release

update.run and automatic Git updates refuse with restart-unavailable when the Gateway is a container's main process without a supervisor, because the detached successor would stop the container. The message names --no-restart and a container restart. A CLI that stops following a run still prints its container warning.
…in process

A Gateway started with docker exec has no parent inside the container and hands off to a detached successor as on a host; only PID 1 or a direct child of the container's init shim or shell is refused.
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Recordings: live terminal captures of the same cell on base and on the PR head a631d9991b9, with idle time compressed to 2 s. Each ends with the raw facts the cell recorded.

RED, base a1aa1276017: openclaw update in a checkout cloned inside the container, with /.dockerenv present, exits 1 with container-install and the Gateway keeps serving.

red-container-checkout-base-a1aa127.mp4

GREEN, head a631d9991b9: the same update succeeds, the Gateway serves the target build, the warning:preflight note is recorded, a repeat is already-current, and a package root in the container is still skipped with container-image-install.

green-container-checkout-head-a631d99.mp4
GREEN at head update: exit 0, 369.8 s (raw stdout)
{
  "runId": "2012f965-332f-4d95-92eb-46260cd77758",
  "createdAtMs": 1795379663119,
  "updatedAtMs": 1795380030091,
  "trigger": "api",
  "phase": "finished",
  "status": "succeeded",
  "reason": null,
  "origin": {
    "deliveryContext": {
      "channel": "webchat"
    },
    "cause": "none"
  },
  "target": {
    "kind": "git",
    "version": "2026.11.6",
    "sha": "f7b8089e883f99d8b40b6d4bacfaf418e5f96d43"
  },
  "before": {
    "version": "2026.11.6"
  },
  "after": {
    "version": "2026.11.6",
    "buildId": "2026.11.6-f7b8089e883f-2026-11-22T20-34-38.926Z"
  },
  "steps": [
    {
      "step": "requested",
      "status": "completed",
      "startedAtMs": 1795379663119,
      "endedAtMs": 1795379663365
    },
    {
      "step": "notice:ack",
      "status": "skipped",
      "endedAtMs": 1795379663201,
      "detail": "no delivery target"
    },
    {
      "step": "staging",
      "status": "completed",
      "startedAtMs": 1795379663365,
      "endedAtMs": 1795379987277
    },
    {
      "step": "warning:preflight",
      "status": "completed",
      "endedAtMs": 1795379663429,
      "detail": "OpenClaw is running in a container. The update continues, but whatever is not on a mounted volume is reset when the container is recreated from its image. Keep this installation and ~/.openclaw on volumes. If only the state directory is on a volume, the image's original build may refuse the upgraded state after a recreate, so build the new version into the image first."
    },
    {
      "step": "prepare:git-resolve-target",
      "status": "completed",
      "startedAtMs": 1795379663440,
      "endedAtMs": 1795380030091
    },
    {
      "step": "prepare:worktree",
      "status": "completed",
      "startedAtMs": 1795379663451,
      "endedAtMs": 1795380030091
    },
    {
      "step": "prepare:install",
      "status": "completed",
      "startedAtMs": 1795379666597,
      "endedAtMs": 1795380030091
    },
    {
      "step": "prepare:build",
      "status": "completed",
      "startedAtMs": 1795379678337,
      "endedAtMs": 1795380030091
    },
    {
      "step": "prepare:ui-build",
      "status": "completed",
      "startedAtMs": 1795379943329,
      "endedAtMs": 1795380030091
    },
    {
      "step": "validating",
      "status": "completed",
      "startedAtMs": 1795379987277,
      "endedAtMs": 1795379990846
    },
    {
      "step": "plugins",
      "status": "completed",
      "startedAtMs": 1795379988232,
      "endedAtMs": 1795379990833
    },
    {
      "step": "activating",
      "status": "completed",
      "startedAtMs": 1795379990846,
      "endedAtMs": 1795379990851
    },
    {
      "step": "restarting",
      "status": "completed",
      "startedAtMs": 1795379990851,
      "endedAtMs": 1795380030091
    }
  ],
  "verification": {
    "booted": true,
    "runningVersion": "2026.11.6",
    "runningBuildId": "2026.11.6-f7b8089e883f-2026-11-22T20-34-38.926Z",
    "noticeDelivered": false
  },
  "repair": [],
  "confirmedAtMs": null,
  "finishedAtMs": 1795380030091,
  "downtimeMs": null
}
GREEN at head noop: exit 0, 6.5 s (raw stdout)
{
  "runId": "e62b050e-1a73-46b7-89b8-c8801e74874e",
  "createdAtMs": 1795380036907,
  "updatedAtMs": 1795380039751,
  "trigger": "api",
  "phase": "finished",
  "status": "skipped",
  "reason": "already-current",
  "origin": {
    "deliveryContext": {
      "channel": "webchat"
    },
    "cause": "none"
  },
  "target": {
    "kind": "git",
    "version": "2026.11.6",
    "sha": "f7b8089e883f99d8b40b6d4bacfaf418e5f96d43"
  },
  "before": {
    "version": "2026.11.6"
  },
  "after": {},
  "steps": [
    {
      "step": "requested",
      "status": "completed",
      "startedAtMs": 1795380036907,
      "endedAtMs": 1795380037021
    },
    {
      "step": "notice:ack",
      "status": "skipped",
      "endedAtMs": 1795380036930,
      "detail": "no delivery target"
    },
    {
      "step": "staging",
      "status": "skipped",
      "startedAtMs": 1795380037021,
      "endedAtMs": 1795380039751
    },
    {
      "step": "plugins",
      "status": "completed",
      "startedAtMs": 1795380037025,
      "endedAtMs": 1795380039741
    }
  ],
  "verification": {
    "noticeDelivered": false
  },
  "repair": [],
  "confirmedAtMs": null,
  "finishedAtMs": 1795380039751,
  "downtimeMs": null
}
GREEN at head image-shape: exit 0, 4.3 s (raw stdout)
release=/home/appuser/.openclaw/git-install/releases/c0e24e3c-6ca0-4c81-99dd-f818a87c159b/openclaw
ls: cannot access '/home/appuser/imgapp/.git': No such file or directory
{
  "status": "skipped",
  "mode": "unknown",
  "root": "/home/appuser/imgapp",
  "reason": "container-image-install",
  "before": {
    "version": "2026.11.6"
  },
  "steps": [
    {
      "name": "requested",
      "command": "openclaw update",
      "cwd": "/home/appuser/imgapp",
      "durationMs": 0,
      "exitCode": 0,
      "stderrTail": "Installation ownership could not be determined. Run openclaw gateway status --deep and npm root -g; retry openclaw update from the owning installation or reinstall using the original method.\nRoot: /home/appuser/imgapp; Git metadata: absent or unreadable; node_modules layout: outside node_modules, local node_modules present; package.json name: openclaw. Service unit target: not inspected (service management unavailable). Inspected package-manager owners: package root: /home/appuser/imgapp (resolved: /home/appuser/imgapp); npm root -g: /usr/local/lib/node_modules; pnpm root -g: /home/appuser/um/pnpm-home/global/v11; npm install layout: no global prefix. Pull or build the target Docker/container image, then redeploy it with the same state/config mounts. No package changes or Gateway restart were attempted.",
      "failureFacts": [
        {
          "check": "installation-inspection",
          "code": "installation-unclassified",
          "message": "Installation ownership could not be determined. Run openclaw gateway status --deep and npm root -g; retry openclaw update from the owning installation or reinstall using the original method."
        }
      ]
    }
  ],
  "durationMs": 0,
  "reportPath": "/home/appuser/um/tmp/openclaw-update-report-YoJH1u/508ed808-b735-489e-b30e-cd53a7710326.md"
}
update-exit=0
dockerenv-present
Per-step outages, disk and marker checks at head
   outages: 0 total 0.0s longest 0.0s
== update: exit=0 killed=False wall=369.831s
   outages: 1 total 11.9s longest 11.9s
   disk MiB peak/after: checkout +7/7, gitinstall +5019/4875, state +5023/4879, captures +0/0, tmp +36/36, pnpmstore +2984/2984, cache +0/0
== noop: exit=0 killed=False wall=6.5s
   outages: 0 total 0.0s longest 0.0s
   disk MiB peak/after: checkout +0/0, gitinstall +0/0, state +0/0, captures +0/0, tmp +0/0, pnpmstore +0/0, cache +0/0
== image-shape: exit=0 killed=None wall=4.291s
   outages: 0 total 0.0s longest 0.0s
--- installed: exit=None wall=0.0s
    marker rows=1000 sha256=69cb2f125f43dd66ff7fb271bc725437ec250e627b5d310424636a07f9f6a806 quick_check=ok
--- update: exit=0 wall=369.8s
    marker rows=1000 sha256=69cb2f125f43dd66ff7fb271bc725437ec250e627b5d310424636a07f9f6a806 quick_check=ok
--- noop: exit=0 wall=6.5s
    marker rows=1000 sha256=69cb2f125f43dd66ff7fb271bc725437ec250e627b5d310424636a07f9f6a806 quick_check=ok

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Closing: #203735 (merged as 58a3c7e) removed the blanket container refusal from src/update/preflight.ts and protects the official image with an install-owner marker instead, which settles the question this PR raised. This branch also conflicts with main after #203497.

Two things from this PR are not covered by #203735 and are left as possible follow-ups, not carried here:

  • A Gateway that is the container's PID 1: update.run and automatic updates still prepare a release and hand off to a detached successor, and the container stops when PID 1 exits. Read from the code and covered by unit tests on a local branch; not run in a real container.
  • No recorded warning that anything outside a mounted volume is lost when the container is recreated.

The raw logs in the comments above are from the earlier head and from main before #203735.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M 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.

1 participant