Skip to content

fix(cli): include inherited field docstrings in get_attr_docs#49821

Open
hclsys wants to merge 1 commit into
vllm-project:mainfrom
hclsys:fix/get-attr-docs-inherited
Open

fix(cli): include inherited field docstrings in get_attr_docs#49821
hclsys wants to merge 1 commit into
vllm-project:mainfrom
hclsys:fix/get-attr-docs-inherited

Conversation

@hclsys

@hclsys hclsys commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #49817.

get_attr_docs(cls) only AST-parses inspect.getsource(cls) — the class's own body — so attribute docstrings inherited from a base dataclass are dropped. But dataclasses.fields() exposes inherited fields, so those args still get registered; the net effect is CLI args like --chat-template / --lora-modules (inherited by FrontendArgs from BaseFrontendArgs) show up in vllm serve --help=Frontend with no docs.

Fix: walk cls.__mro__ base→derived and merge per-class attr docs, so inherited docstrings are picked up and a docstring redefined on a subclass still wins. Classes without retrievable source (e.g. object) are skipped.

Test

Added tests/config/test_config_utils.py::test_get_attr_docs_includes_inherited_fields (base + derived + override) and ::test_get_attr_docs_handles_object_in_mro.

$ pytest tests/config/test_config_utils.py -q
24 passed

get_attr_docs(cls) only AST-parses the source of cls itself, so CLI args
inherited from a base dataclass (everything FrontendArgs gets from
BaseFrontendArgs, e.g. --chat-template, --lora-modules) appear in
`--help` with no documentation. Walk the MRO from base to derived so
inherited attribute docstrings are collected, with subclass docstrings
taking precedence.

Fixes vllm-project#49817.

Signed-off-by: Chenglun Hu <chenglunhu@gmail.com>
@hclsys
hclsys requested a review from hmellor as a code owner July 25, 2026 17:33

@claude claude Bot 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.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

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.

[Bug]: vllm serve --help=Frontend misses docs for inherited fields from BaseFrontendArgs

1 participant