Repository navigation
fix(cli): nodes push test still expects silent JSON-mode failures - #200199
Merged
fuller-stack-dev merged 1 commit intoNov 16, 2026
Merged
fuller-stack-dev merged 1 commit into
fuller-stack-dev merged 1 commit into
Conversation
openclaw#199970 made commands that run through the shared wrapper report their diagnostic in --json mode as they do in text mode. The in-process nodes push case still asserted that JSON mode writes nothing to stderr and never exits, so it has failed on main since 25c9790 and fails the changed-files check of any PR whose lanes select it. The JSON case now requires the diagnostic exactly once, the exit, an empty stdout and no Gateway call, and that the error reaching the JSON failure owner still carries the original message. The runtime mock throws the same ExitError the real runtime throws, because that is the exit the wrapper converts for JSON output.
Contributor
|
🦞👀 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. |
Member
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 17, 2026
…enclaw#200199) openclaw#199970 made commands that run through the shared wrapper report their diagnostic in --json mode as they do in text mode. The in-process nodes push case still asserted that JSON mode writes nothing to stderr and never exits, so it has failed on main since 3411f31 and fails the changed-files check of any PR whose lanes select it. The JSON case now requires the diagnostic exactly once, the exit, an empty stdout and no Gateway call, and that the error reaching the JSON failure owner still carries the original message. The runtime mock throws the same ExitError the real runtime throws, because that is the exit the wrapper converts for JSON output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes:
src/cli/program.nodes-diagnostics-auth.e2e.test.ts› "rejects environment staging before lookup (JSON: true)" fails onmainevery run since 25c9790 (#199970). It failschecks-node-changedon any PR whose changed lanes select it, for example #200181 (job 133469711316), which does not touch the nodes CLI.User Impact
User impact: none for people running OpenClaw. Contributors stop getting this red check on unrelated PRs. No production file changes.
Why This Change Was Made
#199970 changed
runCommandWithRuntimeon purpose: in--jsonmode a plain command error now goes through the same diagnostic path as text mode, and the wrapper then throwsReportedCliCommandErrorso the JSON failure owner keeps the original envelope. Its PR text says the nodes subprocess assertions were updated to require the concrete diagnostic. This in-process case was not: it still asserted that JSON mode calls neitherruntime.errornorruntime.exit.With the new wrapper, the nodes error handler runs in JSON mode, prints
nodes push failed: …and callsruntime.exit(1). The shared test runtime'sexitthrows a plainError("exit"). The wrapper only converts theExitErrorthe realdefaultRuntime.exitthrows, so the plain error propagated and the case sawexitinstead of the environment message.The JSON case now:
ExitErrorfor that one call, asdefaultRuntime.exitdoes;invalid --environment (use sandbox|production), which is what the JSON failure owner formats;exit(1), in both modes;The text-mode case is unchanged apart from the exit assertion becoming exactly-once.
Evidence
Head 591cd62 on base 94e34f9. Command for every run:
node scripts/run-vitest.mjs src/cli/program.nodes-diagnostics-auth.e2e.test.ts.Red, unmodified main
Green, this change
src/cliorsrc/runtime.ts, so I did not repeat the three runs.runCommandWithRuntimerethrowing in JSON mode before reporting, as it did before fix(cli): retain command diagnostics in JSON failures #199970, the JSON case fails on the missing diagnostic.oxfmt --checkon the file andgit diff --check: clean.OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 node scripts/check-changed.mjs: exit 0, including the core test typecheck and lint for the changed file. The dead-export scan is skipped because it currently fails onmainfor files this PR does not touch.Audit of the touched test file
process.argv/process.exitCoderestore inafterEach.nodes statuscredentials case that expects noruntime.errorgoes through the expected-error path, which fix(cli): retain command diagnostics in JSON failures #199970 left unchanged, and still passes.mockImplementationOnceis consumed by the singleexitcall andvi.clearAllMocks()runs inbeforeEach, so nothing leaks into later cases.Not run
src/cli/cli-utils.tsandsrc/runtime.tson the head.