Skip to content

[5.2] Gateway crashes after ~12h uptime: consumeGatewayRestartIntentPayloadSync is not a function, then supervisor downgrade leaves install schema-incompatible #77095

Closed

Description

@haru3613

Bug type

Crash + recovery path bug. The crash itself is bad; the post-crash recovery makes the install unbootable.

Beta release blocker

Yes — affects 5.2 GA users on macOS. Recovery requires manual npm i -g openclaw@latest; the supervisor's auto-recovery actively makes the situation worse.

Summary

After running openclaw 2026.5.2 (a448042) cleanly for ~12 hours, the gateway crashed with an unhandled rejection:

TypeError: consumeGatewayRestartIntentPayloadSync is not a function

The supervisor (or some recovery path I haven't been able to fully trace) then downgraded the global npm package to 2026.4.29 — but the on-disk ~/.openclaw/openclaw.json was still at 5.2 schema. Result: the older binary refuses to start ("Refusing to start the gateway service because this OpenClaw binary (2026.4.29) is older than the config last written by OpenClaw 2026.5.2"), launchd KeepAlive's it forever in a tight loop, and the gateway is permanently unreachable until the user manually npm i -g openclaw@latest.

This is not the first occurrence — the same downgrade backup pattern (openclaw.json.before-downgrade-20260429-...) appeared 12 hours earlier, suggesting the crash is reproducible at roughly the 12-hour uptime mark.

Crash signature

From ~/.openclaw/logs/stability/openclaw-stability-2026-05-03T16-31-08-909Z-82397-unhandled_rejection.json:

{
  "version": 1,
  "generatedAt": "2026-05-03T16:31:08.909Z",
  "reason": "unhandled_rejection",
  "process": {
    "pid": 82397,
    "platform": "darwin",
    "arch": "arm64",
    "node": "25.8.2",
    "uptimeMs": 43208279
  },
  "error": {
    "name": "TypeError",
    "message": "consumeGatewayRestartIntentPayloadSync is not a function"
  }
}

uptimeMs = 43,208,279 ms ≈ 12.0 hours. Heap was at 412 MB used / 532 MB total at crash, RSS 116 MB — not memory-pressured.

Snapshot summary leading up to the crash (last 1000 events, 642 dropped):

diagnostic.heartbeat:           240
diagnostic.memory.sample:       240
exec.process.completed:         150
session.state:                  119
queue.lane.enqueue/dequeue:     96 / 96
diagnostic.liveness.warning:    16
session.long_running:           5
message.queued:                 11

So there had been some long-running sessions and liveness warnings, but the process was otherwise functional.

Reproduction (best inference)

  1. Install openclaw@2026.5.2 on macOS (Apple Silicon, Node 25.8.2).
  2. Use it normally for ~12 hours — including agent runs that perform gateway tool restart actions (channels reload, plugins update, etc.).
  3. At some point a gateway restart intent payload is consumed via the synchronous code path.
  4. Process throws TypeError: consumeGatewayRestartIntentPayloadSync is not a function and crashes (unhandled rejection).
  5. Supervisor / recovery path downgrades global package to 2026.4.29.
  6. 2026.4.29 binary refuses to start because ~/.openclaw/openclaw.json meta.lastTouchedVersion is 2026.5.2.
  7. Gateway is now in a permanent restart loop — gateway.err.log fills with "Refusing to start the gateway service...".

I don't have a deterministic trigger for step 3 yet — it's possible the function is called on every Nth restart intent, or specifically when an intent coalesces with an in-flight one (cf. #74424, which is the same restart-intent payload subsystem with a different failure mode).

Expected behavior

  • The function being called (consumeGatewayRestartIntentPayloadSync) should exist, or the call site should use the available async variant.
  • The post-crash recovery should not leave the install in a state that's neither bootable nor downgrade-clean. If a downgrade is going to happen, the supervisor should also restore a config snapshot from before the schema bump, or refuse to downgrade.

Actual behavior

  • Crash with TypeError.
  • Supervisor downgrades binary; config left at newer schema; install unbootable.
  • launchd KeepAlive churns indefinitely.

Recovery steps that worked for me

# Move the downgrade backup out of the way so future "auto repair" can't reuse it
mkdir -p ~/.openclaw/_archive
mv ~/.openclaw/openclaw.json.before-downgrade-20260429-* ~/.openclaw/_archive/

# Re-upgrade
npm i -g openclaw@latest      # back to 2026.5.2
openclaw gateway restart

After ~45s of plugin staging, gateway probe was healthy: ok=true connect=true rpcOk=true.

But the underlying ~12h crash is unresolved; this is a reset, not a fix.

Environment

  • macOS Darwin 25.4.0 (Apple Silicon)
  • Node v25.8.2
  • npm v11.11.1
  • openclaw 2026.5.2 (a448042) → auto-downgrades to 2026.4.29 on crash
  • Plugins enabled: memory-core, telegram, browser, ... (full list available on request)

Related

Attachments

I can attach (sanitised):

  • openclaw-stability-2026-05-03T16-31-08-909Z-82397-unhandled_rejection.json (262 KB, contains last 1000 telemetry events)
  • Last 200 lines of gateway.err.log showing the Refusing-to-start loop
  • ~/.openclaw/openclaw.json.before-downgrade-20260429-20260503-105351 — the config snapshot the auto-downgrade preserved (showing this isn't a one-shot — same downgrade was triggered 12 hours earlier)

Let me know what's most useful.

Activity

  1. clawsweeper commented on May 4, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

    Current main and the shipped v2026.6.10 release cover the central crash/recovery path: restart intent consumption is present behind the lifecycle runtime, signal handlers catch and unstick restart failures, and supervised updates no longer replace the live Gateway package tree.

    Root-cause cluster
    Relationship: canonical
    Canonical: #77095
    Summary: This issue is the canonical report for the missing restart-intent function plus unsafe supervised update/downgrade recovery path; related restart continuation and LaunchAgent reports overlap but do not leave the central work open.

    Members:

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

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review details

    Best possible solution:

    Keep the shipped lifecycle-runtime and managed-update handoff behavior, and route any remaining macOS LaunchAgent KeepAlive restart race to #88309.

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

    No live 12-hour macOS reproduction was run; the original crash maps to source-level restart/update paths that are now covered by current code, tests, and release proof.

    Is this the best way to solve the issue?

    Yes: the current solution fixes the owner boundaries directly with an eager lifecycle runtime, signal-handler recovery, and managed-service update handoff instead of adding runtime compatibility shims.

    Security review:

    Security review: No patch security review applies because this is an issue triage, not a proposed diff.

    AGENTS.md: found and applied where relevant.

    What I checked:

    • Current restart-intent export: Current main exports consumeGatewayRestartIntentPayloadSync and consumeGatewayRestartIntentSync from the restart module, directly addressing the reported missing-function crash signature. (src/infra/restart.ts:275, 4d292caaa429)
    • Lifecycle runtime re-export: The gateway lifecycle runtime hub re-exports consumeGatewayRestartIntentPayloadSync from infra/restart, so the signal path has a stable eager import surface. (src/cli/gateway-cli/lifecycle.runtime.ts:15, 4d292caaa429)
    • Eager lifecycle load: runGatewayLoop now eagerly loads the lifecycle runtime before installing signal listeners, with code comments tying the old failure mode to in-place package upgrades, rotated dist chunks, and an unconsumed restart token. (src/cli/gateway-cli/run-loop.ts:111, 4d292caaa429)
    • Signal-handler recovery: SIGTERM failures fall back to stop, and SIGUSR1 failures log the error and best-effort clear the restart token through the eager lifecycle runtime. (src/cli/gateway-cli/run-loop.ts:702, 4d292caaa429)
    • Managed update handoff: update.run now requires managed-service handoff for global package updates and supervised git updates, or returns a safe skipped response instead of mutating the live Gateway package tree. (src/gateway/server-methods/update.ts:188, 4d292caaa429)
    • Restart only after successful update: The update method writes a restart sentinel but schedules restart only after a successful update or started handoff, avoiding crash-loop restart after failed package mutation. (src/gateway/server-methods/update.ts:338, 4d292caaa429)

    Likely related people:

    Codex review notes: model internal, reasoning high; reviewed against 4d292caaa429; fix evidence: release v2026.6.10, commit aa69b12d0086.

  2. barnacle-openclaw commented on May 30, 2026

    @barnacle-openclaw

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  3. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:crash-loopCrash, hang, restart loop, or process-level availability failure.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    on Jun 14, 2026
  4. added
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    and removed
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    on Jun 15, 2026
  5. added
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    and removed
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    on Jun 26, 2026
  6. locked as resolved and limited conversation to collaborators on Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions