Bug: numeric settings editor saves overflow values as null

Open Beginner friendly
#29,226 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
cli

Research direction

Start with parseEditedValue in packages/cli/src/utils/settingsUtils.ts and the focused cases in src/utils/settingsUtils.test.ts under packages/cli. Check how SettingsDialog.tsx handleEditCommit uses the parsed result and review commentJson.ts for the serialization path; done means non-finite numeric input is rejected and the existing setting is not replaced by null.

Written by the indexing model from the issue text.

Description

area/core effort/small kind/bug priority/p2 status/bot-triaged
What happened?

The numeric settings editor accepts non-finite numeric values.

For example:

parseEditedValue('number', '1e309')

returns Infinity because the parser only rejects Number.isNaN() results.

The Settings dialog treats this as a valid value and passes it to setSetting. When the settings serializer writes the value to JSON, it becomes:

{
  "model": {
    "compressionThreshold": null
  }
}

This means an input accepted by the Settings dialog is silently changed into an invalid numeric configuration value.

I added this focused regression test locally:

expect(parseEditedValue('number', '1e309')).toBeNull();

I ran:

npx --yes --package=node@20.19.0 node ./node_modules/vitest/vitest.mjs run src/utils/settingsUtils.test.ts --root packages/cli

Result:

Test Files  1 failed (1)
Tests       1 failed | 49 passed (50)

Expected: null
Received: Infinity
What did you expect to happen?

The numeric settings parser should reject non-finite values such as Infinity, -Infinity, and overflow values such as 1e309.

The Settings dialog should leave the existing setting unchanged instead of saving null.

Client information
Client Information

Tested from the latest source checkout.

CLI Version 0.60.0-nightly.20260901.g0bd1d4397
Git Commit 85aca163f6c73ac6ce380b5447359146b8adcae4
Node.js 20.19.0
OS macOS 26.5.2 arm64
Sandbox no sandbox
Auth Method not applicable

Login information

Not authentication-related. The behavior is in the local settings parser and serializer.

Anything else we need to know?

Relevant code:

  • packages/cli/src/utils/settingsUtils.ts: parseEditedValue
  • packages/cli/src/ui/components/SettingsDialog.tsx: handleEditCommit
  • packages/cli/src/utils/commentJson.ts: settings serialization

I searched existing open and closed issues and pull requests using Infinity, non-finite, 1e309, numeric input, and settings validation terms. I did not find a matching report or implementation.

I am willing to implement a small fix with regression tests if maintainers consider this suitable for a community contribution.

Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 4h
Merged PRs (30d)
43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google-gemini/gemini-cli

All issues in google-gemini/gemini-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.