Skip to content

fix: prevent live updater from leaving Gateway offline indefinitely - #119116

Merged
fuller-stack-dev merged 14 commits into
openclaw:mainfrom
fuller-stack-dev:fix/live-updater-command-timeouts
Aug 4, 2026
Merged

fuller-stack-dev merged 14 commits into
openclaw:mainfrom
fuller-stack-dev:fix/live-updater-command-timeouts

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

Closes #119098

AI-assisted implementation; I reviewed the final behavior and diff.

What Problem This Solves

The live updater previously ran maintenance-owned commands without wall deadlines. A stalled dependency install, build, service action, or probe could therefore keep the Gateway fenced or stopped indefinitely and prevent rollback, lock release, and terminal JSON output.

The August 3, 2026 fleet observation involved pnpm install --frozen-lockfile doing cross-platform optional-package resolution/download work, emitting network retries, and later remaining alive without observable progress. That does not establish a pnpm defect. The confirmed OpenClaw issue is the updater robustness gap: it did not bound or clean up any stalled child command.

Why This Change Was Made

External phases now use explicit wall budgets and the shared managed-child owner:

  • Git fetch: 5 minutes
  • Git fast-forward merge: 2 minutes
  • dependency install: 15 minutes
  • Gateway build: 20 minutes
  • service actions: 60 seconds
  • Gateway probes: 30 seconds
  • macOS rebuild: 30 minutes

Output does not reset these deadlines, so continuous retry/progress logs cannot extend maintenance indefinitely.

On macOS/Linux, commands run in detached process groups. Timeout settlement no longer depends on the child emitting close; process-group drain starts at the deadline and is bounded to five seconds. Transient Darwin EPERM group probes are polled until the same deadline rather than treated as final cleanup failure.

If a stopped-state command tree remains live or indeterminate after that bound, recovery fails closed: the previous service is not restarted alongside an uncontrolled updater child, and the maintenance lock is retained against the exact process group. A later heartbeat reclaims the lock after that group is gone. The terminal result is command_cleanup_failed with bounded redacted diagnostics.

Windows strict process-tree completion is explicitly unsupported because taskkill /T requires a live root PID and cannot verify descendants after normal root exit. The updater therefore refuses before spawning the pre-stop Git fetch, leaves the Gateway untouched, releases the maintenance lock, and emits unsupported_process_tree_verification. A future Windows Job Object owner can lift this constraint without weakening the updater contract.

This head also integrates the additive, redacted failure diagnostics merged in #119096. Timeout output retains safe phase, service-state, elapsed-time, timeout, cleanup-state, and lock-retention facts without exposing PIDs, paths, argv, environment, stdout, or stderr.

User Impact

Normal installs and builds keep generous wall budgets. A timeout before service stop releases the lock without changing service state. A timeout after stop cleans the exact child tree before rollback. An unverified live tree produces a bounded fail-closed result and retained ownership instead of either concurrent mutation or an unbounded wait.

Evidence

Canonical investigation base: 12beeb7b29476d0ac96590e51bbc14fff63fbe60.

Current canonical base: ae21f3c00c78403f05137d5e48957b8ceb40910c.

PR head: 911f3d4734be3c7891325d7ddfc79c09cd27fdf1.

No destructive test used the live Wilfred Gateway.

Focused macOS proof:

node scripts/run-vitest.mjs test/scripts/managed-child-process.test.ts test/scripts/openclaw-live-updater.test.ts
Test Files  2 passed (2)
Tests       96 passed (96)

Source-blind Darwin harness command:

node /tmp/behavior-validator-managed-command.fQWLDW/validate-v2.mjs

All clauses passed: silent timeout, active progress without false timeout, parent/descendant cleanup, and timeout settlement when close listeners are removed. Anti-cheat variants also passed for a different timeout, stderr retry output, and a SIGTERM-resistant descendant. Every recorded exact PID was dead at settlement.

Focused Linux Testbox proof and full changed-surface gate ran in Actions run 30882291207:

corepack pnpm test test/scripts/managed-child-process.test.ts test/scripts/openclaw-live-updater.test.ts
Test Files  2 passed (2)
Tests       92 passed (92)
node scripts/run-oxlint.mjs scripts/lib/managed-child-process.mjs .agents/skills/openclaw-live-updater/scripts/update-main.mjs
corepack pnpm test test/scripts/managed-child-process.test.ts test/scripts/openclaw-live-updater.test.ts
env OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 \
  corepack pnpm check:changed -- \
  .agents/skills/openclaw-live-updater/SKILL.md \
  .agents/skills/openclaw-live-updater/scripts/update-main.mjs \
  scripts/lib/managed-child-process.mjs \
  scripts/lib/managed-child-process.d.mts \
  test/external-script-modules.d.ts \
  test/scripts/managed-child-process.test.ts \
  test/scripts/openclaw-live-updater.test.ts

The gate passed formatting, declaration contracts, all-project typecheck, full lint, policy guards, and runtime import-cycle checks.

Coverage includes silent and active children, network-retry output, descendant cleanup, missing close, transient indeterminate POSIX state, bounded Windows timeout cleanup, strict Windows refusal before spawn, pre-stop timeout, post-stop recovery, process-group and manual-recovery lock retention, normal under-budget builds, and one machine-readable result.

Fresh autoreview after the explicit Windows strict-mode constraint was clean with no accepted/actionable findings; overall correctness 0.99.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Aug 4, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Aug 4, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 3:17 AM ET / 07:17 UTC.

ClawSweeper review

What this changes

This PR gives the live updater phase-specific command deadlines, verified POSIX process-tree cleanup, bounded failure reporting, and fail-closed recovery handling.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal maintainer merge handling: current main still runs updater commands without a deadline, while the branch moves timeout and process-tree ownership into the shared command runner. I found no actionable correctness finding; the temporary Windows refusal is an explicitly accepted availability trade-off.

Priority: P1
Reviewed head: 001507622331cdbe1919c6f6ecd2dc8cefe08bb4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has a coherent owner-boundary repair, focused fault coverage, and no actionable defect found in final-head review.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR is not subject to the external-contributor proof gate; its body nevertheless records after-fix Darwin harness and Linux Testbox results.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is not subject to the external-contributor proof gate; its body nevertheless records after-fix Darwin harness and Linux Testbox results.
Evidence reviewed 8 items Current-main defect: Current main invokes updater commands through unbounded synchronous execution, so a stalled child can prevent the surrounding recovery path from progressing.
Canonical repair boundary: The branch routes updater-owned commands through strict managed execution and translates timeout or unverified cleanup into typed updater invariants.
Timeout cleanup contract: The shared runner races a wall deadline independently of the child close callback, then drains the POSIX process group within a bounded interval before reporting timeout or cleanup failure.
Findings None None.
Security None None.

How this fits together

The live updater pauses and stops the managed Gateway, updates the checkout, installs and builds dependencies, then restarts and probes the service. Its command runner determines whether a stalled maintenance command can safely recover the Gateway.

flowchart LR
  A[Updater heartbeat] --> B[Maintenance lock]
  B --> C[Pause and stop Gateway]
  C --> D[Run bounded update command]
  D --> E{Tree cleanup proven?}
  E -->|Yes| F[Restart and verify Gateway]
  E -->|No| G[Retain lock and report recovery state]
  G --> H[Later heartbeat rechecks ownership]
Loading

Before merge

  • Resolve merge risk (P1) - On Windows, the updater intentionally refuses before fetch until a verifiable process-tree owner exists; existing Windows updater users will not receive automated updates through this path, although the Gateway remains online.
  • Complete next step (P2) - No mechanical repair remains; this maintainer-labelled PR needs normal exact-head merge handling for its explicitly accepted Windows availability trade-off.
Agent review details

Security

None.

PR surface

Tests +642, Docs 0, Other +572. Total +1214 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 737 95 +642
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 724 152 +572
Total 7 1462 248 +1214

Review metrics

Metric Value Why it matters
Production vs test LOC production +724/-152 (net +572); tests +737/-95 (net +642) The production growth implements one shared timeout/cleanup ownership boundary and updater recovery state, with slightly more focused regression coverage than production delta.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #119098
Summary: This PR is the concrete candidate fix for the canonical stalled-command live-updater failure.

Members:

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

Merge-risk options

Maintainer options:

  1. Accept the temporary Windows boundary (recommended)
    Merge with the documented pre-spawn Windows refusal, which preserves a running Gateway rather than recovering beside an unverified descendant tree.
  2. Pause for verified Windows ownership
    Defer the PR until a Job Object or equivalent process-tree owner can preserve updater support on Windows.

Technical review

Best possible solution:

Keep the shared managed-child runner as the one timeout and cleanup owner, retain the explicit Windows pre-stop refusal until a Job Object-equivalent owner exists, and merge after normal exact-head gates complete.

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

Yes—current main's unbounded updater runner is directly visible, and the submitted deterministic child-process harness describes the stalled-command path without requiring a live Gateway.

Is this the best way to solve the issue?

Yes—the shared managed-child owner is the narrowest maintainable boundary for deadlines and verified cleanup; downstream recovery guards alone would duplicate lifecycle policy.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: The intentional Windows fail-closed path changes existing updater behavior by refusing the update before fetch.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored PR is not subject to the external-contributor proof gate; its body nevertheless records after-fix Darwin harness and Linux Testbox results.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: A stalled updater maintenance command can keep the managed Gateway offline without a terminal recovery result.
  • merge-risk: 🚨 compatibility: The intentional Windows fail-closed path changes existing updater behavior by refusing the update before fetch.
  • merge-risk: 🚨 availability: The PR changes Gateway stop, cleanup, rollback, lock retention, and restart behavior during maintenance.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored PR is not subject to the external-contributor proof gate; its body nevertheless records after-fix Darwin harness and Linux Testbox results.

Evidence

What I checked:

Likely related people:

  • fuller-stack-dev: Authored the functional commits in this PR and the merged adjacent diagnostics work supplied in the review context. (role: current reliability repair and adjacent diagnostics contributor; confidence: high; commits: dd18d4a5b1af, a5ad77ad86e4, 8ad2e06a9d7a; files: .agents/skills/openclaw-live-updater/scripts/update-main.mjs, scripts/lib/managed-child-process.mjs)
  • Vincent Koc: Commit 3bbc4ad introduced the managed-child implementation and its focused lifecycle tests that this PR extends. (role: shared process-lifecycle contributor; confidence: high; commits: 3bbc4ad085e2; files: scripts/lib/managed-child-process.mjs, test/scripts/managed-child-process.test.ts)

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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-04T05:04:01.071Z sha dd18d4a :: found issues before merge. :: [P1] Bound the post-kill wait before recovery
  • reviewed 2026-08-04T06:16:17.194Z sha 30e7b90 :: found issues before merge. :: [P1] Fail closed when Windows tree cleanup cannot be verified
  • reviewed 2026-08-04T06:29:05.486Z sha 65cb923 :: found issues before merge. :: [P1] Fail closed for Windows success with lingering descendants | [P2] Align the updater lock declaration with the runtime API
  • reviewed 2026-08-04T06:38:52.332Z sha a5ad77a :: needs maintainer review before merge. :: none

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 4, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 4, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Maintainer decision: accept the temporary fail-closed Windows boundary in this PR. Until a Job Object or equivalent verified process-tree owner exists, strict Windows updater commands must refuse before spawning the pre-stop fetch, leaving the Gateway online and releasing the maintenance lock. This availability tradeoff is preferable to recovering alongside an unverified descendant tree.

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 Aug 4, 2026
@clawsweeper clawsweeper Bot added 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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 4, 2026
…and-timeouts

# Conflicts:
#	.agents/skills/openclaw-live-updater/scripts/update-main.mjs
#	test/scripts/openclaw-live-updater.test.ts
@fuller-stack-dev
fuller-stack-dev merged commit b1f2aae into openclaw:main Aug 4, 2026
106 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the fix/live-updater-command-timeouts branch August 4, 2026 08:00
vincentkoc added a commit that referenced this pull request Aug 4, 2026
…checkpoint

* origin/main: (46 commits)
  fix(agents): recover from invalid compaction summaries (#119137)
  fix(gateway): expose OAuth-backed tools to CLI agents (#119166)
  fix(plugins): preserve metadata reloads during models status (#119183)
  fix(test): bound direct gateway server runs (#119184)
  test(tui): prove command surfaces through PTY (#119165)
  fix(testbox): restore claims across path aliases (#119170)
  fix(message): preserve sends with incidental Telegram locations
  fix(perf): give each concurrency sample a full deadline (#119164)
  fix(testbox): remove changed-gate sync residue (#119163)
  fix(telegram): preserve later chunks after rejected sends
  fix(tui): block terminal controls in system messages (#118998)
  fix(auto-reply): suppress false no-reply fallback during continuations (#119154)
  fix(scripts): prevent gateway benchmarks from stalling on probes (#119063)
  test(channels): verify built sanitizer semantics (#119151)
  fix: prevent live updater from leaving Gateway offline indefinitely (#119116)
  test(qa): restore memory tools primary ownership (#119142)
  fix(agents): settle yielded fanout at harness boundary (#118703)
  fix(codex): cap compaction override warning cache via createDedupeCache (#101745)
  fix(daemon): skip unlabeled launchd plists (#119091)
  test(qa): repair QA catalog integrity (#119140)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
…penclaw#119116)

* fix(updater): bound maintenance commands

* fix(updater): bound post-kill cleanup

* fix(updater): fail closed on unverified Windows cleanup

* fix(updater): constrain unverifiable Windows commands

* fix(scripts): satisfy managed child return contract
zyw02 pushed a commit to zyw02/openclaw that referenced this pull request Aug 5, 2026
* origin/main:
  fix: prevent live updater from leaving Gateway offline indefinitely (openclaw#119116)
  test(qa): restore memory tools primary ownership (openclaw#119142)
  fix(agents): settle yielded fanout at harness boundary (openclaw#118703)
  fix(codex): cap compaction override warning cache via createDedupeCache (openclaw#101745)
  fix(daemon): skip unlabeled launchd plists (openclaw#119091)
  test(qa): repair QA catalog integrity (openclaw#119140)
  fix(test): isolate shared state between test files (openclaw#118781)
  test(xai): cover delayed OAuth connection setup
  fix(voice): start socket timeout after auth preparation
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 6, 2026
* origin/main:
  fix: prevent live updater from leaving Gateway offline indefinitely (openclaw#119116)
  test(qa): restore memory tools primary ownership (openclaw#119142)
  fix(agents): settle yielded fanout at harness boundary (openclaw#118703)
  fix(codex): cap compaction override warning cache via createDedupeCache (openclaw#101745)
  fix(daemon): skip unlabeled launchd plists (openclaw#119091)
  test(qa): repair QA catalog integrity (openclaw#119140)
  fix(test): isolate shared state between test files (openclaw#118781)
  test(xai): cover delayed OAuth connection setup
  fix(voice): start socket timeout after auth preparation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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]: live updater can hold the Gateway offline indefinitely when a child command stalls

1 participant