Repository navigation
feat(cli): support --json across reporting commands - #117928
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 5:49 AM ET / 09:49 UTC. ClawSweeper reviewWhat this changesAdds explicit Merge readiness⛔ Blocked until stronger real behavior proof is added - 7 items remain Keep this PR open. The latest head still accepts root-level Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s CLI parses a command hierarchy and routes each command to a reporting or mutation handler, which writes either human-oriented output or a machine-readable JSON document. The security audit collects gateway probe results and renders them into operator-facing audit reports. flowchart LR
Operator[CLI operator or script] --> Parser[Command hierarchy]
Parser --> Report[Reporting command]
Parser --> Mutation[Mutation command]
Report --> Output[JSON or human stdout]
Mutation --> Result[Action result]
Gateway[Gateway probe] --> Audit[Security audit]
Audit --> Redaction[Redacted audit output]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +181, Tests +713, Docs +50. Total +944 across 40 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep bare Do we have a high-confidence way to reproduce the issue? Yes, from source: place the new root option before a non-reporting child, such as Is this the best way to solve the issue? No. The documented aliases are for default reports, so their scope should be enforced at the command boundary rather than inherited into unrelated child actions. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b7bbb4f98a1f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
|
Merged via squash.
|
|
Post-land review note: I read the latest ClawSweeper review and its |
* origin/main: (59 commits) fix(agents): reject false success from delegated file mutations (openclaw#117938) fix(macos): reopen AI choice, fix daemon error text, hand onboarding off to the dashboard custodian (openclaw#117921) fix(qa): tolerate expected Matrix sync long-poll deadlines (openclaw#117807) feat(cli): support --json across reporting commands (openclaw#117928) perf(cli): keep read-only commands on cold paths (openclaw#117932) fix: prevent fractional chunk limits from stalling text splitting (openclaw#117727) fix(qqbot): add heartbeat-ACK liveness watchdog (openclaw#114902) chore(openai): defer release note to release flow fix(pr): join worktree discovery subprocesses test(gateway): widen aggregate event-loop budget (openclaw#117931) fix: refresh Buzz room targets after reconnect (openclaw#117927) fix: invalidate removed Buzz mention members fix: align Buzz explicit mention semantics test: split Buzz mention delivery coverage fix: preserve Buzz reply session threads refactor: keep Buzz mention helpers internal fix: invalidate stale Buzz room targets fix: tighten Buzz mention disambiguation perf: keep Buzz plain sends on the fast path fix: reject unresolved Buzz mention text ...
* feat(cli): support --json across reporting commands * test(cli): satisfy json command checks * test(cli): type json exception map
What Problem This Solves
--jsonwas an inconsistent flag. Most reporting commands supported it, but a live sweep against a production host found commands that rejected it outright — so scripting the CLI meant memorising which commands happened to have it. The sharpest example:openclaw automations runs --id <job>already prints a JSON document to stdout, yet rejected--jsonwith "does not recognize option". That broke a real automation during testing and forced a fallback togateway call cron.runs.Maintainer request: "basically every command should support
--json".Why This Change Was Made
The whole registered tree was audited — 443 canonical paths — rather than only the commands that happened to appear in the sweep. Each path was classified: add, already supported, or genuinely not applicable. Only 14 paths were genuinely missing support (the production dist predated several existing implementations).
Added:
config file,config schema, baremodels, baredocs,cron get,cron runs,proxy coverage/sessions/query, barehooks,plugins doctor,plugins validate, bareskills,skills verify.Deliberately not applicable, with reasons: interactive wizards (
configure,onboardmutations,update wizard), long-running servers and protocol surfaces (gateway run,daemon,mcp serve,worker,attach,acp,webhooks gmail run), interactive TUI (tui,terminal,chat), destructive mutations (reset,uninstall,sandbox recreate), raw-byte output (proxy blob), streaming contracts preserved as-is (logsJSONL,sessions tail,fleet logs), grouping namespaces, andcompletion(stdout must stay executable shell source).All new paths use the existing
writeRuntimeJson/runtime.writeJsonconvention — no second serialization idiom. JSON mode suppresses progress/decoration and routes incidental logs to stderr, so stdout is a single parseable document. Exit-code semantics are unchanged, and existing JSON shapes were not altered (they are a public contract); parent and child JSON options are merged so new bare aliases do not breakmodels status --jsonorskills list --json.A registered-tree guard test now enumerates the command surface and requires every command to be either JSON-supported or on an explicit, documented not-applicable allowlist — so a new command must make a deliberate choice rather than drifting.
Security fix found during the audit
security audit --deepembedded the gateway probe URL, error string, and websocket close reason verbatim. A gateway URL carrying userinfo credentials (or a secret in a query parameter) could therefore land in the audit report — in both human and JSON output. Redaction now happens at the producer via the canonicalredactSensitiveUrlLikeString, with userinfo and query-secret regression sentinels. Other sensitive surfaces were verified rather than assumed:exec-policystill stripsallowedDecisions;secretskeeps SecretRef/plan shapes without resolved values; pairing JSON exposes only the operator-actionable fields the human table already shows; device inventory returns token lifecycle summaries, not token material; plugin JSON sanitizes home-relative paths.Catalog discrepancies found (reported, not papered over)
gateway exportis a stale catalog entry — the real command isgateway diagnostics export.config models,tool, andtoolshave catalog entries but no registered built-in command (tool/toolsare intentionally reserved non-plugin roots).These were left for a separate change rather than manufacturing commands to match the catalog.
User Impact
Every reporting command a script would reasonably call now emits machine-readable output through one convention, and the guard test keeps it that way. Human output is unchanged when
--jsonis absent (verified by an anti-cheat probe:proxy sessionswithout the flag still returns its legacy bare array). Credentials can no longer leak into security audit reports.Evidence
pnpm tsgo:core,pnpm build(3m13s, CLI bootstrap import guard passed), formatting andgit diff --check: passed.gpt-5.6-sol, high): clean, "patch is correct" (0.99); trufflehog clean.+251/-70(net +181, mostly the explicit redacted plugin doctor/validate projections); tests net +713; docs net +50 across 12docs/clipages.Known gap: the two cron JSON paths were proven by focused gateway-harness tests rather than against a live production gateway.