Skip to content

feat(config): support string coercion for boolean settings#25634

Open
midnight-wonderer wants to merge 1 commit intogoogle-gemini:mainfrom
midnight-wonderer:feature/settings-boolean-casting
Open

feat(config): support string coercion for boolean settings#25634
midnight-wonderer wants to merge 1 commit intogoogle-gemini:mainfrom
midnight-wonderer:feature/settings-boolean-casting

Conversation

@midnight-wonderer
Copy link
Copy Markdown

Summary

This solve #25573 . It allow boolean input as strings, so that environment variable interpolation works.

Details

I asked Gemini-CLI to modify itself. The code looks okay to me.

Related Issues

Fixes #25573

How to Validate

You could run the tests, or try the settings.json field in #25573

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@midnight-wonderer midnight-wonderer requested a review from a team as a code owner April 18, 2026 20:03
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enables support for boolean settings provided as strings within the configuration. This change facilitates better integration with environment variable interpolation, ensuring that configuration values are correctly parsed even when passed as strings.

Highlights

  • Boolean Coercion: Implemented Zod preprocessing to allow string values 'true' and 'false' to be correctly coerced into boolean types during configuration validation.
  • Test Coverage: Added unit tests to verify that valid string-based booleans are accepted and invalid string values are rejected.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements boolean coercion for configuration settings, allowing "true" and "false" strings to be validated as booleans. Feedback suggests enhancing the robustness of this logic by supporting case-insensitivity and whitespace trimming to better support environment variables, along with corresponding test updates.

Comment thread packages/cli/src/config/settings-validation.ts
Comment thread packages/cli/src/config/settings-validation.ts
Comment thread packages/cli/src/config/settings-validation.test.ts
@gemini-cli gemini-cli bot added area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Apr 18, 2026
@midnight-wonderer
Copy link
Copy Markdown
Author

This PR is intentionally kept minimal by addressing two related issues at once:

  • String value strictness for "true" and "false".
  • Code and documentation bloat.

Solution: Aligning with People's Expectations

  • Why only strictly "true" and "false"? Originally, settings only accepted literal true and false JSON values. When values are set via interpolation, it is strongly implied that they should be interpreted as JSON values.
  • Reduced Cognitive Load: There is no need to add more information or documentation, as this behavior aligns with the intuitive understanding of the feature.

This PR simply aligns the code with these expectations.

I suggest @gemini-code-assist to discuss from the points I laid out, or probably human to override its suggestion.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Thank you for the clarification, @midnight-wonderer. I understand the design goal here is to maintain a minimal footprint while ensuring that environment variable interpolation behaves intuitively by treating string-based 'true' and 'false' values as their boolean counterparts. Given that this aligns with the expected behavior for configuration settings in this context, I agree that this approach is appropriate and avoids unnecessary complexity. The implementation looks solid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support boolean types when configuring settings.json via environment variables

1 participant