google-gemini / google-gemini/gemini-cli
Bug: numeric settings editor saves overflow values as null
- Dominant language
- TypeScript
- Stars
- 107k
- Forks
- 14.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 45
Description
### What happened?
The numeric settings editor accepts non-finite numeric values.
For example:
```ts
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:
```json
{
"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:
```ts
expect(parseEditedValue('number', '1e309')).toBeNull();
```
I ran:
```console
npx --yes --package=node@20.19.0 node ./node_modules/vitest/vitest.mjs run src/utils/settingsUtils.test.ts --root packages/cli
```
Result:
```text
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.
Contributor guide
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.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100