Skip to content

fix(cli): render plugin search JSON failures - #127679

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa29-plugins-search-json
Aug 21, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa29-plugins-search-json

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where openclaw plugins search --json failures exited with empty stdout and human-only stderr. This affected both a missing search query and ClawHub transport failures, leaving scripts and agents without a parseable result.

Why This Change Was Made

The plugin-search owner was consuming failures locally and terminating before the shared CLI failure renderer and finalizers could run. Missing-query failures now use the existing expected CLI error contract, while ClawHub errors escape to the root renderer only in JSON mode. Human-mode ClawHub errors and all success/no-results behavior remain unchanged.

User Impact

Automation can reliably parse plugin-search failures as one canonical JSON document. Human users retain the existing actionable usage and transport diagnostics.

Evidence

  • Pre-fix owner regressions failed for the intended reason: both JSON cases threw the mocked __exit__:1 instead of propagating the usage or transport error.
  • Post-fix src/cli/plugins-search-command.test.ts — 5/5 passed, including both propagation regressions, successful JSON, result rendering, and limit validation.
  • Built-process regressions cover missing query, deterministic ClawHub failure, exact canonical envelopes, exit 1, stderr guidance, ANSI-free stdout, and dual-TTY finalization.
  • Targeted formatting and git diff --check passed.
  • Fresh final-branch structured autoreview reported no accepted P0/P1 findings.
  • Production delta: +6/-2, net +4. Tests: +88/-0.

Known local proof boundary: the host repeatedly terminated the repository build runner before it produced E2E runtime artifacts during concurrent owner work. Exact-head CI must run the built-process regressions before landing.

AI-assisted: yes. I reviewed the implementation and validation results.

@clawsweeper

clawsweeper Bot commented Aug 21, 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: S maintainer Maintainer-authored PR labels Aug 21, 2026
@steipete
steipete marked this pull request as ready for review August 21, 2026 23:15
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 21, 2026
@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 7:21 PM ET / 23:21 UTC.

ClawSweeper review

What this changes

This PR makes openclaw plugins search --json emit the standard parseable error document for a missing query or ClawHub search failure.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still consumes plugin-search failures before the shared JSON failure renderer, while the patch routes JSON-mode failures to that existing owner. The patch has no blocking correctness finding; exact-head built-process CI remains the material merge gate.

Priority: P2
Reviewed head: 9c888bd14e78af5370971e5183d07f6928333435

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch cleanly uses the existing failure owner and has focused boundary coverage; completion of exact-head CI is still required before merge.
Proof confidence 🌊 off-meta tidepool Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the remaining evidence gap is exact-head built-CLI validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the remaining evidence gap is exact-head built-CLI validation.
Evidence reviewed 7 items Current-main failure boundary: Current main prints and exits locally for a missing query, and catches every search error locally, so neither path reaches the root JSON renderer.
Canonical renderer already owns JSON failures: The root entrypoint writes formatCliJsonFailure to stdout when JSON mode is active, then emits human diagnostics to stderr.
Patch follows the existing owner boundary: The branch uses ExpectedCliError for missing input and rethrows only JSON-mode search failures; human-mode search errors retain local diagnostics.
Findings None None.
Security None None.

Live Verification

Command: node openclaw.mjs plugins search --json

Result: FAIL (partial) — step 2 expect_output "ok": false: expected terminal output was not visible within 30 seconds: "\"ok\": false"

node openclaw.mjs plugins search --json
runner@runnervm76f27:/tmp/clawsweeper-live-proof-127679-GQAkYO/target$ node openclaw.mjs plugins search --json
file:///tmp/clawsweeper-live-proof-127679-GQAkYO/target/openclaw.mjs:781
      throw new Error(await buildMissingEntryErrorMessage());
            ^

Error: openclaw: missing dist/entry.(m)js (build output).
This install looks like an unbuilt source tree or GitHub source archive.
Build locally with ˋpnpm install && pnpm buildˋ, or install a built package instead.
For pinned GitHub installs, use ˋnpm install -g github:openclaw/openclaw#‹ref›ˋ instead of a raw ˋ/archive/‹ref›.tar.gzˋ URL.
For releases, use ˋnpm install -g openclaw@latestˋ.
    at file:///tmp/clawsweeper-live-proof-127679-GQAkYO/target/openclaw.mjs:781:13

Node.js v24.19.0
runner@runnervm76f27:/tmp/clawsweeper-live-proof-127679-GQAkYO/target$ node openclaw.mjs plugins search --json
file:///tmp/clawsweeper-live-proof-127679-GQAkYO/target/openclaw.mjs:781
      throw new Error(await buildMissingEntryErrorMessage());
            ^

Error: openclaw: missing dist/entry.(m)js (build output).
This install looks like an unbuilt source tree or GitHub source archive.
Build locally with ˋpnpm install && pnpm buildˋ, or install a built package instead.
For pinned GitHub installs, use ˋnpm install -g github:openclaw/openclaw#‹ref›ˋ instead of a raw ˋ/archive/‹ref›.tar.gzˋ URL.
For releases, use ˋnpm install -g openclaw@latestˋ.
    at file:///tmp/clawsweeper-live-proof-127679-GQAkYO/target/openclaw.mjs:781:13

Node.js v24.19.0
runner@runnervm76f27:/tmp/clawsweeper-live-proof-127679-GQAkYO/target$























Assertions:

  • FAIL expect_output: "ok": false
  • FAIL expect_output: Usage: openclaw plugins search ‹query›

How this fits together

Plugin search accepts a CLI query, calls ClawHub package search, and renders results for people or scripts. JSON-mode failures should leave the command owner and reach the root CLI renderer, which writes the canonical machine-readable error envelope.

flowchart LR
  A[Plugin search command] --> B[Validate query]
  B --> C[Search ClawHub packages]
  C --> D{JSON output requested?}
  D -->|success| E[Write search results]
  D -->|failure| F[Root CLI failure renderer]
  F --> G[JSON stdout and human stderr]
Loading

Before merge

  • Resolve merge risk (P1) - The PR body reports that its built-process regressions did not produce local runtime artifacts; exact-head CI should confirm the real CLI output before merge.
  • Complete next step (P2) - This maintainer-labeled PR needs exact-head CI and built-CLI confirmation, not an automated replacement repair.
Agent review details

Security

None.

PR surface

Source +4, Tests +88. Total +92 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 2 +4
Tests 2 88 0 +88
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 94 2 +92

Review metrics

Metric Value Why it matters
Production versus test delta production +6/-2 (net +4); tests +88/-0 The small production increase is the typed-error handoff to the existing root renderer; the added tests cover owner propagation and built-process output.

Stored data model

Persistent data-model change detected: serialized state: test/cli-json-stdout.e2e.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep plugin search as a thin owner that delegates JSON failure rendering to the root CLI contract, then land after the built CLI regressions pass on the PR head.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep plugin search as a thin owner that delegates JSON failure rendering to the root CLI contract, then land after the built CLI regressions pass on the PR head.

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

Yes, source-reproducible: current main locally exits on a missing query and locally consumes ClawHub errors before src/index.ts can emit its JSON envelope. No runtime command was executed in this read-only review.

Is this the best way to solve the issue?

Yes. Reusing the root failure renderer is the narrow canonical fix; adding a plugin-search-specific JSON envelope would duplicate formatting and drift from the established CLI contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs a bounded CLI automation contract: JSON-mode failures currently leave scripts without parseable stdout.
  • 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 is maintainer-authored work, so the external-contributor proof gate does not apply; the remaining evidence gap is exact-head built-CLI validation.

Label justifications:

  • P2: This repairs a bounded CLI automation contract: JSON-mode failures currently leave scripts without parseable stdout.
  • 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 is maintainer-authored work, so the external-contributor proof gate does not apply; the remaining evidence gap is exact-head built-CLI validation.

Evidence

What I checked:

  • Current-main failure boundary: Current main prints and exits locally for a missing query, and catches every search error locally, so neither path reaches the root JSON renderer. (src/cli/plugins-search-command.ts:36, fb95562e9614)
  • Canonical renderer already owns JSON failures: The root entrypoint writes formatCliJsonFailure to stdout when JSON mode is active, then emits human diagnostics to stderr. (src/index.ts:147, fb95562e9614)
  • Patch follows the existing owner boundary: The branch uses ExpectedCliError for missing input and rethrows only JSON-mode search failures; human-mode search errors retain local diagnostics. (src/cli/plugins-search-command.ts:37, 9c888bd14e78)
  • Caller, callee, and sibling contract: The CLI registration awaits plugin search; catalog search awaits both ClawHub family requests; the shared failure formatter defines the typed JSON envelope and corresponding human output. (src/plugins/catalog-search.ts:42, 9c888bd14e78)
  • Regression coverage targets the real contract: New unit cases prove propagation rather than local exit, and built-CLI cases assert exit 1, one ANSI-free JSON document, stderr guidance, and TTY finalization. (test/cli-json-stdout.e2e.test.ts:477, 9c888bd14e78)
  • Feature-history provenance: The shared JSON failure contract was introduced by a recent CLI fix, supporting reuse of that renderer rather than a plugin-search-specific envelope. (src/cli/failure-output.ts:85, 6c66f48a7c11)

Likely related people:

  • steipete: Authored the recent canonical JSON-failure and expected-transport-error work, as well as this focused repair. (role: shared CLI failure-contract author and recent area contributor; confidence: high; commits: 6c66f48a7c11, 01eec285d986, 9c888bd14e78; files: src/cli/failure-output.ts, src/cli/plugins-search-command.ts)
  • Dallin Romney: Recently maintained the release-validation harness that the built-CLI JSON contract test uses. (role: recent E2E harness contributor; confidence: medium; commits: 902eb1f282e8; files: test/cli-json-stdout.e2e.test.ts)

Rank-up moves

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

  • Confirm the built-process JSON stdout regressions on the exact PR head.

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

Land-ready review complete.

plugins search --json now delegates missing-query and ClawHub failures to the canonical root failure renderer instead of consuming them before machine output and finalization. Human-mode ClawHub errors, successful JSON/terminal output, empty results, and limit validation remain unchanged. Production delta is +6/-2 (net +4); tests are +88/-0.

Proof:

  • Pre-fix owner regressions failed because both JSON cases called the mocked runtime.exit(1) instead of propagating the intended errors.
  • Post-fix plugin-search owner suite — 5/5 passed.
  • Exact-head CI run 32536187409 on 9c888bd14e78af5370971e5183d07f6928333435 — green, including missing-query, deterministic ClawHub-failure, canonical JSON, ANSI-free stdout, and dual-TTY finalization regressions.
  • Fresh final-branch structured autoreview — no accepted P0/P1 findings.
  • Latest ClawSweeper review — no correctness or security findings; its only rank-up move was exact-head built-process confirmation, now satisfied.
  • Native review-init, review-artifacts-init, and review-validate-artifacts — passed with READY FOR /prepare-pr.

Known local proof note: the local build runner was repeatedly terminated under concurrent host pressure before producing E2E artifacts; exact-head hosted CI supplies the clean workspace and built-process proof.

@steipete
steipete merged commit 7469b54 into main Aug 21, 2026
304 checks passed
@steipete
steipete deleted the codex/autoqa29-plugins-search-json branch August 21, 2026 23:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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