Skip to content

fix(cli): report an invalid REA_LOG_LEVEL as configuration - #2140

Merged
kaoru0822-kitauji merged 1 commit into
mainfrom
fix/issue-2135
Oct 12, 2026
Merged

kaoru0822-kitauji merged 1 commit into
mainfrom
fix/issue-2135

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Summary

createCli parsed REA_LOG_LEVEL with a throwing Zod schema. An invalid or differently cased value (loud, INFO) therefore crashed every CLI command, including rea doctor and rea --help, with an uncaught ZodError stack trace. The MCP adapter already reports the same setting as a ConfigurationError.

  • parseLogLevel (src/logger.ts) now returns a Result carrying a ConfigurationError that names REA_LOG_LEVEL.
  • cliConfigurationError (src/cli.ts) renders that error with projectAnalysisError, the same message MCP prints. scripts/rea.mjs checks it before building the CLI and exits 1, as it already does for invalid output arguments.
  • createCli no longer throws. Embedders that call it directly get the silent default for an invalid level.

Fixes #2135

Before / after

$ REA_LOG_LEVEL=loud rea doctor --json
before: ZodError stack trace from parseLogLevel/createCli, exit 1
after:  REA configuration is invalid: REA_LOG_LEVEL: Invalid option: expected one of "trace"|"debug"|"info"|"warn"|"error"|"fatal"|"silent".   (stderr, exit 1)

Valid values and an unset REA_LOG_LEVEL behave as before.

Validation

  • New CLI boundary test tests/boundary/cli/cliLogLevelConfiguration.test.ts runs doctor --json and --help through the real scripts/rea.mjs with loud and INFO. It fails on main (stack trace) and passes with this change.
  • tests/boundary/cli/dispatcher.test.ts: its stub dist/cli-runtime/cli.js now also exports cliConfigurationError, matching the module's new export.
  • npm run lint passes.
  • npm test (before rebasing onto main): 9151 passed, 15 failed in 8 files. These are the same files and tests that fail on clean origin/main c22111e on this host: Hopper, ibtool, hdiutil and inspector environment cases, plus promptCompletion, which main has since fixed in test(mcp): ready providers before live prompt completion checks #2137. After rebasing, the dispatcher, log-level and promptCompletion tests pass.

🤖 Generated with Claude Code

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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T10:55:29.176113Z fe25f02 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kaoru0822-kitauji
kaoru0822-kitauji merged commit 3159732 into main Oct 12, 2026
32 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/issue-2135 branch October 12, 2026 13:07
@github-actions github-actions Bot mentioned this pull request Oct 12, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: cli CLI adapter and one-shot commands labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] An invalid REA_LOG_LEVEL crashes every CLI command with a ZodError stack trace

2 participants