Skip to content

fix(server): show falsey defaults in CLI help - #2355

Open
cupkk wants to merge 1 commit into
abetlen:mainfrom
cupkk:fix/server-cli-falsey-default-help
Open

fix(server): show falsey defaults in CLI help#2355
cupkk wants to merge 1 commit into
abetlen:mainfrom
cupkk:fix/server-cli-falsey-default-help

Conversation

@cupkk

@cupkk cupkk commented Aug 3, 2026

Copy link
Copy Markdown

add_args_from_model only appends a default value when the value is truthy. As a result, CLI help omits valid defaults such as False for --flash_attn and 0 for several numeric settings.

Check for None instead, while still excluding required fields. The regression test covers boolean false, numeric zero, a truthy default, and a required field.

Validation:

  • isolated Pydantic/argparse regression check
  • python -m compileall -q llama_cpp/server/cli.py tests/test_server_cli.py
  • git diff --check

The full suite was not run because this minimal environment does not contain the compiled llama.cpp extension or the project test dependencies.

Copilot AI review requested due to automatic review settings August 3, 2026 23:21
@cupkk
cupkk force-pushed the fix/server-cli-falsey-default-help branch from 49a1bd4 to 0d2ce9c Compare August 3, 2026 23:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_model to append defaults when field.default is not None (while still excluding required fields).
  • Add a regression test covering boolean False, numeric 0, 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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants