Skip to content

fix(claws): keep update JSON output parseable - #124130

Merged
steipete merged 1 commit into
mainfrom
fix/autoqa-refill-claws-cli-outcomes-v2
Aug 15, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/autoqa-refill-claws-cli-outcomes-v2

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where operators running openclaw claws update --json could receive plugin installer progress and restart messages before the update result, making stdout contain multiple values instead of one parseable JSON document.

Why This Change Was Made

The Claw update CLI now carries its runtime through the update and package lifecycle owners, using a log-muted runtime only for JSON mode. Human-readable updates keep the original runtime, so experimental, installer, warning, restart, and completion messages remain visible.

The root cause was that update did not pass the runtime that claws add already uses for the same nested package installer. The installer therefore fell back to the process default stdout runtime.

Production LOC: +5/-0. Tests: +10/-0.

This is deliberately limited to update output. It does not change config shape, files or provenance semantics, rollback or compensation, package trust or security policy, schemas, protocols, the Plugin SDK, dependencies, or release behavior. The analogous remove-side nested-uninstall logging path is excluded from this PR and remains a separate follow-up.

User Impact

openclaw claws update --json now emits exactly one JSON document on stdout even when the update installs a plugin package. Scripts can parse the result reliably, while interactive users retain the existing human-readable installer and restart guidance.

Evidence

  • Controlled regression: with only the five production additions removed and the regression test retained, src/cli/claws-cli.test.ts reported 35 passing tests and one expected failure because stdout contained the installer line plus JSON. Restoring the candidate produced 36/36 passing tests.
  • Blacksmith Testbox build and explicit four-file changed gate passed on b289ad98b6fe5287a525e6c9ebd8f3b78f45de5a: format, core and test types, lint with zero warnings/errors, import cycles, and selected guards.
  • Packed product proof built a local plugin and Claw v1/v2 artifacts, deleted the source directories, and exercised add/update from the packed artifacts under isolated HOME, config, and state roots. JSON update exited 0 with exactly one stdout JSON document and empty stderr; config, installed files, and SQLite-backed Claw provenance were present; cleanup completed.
  • A separate source-blind validation repeated the exact packed flow and confirmed JSON output, human experimental/installer/restart/completion logs, isolated state, and cleanup.
  • Testbox evidence: https://github.com/openclaw/openclaw/actions/runs/31876005764
  • Fresh autoreview against origin/main: no accepted or actionable findings.

@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS maintainer Maintainer-authored PR labels Aug 15, 2026
@steipete
steipete marked this pull request as ready for review August 15, 2026 09:21
@steipete steipete self-assigned this Aug 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 5:27 AM ET / 09:27 UTC.

ClawSweeper review

What this changes

The PR passes a log-muted runtime through Claws update package installation in JSON mode so stdout contains only the final update document.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this maintainer-owned PR open: it fixes a source-proven JSON-output regression through the existing package-lifecycle runtime path, with no blocking patch finding. Exact-head CI is still in progress before landing.

Priority: P2
Reviewed head: b289ad98b6fe5287a525e6c9ebd8f3b78f45de5a

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-boundary repair with a command-boundary regression test and detailed submitted packed-product evidence.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-authored PR, so contributor proof is not a gate; its body nevertheless documents packed-artifact and source-blind after-fix runs.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-authored PR, so contributor proof is not a gate; its body nevertheless documents packed-artifact and source-blind after-fix runs.
Evidence reviewed 7 items JSON output handoff: The proposed command boundary supplies a runtime whose informational log method is muted only for JSON mode, then writes the final result through the original runtime.
Actual output owner: The update options flow into package update and then into the installer, whose absent runtime falls back to the process default; the proposed propagated runtime therefore reaches the log emitter.
Established sibling pattern: Claws add already uses the same JSON-only muted runtime when it invokes its lifecycle owner, so update now follows the canonical sibling behavior.
Findings None None.
Security None None.

How this fits together

The Claws CLI turns an update request into an update plan and then invokes shared package lifecycle code. Package installation can emit progress logs, while JSON mode must reserve stdout for one machine-readable result.

flowchart LR
  A[Operator runs JSON update] --> B[Claws update command]
  B --> C[Update lifecycle]
  C --> D[Package installer]
  D --> E[Runtime output routing]
  E --> F[One JSON result on stdout]
Loading

Before merge

  • Resolve merge risk (P1) - Production code grows by five lines for a bug fix; the added type and runtime propagation are necessary to carry the already-established output boundary to the installer, with no duplicate flow to remove.
  • Complete next step (P2) - The maintainer label and in-progress exact-head checks require a maintainer landing pass rather than an automated repair job.
Agent review details

Security

None.

PR surface

Source +5, Tests +10. Total +15 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 5 0 +5
Tests 1 10 0 +10
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 15 0 +15

Review metrics

Metric Value Why it matters
Production versus test delta production +5, tests +10 The only production growth carries the existing runtime through update package lifecycle layers; the test extends the JSON-output contract at the command boundary.

Merge-risk options

  • Exact-head CI is still in progress, so this should not be landed until its required checks are green.

Maintainer options:

  1. Decide the mitigation before merge
    Land the existing runtime propagation once exact-head CI is green; it is the smallest canonical extension of the add-command output boundary and preserves interactive installer guidance.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the existing runtime propagation once exact-head CI is green; it is the smallest canonical extension of the add-command output boundary and preserves interactive installer guidance.

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

Yes. On current main, update package installation reaches an installer that defaults to process runtime logging before the command writes its JSON result; the submitted regression test models that exact path.

Is this the best way to solve the issue?

Yes. Passing the JSON-muted runtime through the existing update options chain matches the established Claws add path and fixes the output owner rather than filtering stdout after the fact.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: A broken machine-readable update result disrupts automation and scripts but has limited blast radius.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored PR, so contributor proof is not a gate; its body nevertheless documents packed-artifact and source-blind after-fix runs.

Label justifications:

  • P2: A broken machine-readable update result disrupts automation and scripts but has limited blast radius.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored PR, so contributor proof is not a gate; its body nevertheless documents packed-artifact and source-blind after-fix runs.

Evidence

What I checked:

  • JSON output handoff: The proposed command boundary supplies a runtime whose informational log method is muted only for JSON mode, then writes the final result through the original runtime. (src/cli/claws-update-cli.runtime.ts:213, b289ad98b6fe)
  • Actual output owner: The update options flow into package update and then into the installer, whose absent runtime falls back to the process default; the proposed propagated runtime therefore reaches the log emitter. (src/claws/packages.ts:325, b289ad98b6fe)
  • Established sibling pattern: Claws add already uses the same JSON-only muted runtime when it invokes its lifecycle owner, so update now follows the canonical sibling behavior. (src/cli/claws-cli.runtime.ts:509, 30216f52fabe)
  • Regression coverage: The extended CLI test injects an installer-style log through the runtime passed to update and asserts that JSON mode records only the final JSON result. (src/cli/claws-cli.test.ts:986, b289ad98b6fe)
  • Current-main and release check: Current main does not contain this patch, and no release tag contains the unmerged head. (src/cli/claws-update-cli.runtime.ts:213, 30216f52fabe)
  • Feature provenance: The Claws package-install and grouped-update work appears in Gio Della-Libera's historical commits, supporting routing to that lifecycle area. (src/claws/update-apply.ts:277, 7d159fdc7700)

Likely related people:

  • Gio Della-Libera: Authored the locally verified ClawHub-package installation and consented-update commits that define this lifecycle boundary. (role: Claws lifecycle and update contributor; confidence: high; commits: ba467fbd3efa, 7d159fdc7700; files: src/claws/packages.ts, src/claws/update-apply.ts)
  • Patrick Erichsen: Current-line blame attributes the immediate update/package forwarding path to this author, though the shallow checkout limits older-path attribution. (role: recent current-line contributor; confidence: low; commits: ab4557d22cc0; files: src/cli/claws-update-cli.runtime.ts, src/claws/update-apply.ts, src/claws/package-update.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.

@steipete

Copy link
Copy Markdown
Contributor Author

ClawSweeper before-merge items are addressed:

  • The production +5 is the necessary typed runtime handoff through the existing update and package owners. There is no duplicate update flow to remove; moving the mute into the shared plugin installer would suppress legitimate human output and affect unrelated callers.
  • Exact-head CI for b289ad98b6fe5287a525e6c9ebd8f3b78f45de5a is now green with zero pending checks, and this maintainer landing pass is using the native scripts/pr review/artifact/prepare/merge flow.

No Rank-up moves: list was emitted beyond those two before-merge items. The analogous remove-side logging path remains explicitly out of scope for this PR.

@steipete
steipete merged commit 03c1d77 into main Aug 15, 2026
254 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the fix/autoqa-refill-claws-cli-outcomes-v2 branch August 15, 2026 09:32
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS 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