[https://nvbugs/6265490][fix] Defer LoRA path validation - #17138
[https://nvbugs/6265490][fix] Defer LoRA path validation#17138yibinl-nvidia wants to merge 2 commits into
Conversation
Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
|
/bot run |
|
PR_Github #63109 [ run ] triggered by Bot. Commit: |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThe change moves missing LoRA path checks to adapter loading and sanitizes validation error responses in OpenAI servers. Tests cover early LoRA failure and prevention of sensitive request data in error messages. ChangesValidation and error handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/unittest/_torch/visual_gen/test_trtllm_serve_endpoints.py`:
- Line 1505: Update the test’s local _handler to exercise the production handler
registered by OpenAIServer.__init__ or OpenAIDisaggServer.__init__ instead of
returning a hard-coded JSONResponse. Invoke the production app or reuse a shared
production handler so the assertion fails if either handler regresses to
returning str(exc).
- Around line 1533-1538: Update the response validation in the affected test to
assert the complete JSON body equals the expected validation-error payload,
rather than checking only body["error"]. Preserve the status-code assertion and
ensure the expected full-body comparison verifies that secret is absent from
every response field.
In `@tests/unittest/executor/test_base_worker.py`:
- Around line 61-64: Initialize the cleanup fields required by
BaseWorker.__del__ in this object.__new__(BaseWorker) test setup: set
doing_shutdown and engine to the same safe defaults expected after BaseWorker
initialization, while preserving the existing LoRA and model configuration
fields.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: da640f9b-0a4e-454c-8d0e-13409f160484
📒 Files selected for processing (6)
tensorrt_llm/executor/base_worker.pytensorrt_llm/executor/request.pytensorrt_llm/serve/openai_disagg_server.pytensorrt_llm/serve/openai_server.pytests/unittest/_torch/visual_gen/test_trtllm_serve_endpoints.pytests/unittest/executor/test_base_worker.py
💤 Files with no reviewable changes (1)
- tensorrt_llm/executor/request.py
ad4d030 to
00c125e
Compare
|
/bot kill |
00c125e to
c390441
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
tensorrt_llm/serve/openai_server.py (1)
769-780: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd type annotations to the new exception handler.
validation_exception_handlerhas untyped parameters and no return annotation. Add_: Request,exc: RequestValidationError, and-> Response.As per coding guidelines, annotate every function and use precise types.
Proposed change
- async def validation_exception_handler(_, exc): + async def validation_exception_handler( + _: Request, exc: RequestValidationError) -> Response:🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tensorrt_llm/serve/openai_server.py` around lines 769 - 780, Update validation_exception_handler with the requested precise annotations: type the ignored request parameter as Request, exc as RequestValidationError, and the return value as Response, preserving the existing visual and non-visual response behavior.Source: Coding guidelines
tests/unittest/_torch/visual_gen/test_trtllm_serve_endpoints.py (1)
1495-1495: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the preserved request-error metric.
The test sets
server.metrics_collectortoNone. It cannot detect a regression that removeslog_request_error(http_code=400). Inject a fake collector and assert the 400 call in addition to the exact response-body assertion.Also applies to: 1509-1518
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unittest/_torch/visual_gen/test_trtllm_serve_endpoints.py` at line 1495, Update the affected endpoint tests around the metrics_collector setup to inject a fake collector instead of None, preserve the exact response-body assertion, and verify that log_request_error is called with http_code=400. Apply the same coverage to the additional test block at the referenced request-error cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tensorrt_llm/serve/openai_server.py`:
- Around line 769-780: Update validation_exception_handler with the requested
precise annotations: type the ignored request parameter as Request, exc as
RequestValidationError, and the return value as Response, preserving the
existing visual and non-visual response behavior.
In `@tests/unittest/_torch/visual_gen/test_trtllm_serve_endpoints.py`:
- Line 1495: Update the affected endpoint tests around the metrics_collector
setup to inject a fake collector instead of None, preserve the exact
response-body assertion, and verify that log_request_error is called with
http_code=400. Apply the same coverage to the additional test block at the
referenced request-error cases.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 33884d3a-a0d7-4415-9a5d-d7fce4e8e6bd
📒 Files selected for processing (3)
tensorrt_llm/serve/openai_server.pytests/unittest/_torch/visual_gen/test_trtllm_serve_endpoints.pytests/unittest/executor/test_base_worker.py
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/unittest/executor/test_base_worker.py
|
/bot run |
|
PR_Github #63119 [ kill ] triggered by Bot. Commit: |
|
PR_Github #63109 [ run ] completed with state |
|
PR_Github #63119 [ kill ] completed with state |
|
PR_Github #63121 [ run ] triggered by Bot. Commit: |
c390441 to
e289c89
Compare
|
/bot kill |
|
PR_Github #63124 [ kill ] triggered by Bot. Commit: |
Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
e289c89 to
940bdca
Compare
|
PR_Github #63121 [ run ] completed with state |
|
PR_Github #63124 [ kill ] completed with state |
|
/bot run |
|
PR_Github #63128 [ run ] triggered by Bot. Commit: |
|
PR_Github #63128 [ run ] completed with state
|
|
/bot run |
|
PR_Github #63149 [ run ] triggered by Bot. Commit: |
|
PR_Github #63149 [ run ] completed with state
|
|
/bot run |
|
PR_Github #63167 [ run ] triggered by Bot. Commit: |
|
PR_Github #63167 [ run ] completed with state
|
|
/bot run |
|
PR_Github #63178 [ run ] triggered by Bot. Commit: |
|
PR_Github #63178 [ run ] completed with state |
|
The scope of the Suggestion: keep Two smaller points:
|
Dev Engineer Review
lora_pathexistence validation fromLoRARequest.__post_init__to adapter loading.FileNotFoundErrorwhen the requested LoRA adapter path is missing.lora_ckpt_sourcevalidation.QA Engineer Review
tests/unittest/executor/test_base_worker.py.tests/unittest/_torch/visual_gen/test_trtllm_serve_endpoints.py.tests/integration/test_lists/.Description
This PR defers LoRA path existence checks until adapter loading so request construction does not leak local filesystem path information through validation errors. Missing adapter paths now fail during
_load_lora_adapterwith a sanitizedFileNotFoundError.It also keeps OpenAI serving request-validation responses generic for non-visual-gen and disaggregated endpoints, so malformed requests do not echo sensitive request data back to clients.
Test Coverage
tests/unittest/executor/test_base_worker.py::test_lora_request_missing_path_fails_at_load_timetests/unittest/_torch/visual_gen/test_trtllm_serve_endpoints.py::TestNonVisualGenValidationResponsepre-commit run --show-diff-on-failure --verbose --files ...on the six PR files passed after the watcher fix.pytestwas attempted but collection is blocked in this checkout by missingtransformers.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.