Repository navigation
fix(cli): report an invalid REA_LOG_LEVEL as configuration - #2140
Merged
Merged
Conversation
createCli parsed REA_LOG_LEVEL with a throwing schema, so an invalid or uppercase value crashed every command, including doctor and --help, with a ZodError stack trace. Parse it into a ConfigurationError result and have the executable print the same configuration message as the MCP adapter and exit 1 before building the CLI. Fixes #2135 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
3 tasks done
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.
Summary
createCliparsedREA_LOG_LEVELwith a throwing Zod schema. An invalid or differently cased value (loud,INFO) therefore crashed every CLI command, includingrea doctorandrea --help, with an uncaughtZodErrorstack trace. The MCP adapter already reports the same setting as aConfigurationError.parseLogLevel(src/logger.ts) now returns aResultcarrying aConfigurationErrorthat namesREA_LOG_LEVEL.cliConfigurationError(src/cli.ts) renders that error withprojectAnalysisError, the same message MCP prints.scripts/rea.mjschecks it before building the CLI and exits 1, as it already does for invalid output arguments.createClino longer throws. Embedders that call it directly get the silent default for an invalid level.Fixes #2135
Before / after
Valid values and an unset
REA_LOG_LEVELbehave as before.Validation
tests/boundary/cli/cliLogLevelConfiguration.test.tsrunsdoctor --jsonand--helpthrough the realscripts/rea.mjswithloudandINFO. It fails on main (stack trace) and passes with this change.tests/boundary/cli/dispatcher.test.ts: its stubdist/cli-runtime/cli.jsnow also exportscliConfigurationError, matching the module's new export.npm run lintpasses.npm test(before rebasing onto main): 9151 passed, 15 failed in 8 files. These are the same files and tests that fail on cleanorigin/mainc22111e on this host: Hopper, ibtool, hdiutil and inspector environment cases, pluspromptCompletion, which main has since fixed in test(mcp): ready providers before live prompt completion checks #2137. After rebasing, the dispatcher, log-level andpromptCompletiontests pass.🤖 Generated with Claude Code