Skip to content

fix(cli): show system event remedies alongside JSON - #199670

Merged
obviyus merged 2 commits into
openclaw:mainfrom
Leon-SK668:leon/fix-system-event-remedies-20261115
Nov 15, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
Leon-SK668:leon/fix-system-event-remedies-20261115

Conversation

@Leon-SK668

@Leon-SK668 Leon-SK668 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

openclaw system event --text hello --mode later --json exits1 and writes the correct JSON failure, but stderr is empty. Operators watching stderr while stdout is captured miss the existing corrective message. A whitespace-only --text has the same problem.

Why This Change Was Made

Classify both existing local argument refusals with throwExpectedCliError. The System wrapper already rethrows classified errors, and the root failure renderer already owns their JSON and human diagnostics. Reuse those owners instead of adding another renderer or changing broad error handling.

This follows the accepted Directory diagnostic repair in #199616 while preserving the structured-stdout repair in #123614. Existing-solutions preflight: the existing classifier and root renderer cover the requirement; no new library, plugin or custom output system.

User Impact

JSON callers retain the same parsed failure envelopes/messages and exit1 while stderr also explains how to correct the arguments. Human refusals remain readable with empty stdout. Validation order, accepted modes, defaults, session-key normalization, RPC payloads, Gateway rejection/transport handling, heartbeat and presence are unchanged.

Two files: production +3/-2 (net1 import), tests +14/-9 (net5). The test replaces the old invalid-mode case with one compact table covering both local guards. No config/default, protocol/schema, dependency, persistence, auth or permission change. The deliberate visible change is actionable stderr for these two existing JSON-mode refusals.

Evidence

  • Frozen built-CLI driver on Linux/Node24.22.1: RED 48b92409887ac4e7b8c67883918a3fee2d9250c9 at 2026-11-15T15:48:19.293Z; GREEN 99379fa9a644f765c48d07df4cae79332dafbc91 at 2026-11-15T16:07:23.107Z. The final build commit equals the contributor head.
  • Both native JSON refusals have stderr remedies0/2 before and2/2 after; parsed JSON failures/messages and exit1 match. Two human-mode refusals and one successful help invocation remain controls. The isolated config is independently read back unchanged after all five commands.
  • Reused baseline48b's System owner, classifier, renderer, output mode, CLI entry/facade and normalization blobs match branch base d3f4f94fbb46e216c9a88555469127518532b4b9. Fresh live main/owner/contract comparison also matched before commit.
  • OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/cli/system-cli.test.ts src/cli/failure-output.test.ts --maxWorkers=1 --reporter=dot: 27 passed, exit0;147.45s Vitest/159.13s wrapper. Existing Gateway rejection, agent-selection, valid event dispatch and cancellation consumers remain covered.
  • Targeted tsgo, typed oxlint, oxfmt and git diff --check pass. The external two-file type probe extends the repository test tsconfig and includes ambient declarations; no test/type baseline changed.
  • Exact-head node --import ./scripts/tsx.mjs scripts/build-all.mts sourcePerformance: PASS,236.4s. This is native runtime validation, not full release/package validation.

Not tested: successful native Gateway RPC/wake, heartbeat changes, session/channel delivery, live agent/provider behavior, Windows/macOS, full repository suite, full release packaging or upstream CI. Native proof covers the changed local refusal paths; it does not claim that a Gateway accepted an event.

Exact-head proof receipt
status: PASS
product_sha: 99379fa9a644f765c48d07df4cae79332dafbc91
base_sha: 48b92409887ac4e7b8c67883918a3fee2d9250c9
claims: C1=system-event local argument refusals retain their existing remedy on stderr alongside JSON; C2=parsed JSON failures, exit1, human refusals and config bytes remain intact
covered_by: C1=two same-input native JSON refusals before/after; C2=independently parsed stdout, exit status, two native human controls, successful help, byte readback and27 focused tests
entry: built openclaw system event --text probe --mode later --json; system event --text '   ' --json
owner: system-event local text/mode guards -> existing expected-error classifier -> existing shared System wrapper -> canonical root failure renderer
boundary: subprocess,config-file
readback: captured stdout parsed independently as cli_error JSON; stderr remedy presence checked; exit status and isolated config bytes read back for every command
proof_command: node community-system-native-proof-20261115.mjs CHECKOUT red|green; same five inputs and driver on both revisions
harness: frozen driver SHA256 6f3b7165ce803e4ec83b8ffa34b57ebe156aa9ece8608e55e55714eea5131cfa; complete driver and sanitized native records in PR body; product build commit equals product_sha
before: RED 48b92409887ac4e7b8c67883918a3fee2d9250c9 at 2026-11-15T15:48:19.293Z; JSON remedies visible on stderr0/2, valid failure JSON and exit1 retained2/2
after: GREEN 99379fa9a644f765c48d07df4cae79332dafbc91 at 2026-11-15T16:07:23.107Z; JSON remedies visible on stderr2/2, same parsed failure envelopes/messages and exit1 retained2/2
negative_claim: yes
control: two native human refusals keep empty stdout and useful stderr with exit1; help succeeds1/1; isolated config bytes unchanged5/5
consumers: existing Gateway rejection, agent-selection propagation, valid event dispatch and interrupted presence tests retained; heartbeat/presence, session selectors and RPC payloads unchanged
tests: OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/cli/system-cli.test.ts src/cli/failure-output.test.ts --maxWorkers=1 --reporter=dot:27passed,exit0; targeted tsgo,typed oxlint,oxfmt,diff pass; exact-head sourcePerformance build pass
tests_changed: yes
test_cost: two explicit test files27tests147.45s Vitest/159.13s wrapper; replace old invalid-mode case with compact two-case table, net5 test lines; native build236.4s
visual: no
screenshots: N/A: CLI output contract, no GUI claim
published: pr-body
not_tested: successful native Gateway RPC/wake, heartbeat changes, session/channel delivery, live agent/provider behavior, cross-OS, full repository suite, full release packaging and upstream CI
reuse: baseline48b owner, output-mode, classifier, renderer, CLI entry/facade and normalization blobs identical to branch base d3f4f94fbb46e216c9a88555469127518532b4b9; live current-main owner/contract check before commit also matched
Captured native before/after readback

The driver captures real built-CLI subprocess output and replaces only its temporary state/checkout prefixes.

{
  "before": {
    "status": "PASS",
    "phase": "red",
    "head": "48b92409887ac4e7b8c67883918a3fee2d9250c9",
    "buildCommit": "48b92409887ac4e7b8c67883918a3fee2d9250c9",
    "node": "v24.22.1",
    "capturedAt": "2026-11-15T15:48:19.293Z",
    "driverSha256": "6f3b7165ce803e4ec83b8ffa34b57ebe156aa9ece8608e55e55714eea5131cfa",
    "observations": [
      {
        "args": [
          "system",
          "event",
          "--text",
          "probe",
          "--mode",
          "later",
          "--json"
        ],
        "exit": 1,
        "stdout": "{\n  \"ok\": false,\n  \"error\": {\n    \"type\": \"cli_error\",\n    \"message\": \"--mode must be now or next-heartbeat\"\n  }\n}\n",
        "stderr": "",
        "hasActionableStderr": false
      },
      {
        "args": [
          "system",
          "event",
          "--text",
          "probe",
          "--mode",
          "later"
        ],
        "exit": 1,
        "stdout": "",
        "stderr": "--mode must be now or next-heartbeat\n"
      },
      {
        "args": [
          "system",
          "event",
          "--text",
          "   ",
          "--json"
        ],
        "exit": 1,
        "stdout": "{\n  \"ok\": false,\n  \"error\": {\n    \"type\": \"cli_error\",\n    \"message\": \"--text is required. Example: openclaw system event --text \\\"deploy finished\\\".\"\n  }\n}\n",
        "stderr": "",
        "hasActionableStderr": false
      },
      {
        "args": [
          "system",
          "event",
          "--text",
          "   "
        ],
        "exit": 1,
        "stdout": "",
        "stderr": "--text is required. Example: openclaw system event --text \"deploy finished\".\n"
      },
      {
        "args": [
          "system",
          "event",
          "--help"
        ],
        "exit": 0,
        "stdout": "\nOpenClaw 2026.11.3 (48b9240) — All your chats, one OpenClaw.\n\nUsage: openclaw system event [options]\n\nEnqueue a system event and optionally trigger a heartbeat\n\nOptions:\n  --expect-final              Wait for final response (agent) (default: false)\n  -h, --help                  Display help for command\n  --json                      Output JSON (default: false)\n  --mode <mode>               Wake mode (now|next-heartbeat) (default:\n                              \"next-heartbeat\")\n  --password <password>       Gateway password (if required)\n  --port <port>               Local Gateway port\n  --session-key <sessionKey>  Target a specific session for the event (defaults\n                              to the agent's main session)\n  --text <text>               System event text\n  --timeout <ms>              Timeout in ms (default: \"30000\")\n  --token <token>             Gateway token (if required)\n  --url <url>                 Gateway WebSocket URL (defaults to\n                              gateway.remote.url when configured)\n",
        "stderr": ""
      }
    ],
    "configUnchangedByCommands": true,
    "limitations": "Isolated Linux built-CLI local argument refusals and help only. No successful wake, Gateway RPC, heartbeat change, session delivery, live agent or cross-OS behavior is claimed."
  },
  "after": {
    "status": "PASS",
    "phase": "green",
    "head": "99379fa9a644f765c48d07df4cae79332dafbc91",
    "buildCommit": "99379fa9a644f765c48d07df4cae79332dafbc91",
    "node": "v24.22.1",
    "capturedAt": "2026-11-15T16:07:23.107Z",
    "driverSha256": "6f3b7165ce803e4ec83b8ffa34b57ebe156aa9ece8608e55e55714eea5131cfa",
    "observations": [
      {
        "args": [
          "system",
          "event",
          "--text",
          "probe",
          "--mode",
          "later",
          "--json"
        ],
        "exit": 1,
        "stdout": "{\n  \"ok\": false,\n  \"error\": {\n    \"type\": \"cli_error\",\n    \"message\": \"--mode must be now or next-heartbeat\"\n  }\n}\n",
        "stderr": "--mode must be now or next-heartbeat\n",
        "hasActionableStderr": true
      },
      {
        "args": [
          "system",
          "event",
          "--text",
          "probe",
          "--mode",
          "later"
        ],
        "exit": 1,
        "stdout": "",
        "stderr": "--mode must be now or next-heartbeat\n"
      },
      {
        "args": [
          "system",
          "event",
          "--text",
          "   ",
          "--json"
        ],
        "exit": 1,
        "stdout": "{\n  \"ok\": false,\n  \"error\": {\n    \"type\": \"cli_error\",\n    \"message\": \"--text is required. Example: openclaw system event --text \\\"deploy finished\\\".\"\n  }\n}\n",
        "stderr": "--text is required. Example: openclaw system event --text \"deploy finished\".\n",
        "hasActionableStderr": true
      },
      {
        "args": [
          "system",
          "event",
          "--text",
          "   "
        ],
        "exit": 1,
        "stdout": "",
        "stderr": "--text is required. Example: openclaw system event --text \"deploy finished\".\n"
      },
      {
        "args": [
          "system",
          "event",
          "--help"
        ],
        "exit": 0,
        "stdout": "\nOpenClaw 2026.11.3 (99379fa) — All your chats, one OpenClaw.\n\nUsage: openclaw system event [options]\n\nEnqueue a system event and optionally trigger a heartbeat\n\nOptions:\n  --expect-final              Wait for final response (agent) (default: false)\n  -h, --help                  Display help for command\n  --json                      Output JSON (default: false)\n  --mode <mode>               Wake mode (now|next-heartbeat) (default:\n                              \"next-heartbeat\")\n  --password <password>       Gateway password (if required)\n  --port <port>               Local Gateway port\n  --session-key <sessionKey>  Target a specific session for the event (defaults\n                              to the agent's main session)\n  --text <text>               System event text\n  --timeout <ms>              Timeout in ms (default: \"30000\")\n  --token <token>             Gateway token (if required)\n  --url <url>                 Gateway WebSocket URL (defaults to\n                              gateway.remote.url when configured)\n",
        "stderr": ""
      }
    ],
    "configUnchangedByCommands": true,
    "limitations": "Isolated Linux built-CLI local argument refusals and help only. No successful wake, Gateway RPC, heartbeat change, session delivery, live agent or cross-OS behavior is claimed."
  }
}
Complete frozen native CLI driver

Save as community-system-native-proof-20261115.mjs; invoke with an already-built checkout and red or green. It verifies the build-info commit against that checkout's HEAD and creates isolated state. The phase changes only the expected observed stderr outcome.

import assert from "node:assert/strict";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { createHash } from "node:crypto";
import { execFileSync, spawnSync } from "node:child_process";
import { fileURLToPath } from "node:url";

const [repoArg, phase] = process.argv.slice(2);
assert.ok(["red", "green"].includes(phase));
const repo = path.resolve(repoArg);
const head = execFileSync("git", ["rev-parse", "HEAD"], { cwd: repo, encoding: "utf8" }).trim();
const build = JSON.parse(fs.readFileSync(path.join(repo, "dist/build-info.json"), "utf8"));
assert.equal(build.commit, head);
const root = fs.mkdtempSync(path.join(os.tmpdir(), "leon-system-remedies-"));
fs.chmodSync(root, 0o700);
const configPath = path.join(root, "openclaw.json");
const configBytes = JSON.stringify({ meta: { migrations: { skillWorkshopPlugin: true } },
  gateway: { mode: "local" }, plugins: { allow: [], slots: { memory: "none" } },
  logging: { consoleLevel: "error", file: path.join(root, "proof.log") } });
fs.writeFileSync(configPath, configBytes, { mode: 0o600 });
const env = { PATH: process.env.PATH, LANG: "C.UTF-8", NO_COLOR: "1", OPENCLAW_HOME: root,
  OPENCLAW_STATE_DIR: path.join(root, "state"), OPENCLAW_CONFIG_PATH: configPath,
  OPENCLAW_NO_RESPAWN: "1", OPENCLAW_SKIP_STARTUP_MODEL_PREWARM: "1",
  XDG_CONFIG_HOME: path.join(root, "xdg-config"), XDG_CACHE_HOME: path.join(root, "xdg-cache") };
const observations = [];
function cli(args) {
  const result = spawnSync(process.execPath, [path.join(repo, "openclaw.mjs"), ...args],
    { cwd: repo, env, encoding: "utf8", timeout: 90000 });
  assert.equal(result.error, undefined); assert.equal(result.signal, null);
  const clean = value => value.replaceAll(root, "<isolated-state>").replaceAll(repo, "<checkout>");
  const record = { args, exit: result.status, stdout: clean(result.stdout), stderr: clean(result.stderr) };
  observations.push(record);
  assert.equal(fs.readFileSync(configPath, "utf8"), configBytes);
  return record;
}
const cases = [
  { args: ["--text", "probe", "--mode", "later"], reason: "--mode must be now or next-heartbeat" },
  { args: ["--text", "   "], reason: "--text is required." },
];
for (const item of cases) {
  const result = cli(["system", "event", ...item.args, "--json"]);
  assert.equal(result.exit, 1);
  const json = JSON.parse(result.stdout);
  assert.equal(json.ok, false); assert.equal(json.error.type, "cli_error");
  assert.ok(json.error.message.includes(item.reason), JSON.stringify(result));
  result.hasActionableStderr = result.stderr.includes(item.reason);
  assert.equal(result.hasActionableStderr, phase === "green", JSON.stringify(result));
  const human = cli(["system", "event", ...item.args]);
  assert.equal(human.exit, 1); assert.equal(human.stdout, "");
  assert.ok(human.stderr.includes(item.reason), JSON.stringify(human));
}
const help = cli(["system", "event", "--help"]);
assert.equal(help.exit, 0); assert.ok(help.stdout.includes("--text <text>"));
assert.ok(help.stdout.includes("now|next-heartbeat"));
console.log(JSON.stringify({ status: "PASS", phase, head, buildCommit: build.commit, node: process.version,
  capturedAt: new Date().toISOString(), driverSha256: createHash("sha256").update(fs.readFileSync(fileURLToPath(import.meta.url))).digest("hex"),
  observations, configUnchangedByCommands: true,
  limitations: "Isolated Linux built-CLI local argument refusals and help only. No successful wake, Gateway RPC, heartbeat change, session delivery, live agent or cross-OS behavior is claimed." }, null, 2));

Agent assistance

AI-assisted implementation and author audit. The requester waived independent review; the author audit is not represented as independent review. The complete behavior driver and captured output are included above. Raw agent-session logs are omitted because they contain unrelated private context.

Maintainer validation

Validated bee653f71754b7d97ca9c24bf8077b40ea0e2f39: real CLI stderr restoration, byte-identical JSON/text controls, zero Gateway connections, regression, typecheck and full packed-install receipts. Both validation boundaries remain covered and the test delta is now net zero; the contributor production fix is unchanged.

Merge danger: reversible code/test change. Blast radius: stderr presentation of the two local system-event validation failures.

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS labels Nov 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Nov 15, 2026
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR routes two system-event argument errors through the existing CLI failure renderer so JSON callers also receive stderr guidance.

Example: Run openclaw system event --text hello --mode later --json.

  • Before: Exit 1 with a JSON failure on stdout and empty stderr.
  • After: The same JSON failure and exit 1, plus --mode must be now or next-heartbeat on stderr.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A minimal repair with direct CLI before/after evidence, final-head validation, meaningful red/green regressions, and no actionable findings; hosted CI remains unfinished.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Built-CLI captures exercise both local refusals on Linux/Node, and final-head CLI validation on the pinned Bun runtime confirms restored stderr, identical stdout and human controls, exit 1, and zero Gateway connections.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators capturing JSON stdout receive no stderr explanation when system-event text is blank or its mode is invalid.
Reason: The narrow diagnostic repair preserves machine output and has explicit final-head collaborator validation, consistent with the accepted Directory repair.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: current main still suppresses these stderr remedies, and this focused, validated repair introduces no actionable findings.

Priority: P2
Reviewed head: bee653f71754b7d97ca9c24bf8077b40ea0e2f39

Before merge

None.

Findings

None.

Agent review details

How this fits together

The system CLI validates event arguments before Gateway RPC; expected errors pass through its wrapper to the root renderer, which produces JSON stdout and human stderr.

flowchart TD
  A[System event command] --> B[Local argument validation]
  B --> C[Expected CLI error]
  C --> D[Root failure renderer]
  D --> E[JSON stdout]
  D --> F[Remedy on stderr]
  B --> G[Valid event Gateway RPC]
Loading

Technical review

Best possible solution:

Use the existing expected-error classifier at both local guards and retain the shared root renderer as the sole failure-output owner.

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

Current-main source explains the empty stderr for invalid mode and whitespace-only text, and supplied real CLI before/after captures demonstrate both failures; no target code was executed during this review.

Is this the best way to solve the issue?

The patch is the smallest complete repair: classify the two producer-owned argument errors and reuse the existing wrapper handoff and root output contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8b94cfb556c3.

Provenance checked

  • System local argument diagnostics keeps the original intent (e45b9d7: Clarify required options with an actionable example; the PR retains that diagnostic and the existing accepted-mode check.)
  • Machine-mode System failure routing changes intended behavior with a stated reason (f72001f: Provide structured stdout failures for JSON callers; the prior repair also left stderr empty, which this PR explicitly changes while preserving JSON and exit status.)
  • Expected-error handoff and retained regression coverage keeps the original intent (7a507d8: Route expected credential conditions consistently through the root renderer; this PR uses the same handoff and preserves distinct rejection, dispatch, agent-selection, and cancellation cases.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +1, Tests 0. Total +1 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 2 +1
Tests 1 10 10 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 13 12 +1

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This repairs missing operator guidance for two invalid CLI inputs while existing JSON failures and exit codes already work.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-15T16:28:07.187Z sha 99379fa :: needs maintainer review before merge. :: none

Reviewed November 15, 2026, 12:43 PM ET / 17:43 UTC (Revision 2).

@obviyus

obviyus commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Validated final head bee653f71754b7d97ca9c24bf8077b40ea0e2f39 against main baseline d3f4f94fbb46. Leon-SK668's production fix is preserved; the added test cleanup keeps both distinct cases and all checks while bringing test growth to net zero.

Observed user-path result

Tier: source, host through ocx src on the pinned Bun fork. Each side used an isolated HOME/state/config and the same profile name (p199670proof) so the example command in the existing message remained comparable. Banner suppression and no-color mode removed unrelated presentation noise.

Commands exercised once on each side:

system event --text hello --mode later --json
system event --text '   ' --json

Both were also run without --json as controls.

Case Main JSON stderr Candidate JSON stderr
Invalid mode empty --mode must be now or next-heartbeat
Whitespace-only text empty --text is required. Example: openclaw --profile p199670proof system event --text "deploy finished".

All eight executions exited 1. Both text-mode diagnostics and stdout were byte-identical across sides. Both JSON stdout envelopes were also byte-identical; only the missing stderr diagnostic was restored.

Selected JSON stdout, unchanged:

{
  "ok": false,
  "error": {
    "type": "cli_error",
    "message": "--mode must be now or next-heartbeat"
  }
}

Identical stdout SHA-256 on main and candidate:

  • Invalid mode JSON: 3b148aec93d6bdfffc574c7e59098b2024ce49068f944f01e05873ba26972989.
  • Blank text JSON: 8172be5500989a3a0b723580af44505b3e3e0605d68906b1c9ffab246c8143bf.
  • Both text-mode stdout streams were empty.

No Gateway connection

No Gateway was started. The isolated config and explicit --url pointed to passive loopback connection counters (127.0.0.1:62251 on main; 127.0.0.1:63233 on candidate). The counters accepted zero connections, both per command and across each complete matrix. They supplied no API response and held no request. The regression also asserts that callGatewayFromCli is never invoked for either invalid input.

Focused checks and simplification

  • vitest-source, host: candidate 6 passed; the identical regression file on main produced 2 failed / 4 passed, specifically the two expected-error handoffs. Candidate check sequence took 114.23 s including install/typecheck/format; baseline test command took 12.43 s.
  • Matching test typecheck passed: test/tsconfig/tsconfig.core.test.config-cli.json through the ocx heavy gate.
  • Targeted Oxfmt check passed for both touched files.
  • The two validation rows now use the existing tuple-table convention, and a paired empty-capture assertion retains both stdout/stderr checks. No case or assertion coverage was removed. Whole-PR test delta is +10/-10, net 0, with no allocation file; production is +3/-2.
  • No validation rule, Gateway call, exit code, JSON envelope, RPC behavior, runtime message text or public API was added. Only the existing local messages are handed to the existing root failure owner.

Merge danger: reversible code/test change. Blast radius: stderr presentation of the two local system-event validation failures.

Full package and host eligibility

  • full, host: ocx build --dts passed (785 seconds), including all 163 public Plugin SDK declaration subpaths. The supported core source-package builder checked the tarball; a fresh isolated npm install then passed the installed CLI --version and system event --help smoke at bee653f.
  • Host-ocx eligibility passed on the final head: only src/cli/system-cli.ts and its test changed. No package, lockfile, workspace, install, script or hook inputs changed.
  • Worktrunk creation and commit/push hooks were disabled. The normal ocx dependency-install lifecycle did run scripts/prepare-git-hooks.mjs; no hook approval or dependency update was performed.

Hosted gates on the final head

  • CI run 43742081103, attempt 2: success, 0 cancelled CI jobs.
  • openclaw/ci-gate: success — “CI and applicable security review requirements passed.” Security-sensitive review also passed: “No sensitive product changes.”
  • ClawSweeper review: exact head bee653f71754b7d97ca9c24bf8077b40ea0e2f39, ready, 5/5/5, no actionable findings.

@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Nov 15, 2026
@obviyus
obviyus merged commit b2b3b42 into openclaw:main Nov 15, 2026
118 checks passed
@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Landed in b2b3b42. Thanks @Leon-SK668.

github-actions Bot pushed a commit to superAlex0071379/openclaw that referenced this pull request Nov 15, 2026
fix(cli): report system event argument errors through the expected-error path

`openclaw system event --json` with an invalid `--mode` or a whitespace-only `--text` exited 1 with the JSON failure on stdout but left stderr without the existing message ("--mode must be now or next-heartbeat" / "--text is required. ..."). Both checks run before any Gateway call and now use the expected-error path with the same messages. No new text.

Evidence: host, isolated state, no Gateway. Source CLI: `system event --text hello --mode later` and `system event --text '   '`, with --json and in text mode: base leaves stderr without the message, this change prints the existing message; JSON stdout, text output and exit 1 are byte-identical, and neither side opened a Gateway connection. Vitest-source: two cases fail on base, 6 pass here; typecheck, full build and packed-install smoke pass. Receipts: openclaw/openclaw#199670 (comment).

Thanks @Leon-SK668.

Co-authored-by: Ayaan Zaidi <[email protected]>
@Leon-SK668

Copy link
Copy Markdown
Contributor Author

Thanks @obviyus for tightening the tests and checking both output modes before landing this.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 16, 2026
fix(cli): report system event argument errors through the expected-error path

`openclaw system event --json` with an invalid `--mode` or a whitespace-only `--text` exited 1 with the JSON failure on stdout but left stderr without the existing message ("--mode must be now or next-heartbeat" / "--text is required. ..."). Both checks run before any Gateway call and now use the expected-error path with the same messages. No new text.

Evidence: host, isolated state, no Gateway. Source CLI: `system event --text hello --mode later` and `system event --text '   '`, with --json and in text mode: base leaves stderr without the message, this change prints the existing message; JSON stdout, text output and exit 1 are byte-identical, and neither side opened a Gateway connection. Vitest-source: two cases fail on base, 6 pass here; typecheck, full build and packed-install smoke pass. Receipts: openclaw#199670 (comment).

Thanks @Leon-SK668.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

2 participants