fix(server): show falsey defaults in CLI help - #2355
Open
cupkk wants to merge 1 commit into
Open
Conversation
cupkk
force-pushed
the
fix/server-cli-falsey-default-help
branch
from
August 3, 2026 23:21
49a1bd4 to
0d2ce9c
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes CLI help generation for the server by ensuring Pydantic field defaults that are “falsy” (e.g., False, 0) are still displayed in argparse help text, rather than being omitted due to truthiness checks.
Changes:
- Update
add_args_from_modelto append defaults whenfield.default is not None(while still excluding required fields). - Add a regression test covering boolean
False, numeric0, a truthy default, and a required field. - Add an Unreleased changelog entry for the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
llama_cpp/server/cli.py |
Fixes help-text default rendering by checking default is not None instead of truthiness. |
tests/test_server_cli.py |
Adds coverage to ensure falsy defaults appear in generated CLI help. |
CHANGELOG.md |
Documents the fix under Unreleased. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
add_args_from_modelonly appends a default value when the value is truthy. As a result, CLI help omits valid defaults such asFalsefor--flash_attnand0for several numeric settings.Check for
Noneinstead, while still excluding required fields. The regression test covers boolean false, numeric zero, a truthy default, and a required field.Validation:
python -m compileall -q llama_cpp/server/cli.py tests/test_server_cli.pygit diff --checkThe full suite was not run because this minimal environment does not contain the compiled llama.cpp extension or the project test dependencies.