Skip to content

fix: expose live updater recovery failure diagnostics - #119096

Merged
fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:codex/live-updater-failure-diagnostics-20260804
Aug 4, 2026
Merged

fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:codex/live-updater-failure-diagnostics-20260804

Conversation

@fuller-stack-dev

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

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where operators and fleet automation could not identify the primary failure and rollback failure when the live updater raised a nested recovery error. The schema v1 result retained only the aggregate code and message, while invariant codes/details, command status, member roles, and the aggregate cause relationship were lost.

Why This Change Was Made

Adds an optional, bounded error.diagnostics object while preserving the existing schema version, exit status, single-JSON stdout contract, and error.code/error.message fields. Updater-owned aggregate producers assign semantic roles, command producers assign fixed low-cardinality operation labels, and invariant wrappers retain bounded typed causes.

The formatter intentionally excludes nested messages, stacks, argv, environment, paths, PIDs, stdout, stderr, command output, and arbitrary error properties. Recursive aggregates are cycle-safe and bounded to four levels and eight members.

AI-assisted: yes.

User Impact

Fleet operators and automation can distinguish the primary updater failure from proof, cleanup, or rollback failures and can identify safe invariant and command categories without parsing stderr or exposing sensitive process data.

Evidence

Red reproduction base: 12beeb7b29476d0ac96590e51bbc14fff63fbe60

Final refreshed canonical base: 5a1daf81a554a9ff63604700824ea074d301f9db

The intervening canonical range did not touch the updater, its tests, or its script declaration surface.

Before, a synthetic primary invariant plus rollback command failure produced only:

{"schemaVersion":1,"ok":false,"error":{"code":"update_failed","message":"Gateway replacement failed and the previous managed service could not be restored"}}

After, the same failure class retains additive diagnostics:

{
  "schemaVersion": 1,
  "ok": false,
  "error": {
    "code": "update_failed",
    "message": "Gateway replacement failed and the previous managed service could not be restored",
    "diagnostics": {
      "kind": "aggregate",
      "members": [
        {
          "role": "primary",
          "error": {
            "kind": "invariant",
            "code": "gateway_launchagent_failed",
            "details": { "exitTimeoutSeconds": 0 }
          }
        },
        {
          "role": "rollback",
          "error": {
            "kind": "command",
            "operation": "launchd.bootstrap",
            "status": 23
          }
        }
      ],
      "causeMember": 1
    }
  }
}

ClawSweeper identified two sibling recovery-boundary gaps on earlier heads. The final head retains both gateway.suspend.prepare and non-mac stopped-proof gateway.status command failures as typed invariant causes, with a maintenance-path regression covering suspension failure followed by stopped-proof failure.

Compatibility search:

  • A repository-wide search for openclaw-live-updater/scripts/update-main.mjs, formatUpdateFailure(, and maintainMain( found only the updater test and its declaration module as consumers.
  • No production consumer, JSON schema, or exact-shape validator for the updater failure result exists in this repository.
  • Existing schema v1 fields and values remain unchanged; error.diagnostics is additive and optional from a consumer perspective.

Validation:

  • node scripts/run-vitest.mjs test/scripts/openclaw-live-updater.test.ts: 72 passed.
  • The real maintenance fallback regression records suspension status 23 and stopped-proof gateway.status status 29, while excluding secret stderr and the entrypoint path.
  • node scripts/check-changed.mjs -- <touched files>: all fail-safe lanes passed on trusted-source AWS run run_70aefa702113, including all-project typecheck, full lint, script declarations, formatting, and import-cycle checks. The wrapper then attempted a duplicate local fallback because its portal summary handoff timed out; that expensive duplicate was stopped during typecheck per proof-routing policy.
  • Source-blind behavior contract: nonzero/simple failure remained one stdout JSON line with empty stderr; the suspension invariant retained gateway.suspend.prepare plus status 23; secret stderr, proof text, and the entrypoint path were absent.
  • Final canonical exact-head CI run 30879914876: successful.
  • Fresh autoreview after each recovery-boundary correction: clean, no accepted/actionable findings; overall correctness 0.99.

@openclaw-barnacle openclaw-barnacle Bot added size: L 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 4, 2026, 1:16 AM ET / 05:16 UTC.

ClawSweeper review

What this changes

Adds bounded typed diagnostics to live-updater failure JSON so fleet automation can distinguish primary, proof, cleanup, and rollback failures without exposing process output.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

This PR remains necessary, but one direct updater command still loses its operation identity in recovery diagnostics. The prior stopped-proof finding is fixed; retain the PR for the narrow log-query wrapper and regression test.

Priority: P2
Reviewed head: 1d3c915baa184ec0b4802457e179c3e85f130c99

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The design and focused coverage are strong, but one direct command path still misses the operation label the new diagnostics promise.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The repository-member PR is exempt from the external-contributor proof gate; its body also reports focused terminal behavior and regression coverage.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository-member PR is exempt from the external-contributor proof gate; its body also reports focused terminal behavior and regression coverage.
Evidence reviewed 4 items Current main lacks diagnostics: The current CLI failure boundary emits only the error code and message; nested causes and command status are not retained.
Unwrapped log command: The post-restart log query uses execFileSync directly and rethrows its raw error when no fallback log exists; the new formatter then assigns only external_command rather than a gateway.logs operation.
Prior finding addressed: The refreshed head preserves gateway.suspend.prepare and gateway.status command causes through the invariant wrappers, with a regression test covering both statuses and redaction.
Findings 1 actionable finding [P2] Retain the log-query operation label
Security None None.

How this fits together

The live updater fast-forwards a managed OpenClaw checkout, safely stops or recovers its Gateway, and emits a single JSON outcome for operators. Its error formatter converts updater, invariant, and child-process failures into the machine-readable result consumed by automation.

flowchart LR
  A[Live update request] --> B[Gateway suspension]
  B --> C[Build and restart]
  C --> D[Readiness and log audit]
  D --> E[Typed failure formatter]
  E --> F[Single JSON result]
  F --> G[Fleet automation]
Loading

Before merge

  • Retain the log-query operation label (P2) - When the post-restart RPC log query fails and no fallback file exists, the raw execFileSync error reaches this formatter. It is reported only as external_command, unlike the other updater command boundaries, so a recovery aggregate cannot tell operators that gateway.logs was the failed operation. Wrap that producer in UpdateCommandError("gateway.logs", error) and add the no-fallback regression.
  • Resolve merge risk (P1) - error.diagnostics extends schema v1 results without a version change; no in-repository consumer was found, but strict external result parsers need additive-output compatibility confidence before merge.
  • Complete next step (P2) - The remaining repair is concrete, but this protected repository-member PR should return to its author for the focused change and exact-head review.

Findings

  • [P2] Retain the log-query operation label — .agents/skills/openclaw-live-updater/scripts/update-main.mjs:271-275
Agent review details

Security

None.

PR surface

Tests +323, Other +310. Total +633 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 323 0 +323
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 348 38 +310
Total 3 671 38 +633

Review metrics

Metric Value Why it matters
Production vs test delta production +310; tests +314; declaration +9 The operator-facing formatter expands substantially, so the new diagnostic contract needs complete producer-path coverage.

Stored data model

Persistent data-model change detected: database schema: test/external-script-modules.d.ts, database schema: test/scripts/openclaw-live-updater.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Wrap the log-query failure before merge (recommended)
    Wrap the no-fallback post-restart log-query error as gateway.logs and add a regression that verifies its status is retained without output leakage.

Technical review

Best possible solution:

Make each updater-owned command producer attach its fixed operation label before the terminal formatter, then retain the stable existing JSON fields with bounded, redacted diagnostics.

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

Yes: when the post-restart RPC log query fails and no local fallback log exists, current source rethrows its raw command error into recovery aggregation; the new formatter maps it only to external_command.

Is this the best way to solve the issue?

No: the formatter is the right terminal boundary, but the raw log-query producer must attach gateway.logs there rather than making the formatter infer command identity.

Full review comments:

  • [P2] Retain the log-query operation label — .agents/skills/openclaw-live-updater/scripts/update-main.mjs:271-275
    When the post-restart RPC log query fails and no fallback file exists, the raw execFileSync error reaches this formatter. It is reported only as external_command, unlike the other updater command boundaries, so a recovery aggregate cannot tell operators that gateway.logs was the failed operation. Wrap that producer in UpdateCommandError("gateway.logs", error) and add the no-fallback regression.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: A bounded updater recovery path still fails to identify the command that caused the primary diagnostic.
  • merge-risk: 🚨 compatibility: The PR extends the stable machine-readable failure result while retaining schema version 1.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The repository-member PR is exempt from the external-contributor proof gate; its body also reports focused terminal behavior and regression coverage.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the initial live-updater feature and several subsequent snapshot and recovery hardening commits. (role: original feature and recovery-path owner; confidence: high; commits: 2ace363e9866, 23d4e48172d7, 21fba83254a8; files: .agents/skills/openclaw-live-updater/scripts/update-main.mjs, test/scripts/openclaw-live-updater.test.ts)
  • fuller-stack-dev: Authored the current PR and the prior merged launchd-replacement hardening in this updater area. (role: recent updater recovery contributor; confidence: high; commits: ae27d7936447, 1d3c915baa18; files: .agents/skills/openclaw-live-updater/scripts/update-main.mjs, test/scripts/openclaw-live-updater.test.ts)

Rank-up moves

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

  • Wrap the no-fallback log-query failure as gateway.logs.
  • Add a focused regression that asserts the primary diagnostic retains that operation and status without command output.
  • Request one exact-head re-review after the repair.

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 (2 earlier review cycles)
  • reviewed 2026-08-04T04:05:23.075Z sha 38051fb045334025a992ac0ffdccdf1776e84713 :: found issues before merge. :: [P2] Preserve suspension-command diagnostics through the wrapper
  • reviewed 2026-08-04T05:08:02.969Z sha 5b55101639e1a96560f1c02870236237638b1918 :: found issues before merge. :: [P2] Preserve stopped-proof command diagnostics

@fuller-stack-dev
fuller-stack-dev force-pushed the codex/live-updater-failure-diagnostics-20260804 branch from 38051fb to 5b55101 Compare August 4, 2026 04:40
@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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 4, 2026
@fuller-stack-dev
fuller-stack-dev force-pushed the codex/live-updater-failure-diagnostics-20260804 branch from 5b55101 to 1d3c915 Compare August 4, 2026 05:11
@fuller-stack-dev
fuller-stack-dev merged commit 8ad2e06 into openclaw:main Aug 4, 2026
96 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the codex/live-updater-failure-diagnostics-20260804 branch August 4, 2026 05:30
vincentkoc added a commit that referenced this pull request Aug 4, 2026
* origin/main:
  fix: preserve live updater failure diagnostics (#119096)
  fix: recover new-session models through Gateway startup (#119120)
  test(qa): cover instruction profile artifacts (#119078)
  fix(telegram): record automatic delivery message ids
  test(qa): cover memory promotion safety (#119093)
  test(qa): prove overflow compaction pruning (#119033)
  fix(tool-search): preserve deferred MCP failures (#118363)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
vincentkoc added a commit that referenced this pull request Aug 4, 2026
* 'main' of https://github.com/openclaw/openclaw:
  test(qa): cover sandboxed exec behavior (#119053)
  test(qa): prove shared-channel memory recall (#119111)
  fix(telegram): keep request deadlines through response bodies
  test(qa): cover gateway plugin approvals (#119128)
  fix(ai): keep OpenAI tool call id truncation UTF-16 safe (#110471)
  fix: preserve live updater failure diagnostics (#119096)
  fix: recover new-session models through Gateway startup (#119120)
  test(qa): cover instruction profile artifacts (#119078)
  fix(telegram): record automatic delivery message ids
  test(qa): cover memory promotion safety (#119093)
  test(qa): prove overflow compaction pruning (#119033)
  fix(tool-search): preserve deferred MCP failures (#118363)
  fix(macos): keep setup activation within app checks
  test(setup): type provider kind fixture
  fix(setup): complete prepared model activation
  fix(protocol): regenerate Swift wizard models
  fix(ollama): activate the model selected during setup
  fix(setup): preserve the prepared model handoff
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
* origin/main:
  fix: preserve live updater failure diagnostics (openclaw#119096)
  fix: recover new-session models through Gateway startup (openclaw#119120)
  test(qa): cover instruction profile artifacts (openclaw#119078)
  fix(telegram): record automatic delivery message ids
  test(qa): cover memory promotion safety (openclaw#119093)
  test(qa): prove overflow compaction pruning (openclaw#119033)
  fix(tool-search): preserve deferred MCP failures (openclaw#118363)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
* 'main' of https://github.com/openclaw/openclaw:
  test(qa): cover sandboxed exec behavior (openclaw#119053)
  test(qa): prove shared-channel memory recall (openclaw#119111)
  fix(telegram): keep request deadlines through response bodies
  test(qa): cover gateway plugin approvals (openclaw#119128)
  fix(ai): keep OpenAI tool call id truncation UTF-16 safe (openclaw#110471)
  fix: preserve live updater failure diagnostics (openclaw#119096)
  fix: recover new-session models through Gateway startup (openclaw#119120)
  test(qa): cover instruction profile artifacts (openclaw#119078)
  fix(telegram): record automatic delivery message ids
  test(qa): cover memory promotion safety (openclaw#119093)
  test(qa): prove overflow compaction pruning (openclaw#119033)
  fix(tool-search): preserve deferred MCP failures (openclaw#118363)
  fix(macos): keep setup activation within app checks
  test(setup): type provider kind fixture
  fix(setup): complete prepared model activation
  fix(protocol): regenerate Swift wizard models
  fix(ollama): activate the model selected during setup
  fix(setup): preserve the prepared model handoff
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: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant