Repository navigation
fix(cli): surface sandbox explain blank --agent remedy in --json failures - #199369
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes sandbox explain show the existing blank-agent remedy on stderr when JSON output is enabled. Example: Run openclaw sandbox explain --agent " " --json.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current CLI diagnostic bug with a minimal change and convincing before/after proof; no actionable defects were found, and current-head CI is still running. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe sandbox CLI forwards agent options to sandboxExplainCommand, whose validation errors pass through the command runtime to the root renderer for stderr diagnostics and JSON error output. flowchart TD
A[CLI arguments] --> B[Sandbox command registration]
B --> C[Agent argument validation]
C --> D[Expected CLI error]
D --> E[Root failure renderer]
E --> F[Stderr remedy]
E --> G[JSON error envelope]
Technical reviewBest possible solution: Use the existing expected-error helper at the blank-agent guard while preserving validation, message text, JSON output and exit status. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the plain-error rendering path, and obviyus supplied a matching base-versus-candidate CLI trace; this read-only review ran no target code. Is this the best way to solve the issue? The patch is the smallest complete fix: classify the known argument error at its producer and reuse the existing renderer, with the regression consolidated into the existing rejection table. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 99157f8f8c4e. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests 0. Total +1 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 14, 2026, 9:47 PM ET / November 15, 2026, 02:47 UTC (Revision 2). |
|
Verified the blank-agent fix through the actual CLI. No message text changes. Host isolation check: the merge-base diff contains only src/commands/sandbox-explain.ts and its existing test. No package, lockfile, workspace, npm config, patch, script or hook changes; all checks ran on the host through ocx, with isolated HOME/state/config and profile p199369. No host git hook ran. Source tier (ocx selected Node + tsx): base d3438ec and candidate use the same fixture and commands: The CLI registration passes the --agent and --json options unchanged into sandboxExplainCommand. runCommandWithRuntime rethrows JSON-mode failures; the root renderer distinguishes the existing ExpectedCliError. The changed line only classifies the existing message. Vitest-source: the full existing suite passed 20/20 on candidate; the same regression on base failed only the blank-agent case (19 passed). Compaction retains both unknown-agent and whitespace-agent rejection coverage without calling the command twice. Production +2/-1; tests +6/-6; no allocation file. Contributor commit retained. |
|
Exact-head proof: 54fe23b. Full tier on host through ocx: Final compacted regression: candidate 2 passed/18 skipped; base 1 failed/1 passed/18 skipped. The only failure was blank-agent Error versus ExpectedCliError. Earlier full-file run passed 20/20 on candidate. Formatting passed. Targeted lint did not complete: the wrapper waited for checkout ownership during packaging and timed out; no lint success claimed. No production code changed during compaction. Source +2/-1, tests +6/-6, no allocation. SunnyShu0925's original commit is retained; the additional commit only compacts the existing table and removes its duplicate command invocation. No git hook ran. Task-owned base, HOME/state/config directories and extracted packages were removed. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 6695768. Thanks @SunnyShu0925. |
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw/openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…ures (openclaw#199369) fix(cli): show the blank --agent error for sandbox explain --json `openclaw sandbox explain --agent " " --json` threw its blank-agent check as a plain error, so the JSON failure printed only "The CLI command failed." and the doctor hint instead of the existing "--agent must not be blank". It now throws the same message through the existing expected-CLI-error path, as `models` and the channel selectors do. Text mode, exit codes and valid-agent output are unchanged. No new text. Evidence: source tier with an isolated profile. With --json, base's stderr had only the generic failure and the doctor hint; this change prints the existing message, with JSON bytes and exit code unchanged. Text mode and a valid --agent give the same output on both. Vitest-source: the regression fails on base and passes here; full build and packed launcher pass. Net 0 test lines. Receipts: openclaw#199369 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
openclaw sandbox explain --agent " " --jsonprints a generic failure and Doctor hint on stderr instead of the existing--agent must not be blankremedy. The JSON envelope already contains the correct message.Solution
Use the existing
throwExpectedCliErrorhelper at the blank-agent guard. No message text changes. Unknown-agent rejection, text-mode output, JSON envelope bytes and exit codes remain unchanged.SunnyShu0925's original fix commit is retained. The additional test-only commit compacts the existing rejection table, checks the error name and message in one command invocation, and exercises whitespace input. Production +2/-1; tests +6/-6; no allocation file.
Evidence
Exact head:
54fe23bdab7374e2ed2c15320ccc3ec2fb9a1bff.The diff touches only the command and its existing test, so the host-ocx isolation check passed. No host git hook ran. No Gateway or sandbox backend is needed: the guard rejects before those paths.
Risk
Two-way door: reverting changes no stored state or public API. Blast radius is the stderr classification of explicitly blank
sandbox explain --agentinput; the original rejection and wording are preserved.