Skip to content

Conversation

@jthomson04
Copy link
Collaborator

@jthomson04 jthomson04 commented Dec 3, 2025

Summary by CodeRabbit

  • Tests
    • Enhanced test infrastructure for LLM API connector integration tests with improved timing and cache configuration handling to better track post-response operations.
    • Added comprehensive multi-request test scenario to the test suite for improved coverage.

✏️ Tip: You can customize this high-level summary in your review settings.

Description

Test Coverage

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)

  • 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

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@jthomson04 jthomson04 marked this pull request as ready for review December 4, 2025 17:52
@jthomson04
Copy link
Collaborator Author

/bot run

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

📝 Walkthrough

Walkthrough

A test helper function generate_and_sleep was added to add a 1-second delay after model generation calls, enabling tracking of post-response KV connector operations. The function was integrated into existing tests, and a KV cache configuration was adjusted. The test suite was updated to include this scenario in the standard test list.

Changes

Cohort / File(s) Summary
Test utility and logic modifications
tests/integration/defs/llmapi/test_llm_api_connector.py
Added generate_and_sleep() helper function that wraps model.generate() with a 1-second post-response delay; replaced multiple model.generate() calls with this helper; increased KvCacheConfig max_tokens from 120 to 144 in test_connector_multi_request setup
Test list configuration
tests/integration/test_lists/test-db/l0_a10.yml
Added test entry llmapi/test_llm_api_connector.py::test_connector_multi_request to the pre-merge Tensorrt CPP/LLMAPI test block

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Helper function is straightforward with minimal logic
  • Test modifications follow a consistent, repetitive pattern
  • Configuration change (max_tokens value) is a single line adjustment
  • No complex interdependencies or architectural concerns

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ⚠️ Warning The PR description is incomplete; it contains only the template structure with empty sections for Description and Test Coverage, lacking actual implementation details. Fill in the Description section explaining the issue and solution, and the Test Coverage section listing relevant tests that validate the changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the issue (flaky KV connector tests) and the type of change (fix), with proper reference to NVBugs ticket.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/integration/defs/llmapi/test_llm_api_connector.py (1)

17-17: Helper wrapper and delayed generate usage look good

Using generate_and_sleep to wrap model.generate with a fixed 1s delay is a simple, localized way to give KV-connector async logic time to complete, and the call sites preserve the original argument structure. The extra ~1s per call is acceptable for this small set of tests; if flakiness or runtime becomes a concern later, you could centralize the delay as a module-level constant or swap it for a more explicit “wait for connector to drain” hook if the backend ever exposes one.

Also applies to: 67-75, 95-95, 202-202, 242-242, 292-292, 321-321, 394-396, 401-403

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 041bb32 and f13b387.

📒 Files selected for processing (2)
  • tests/integration/defs/llmapi/test_llm_api_connector.py (10 hunks)
  • tests/integration/test_lists/test-db/l0_a10.yml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: The code developed for TensorRT-LLM should conform to Python 3.8+
Indent Python code with 4 spaces; do not use tabs
Always maintain the namespace when importing in Python, even if only one class or function from a module is used (e.g., use from package.subpackage import foo and then foo.SomeClass() instead of from package.subpackage.foo import SomeClass)
Python filenames should use snake_case (e.g., some_file.py)
Python class names should use PascalCase (e.g., class SomeClass)
Python function and method names should use snake_case (e.g., def my_awesome_function():)
Python local variable names should use snake_case, with prefix k for variable names that start with a number (e.g., k_99th_percentile = ...)
Python global variables should use upper snake_case with prefix G (e.g., G_MY_GLOBAL = ...)
Python constants should use upper snake_case (e.g., MY_CONSTANT = ...)
Avoid shadowing variables declared in an outer scope in Python
Initialize all externally visible members of a Python class in the constructor
For Python interfaces that may be used outside a file, prefer docstrings over comments
Python comments should be reserved for code within a function, or interfaces that are local to a file
Use Google style docstrings for Python classes and functions, which can be parsed by Sphinx
Python attributes and variables can be documented inline with type and description (e.g., self.x = 5 followed by """<type>: Description of 'x'""" )
Avoid using reflection in Python when functionality can be easily achieved without reflection
When using try-except blocks in Python, limit the except clause to the smallest set of specific errors possible instead of catching all exceptions
When using try-except blocks in Python to handle multiple possible variable types (duck-typing), keep the body of the try as small as possible and use the else block to implement the logic

Files:

  • tests/integration/defs/llmapi/test_llm_api_connector.py
**/*.{cpp,h,cu,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

All TensorRT-LLM Open Source Software code files should contain an NVIDIA copyright header that includes the current year at the top

Files:

  • tests/integration/defs/llmapi/test_llm_api_connector.py
🧠 Learnings (9)
📚 Learning: 2025-09-09T09:40:45.658Z
Learnt from: fredricz-20070104
Repo: NVIDIA/TensorRT-LLM PR: 7645
File: tests/integration/test_lists/qa/llm_function_core.txt:648-648
Timestamp: 2025-09-09T09:40:45.658Z
Learning: In TensorRT-LLM test lists, it's common and intentional for the same test to appear in multiple test list files when they serve different purposes (e.g., llm_function_core.txt for comprehensive core functionality testing and llm_function_core_sanity.txt for quick sanity checks). This duplication allows tests to be run in different testing contexts.

Applied to files:

  • tests/integration/test_lists/test-db/l0_a10.yml
📚 Learning: 2025-09-17T02:48:52.732Z
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 7781
File: tests/integration/test_lists/waives.txt:313-313
Timestamp: 2025-09-17T02:48:52.732Z
Learning: In TensorRT-LLM, `tests/integration/test_lists/waives.txt` is specifically for waiving/skipping tests, while other test list files like those in `test-db/` and `qa/` directories are for different test execution contexts (pre-merge, post-merge, QA tests). The same test appearing in both waives.txt and execution list files is intentional - the test is part of test suites but will be skipped due to the waiver.

Applied to files:

  • tests/integration/test_lists/test-db/l0_a10.yml
📚 Learning: 2025-08-06T13:58:07.506Z
Learnt from: galagam
Repo: NVIDIA/TensorRT-LLM PR: 6487
File: tests/unittest/_torch/auto_deploy/unit/singlegpu/test_ad_trtllm_bench.py:1-12
Timestamp: 2025-08-06T13:58:07.506Z
Learning: In TensorRT-LLM, test files (files under tests/ directories) do not require NVIDIA copyright headers, unlike production source code files. Test files typically start directly with imports, docstrings, or code.

Applied to files:

  • tests/integration/test_lists/test-db/l0_a10.yml
📚 Learning: 2025-08-26T09:49:04.956Z
Learnt from: pengbowang-nv
Repo: NVIDIA/TensorRT-LLM PR: 7192
File: tests/integration/test_lists/test-db/l0_dgx_b200.yml:56-72
Timestamp: 2025-08-26T09:49:04.956Z
Learning: In TensorRT-LLM test configuration files, the test scheduling system handles wildcard matching with special rules that prevent duplicate test execution even when the same tests appear in multiple yaml files with overlapping GPU wildcards (e.g., "*b200*" and "*gb200*").

Applied to files:

  • tests/integration/test_lists/test-db/l0_a10.yml
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
Repo: NVIDIA/TensorRT-LLM PR: 6303
File: tests/integration/test_lists/qa/examples_test_list.txt:494-494
Timestamp: 2025-07-28T17:06:08.621Z
Learning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.

Applied to files:

  • tests/integration/test_lists/test-db/l0_a10.yml
📚 Learning: 2025-10-22T06:53:47.017Z
Learnt from: xinhe-nv
Repo: NVIDIA/TensorRT-LLM PR: 8534
File: scripts/format_test_list.py:1-6
Timestamp: 2025-10-22T06:53:47.017Z
Learning: The file `scripts/format_test_list.py` in the TensorRT-LLM repository does not require the NVIDIA Apache-2.0 copyright header.

Applied to files:

  • tests/integration/test_lists/test-db/l0_a10.yml
📚 Learning: 2025-08-29T14:07:45.863Z
Learnt from: EmmaQiaoCh
Repo: NVIDIA/TensorRT-LLM PR: 7370
File: tests/unittest/trt/model_api/test_model_quantization.py:24-27
Timestamp: 2025-08-29T14:07:45.863Z
Learning: In TensorRT-LLM's CI infrastructure, pytest skip markers (pytest.mark.skip) are properly honored even when test files have __main__ blocks that call test functions directly. The testing system correctly skips tests without requiring modifications to the __main__ block execution pattern.

Applied to files:

  • tests/integration/test_lists/test-db/l0_a10.yml
📚 Learning: 2025-11-27T09:23:18.742Z
Learnt from: fredricz-20070104
Repo: NVIDIA/TensorRT-LLM PR: 9511
File: tests/integration/defs/examples/serve/test_serve.py:136-186
Timestamp: 2025-11-27T09:23:18.742Z
Learning: In TensorRT-LLM testing, when adding test cases based on RCCA commands, the command format should be copied exactly as it appears in the RCCA case, even if it differs from existing tests. For example, some RCCA commands for trtllm-serve may omit the "serve" subcommand while others include it.

Applied to files:

  • tests/integration/test_lists/test-db/l0_a10.yml
📚 Learning: 2025-08-11T20:09:24.389Z
Learnt from: achartier
Repo: NVIDIA/TensorRT-LLM PR: 6763
File: tests/integration/defs/triton_server/conftest.py:16-22
Timestamp: 2025-08-11T20:09:24.389Z
Learning: In the TensorRT-LLM test infrastructure, the team prefers simple, direct solutions (like hard-coding directory traversal counts) over more complex but robust approaches when dealing with stable directory structures. They accept the maintenance cost of updating tests if the layout changes.

Applied to files:

  • tests/integration/test_lists/test-db/l0_a10.yml
🧬 Code graph analysis (1)
tests/integration/defs/llmapi/test_llm_api_connector.py (4)
tensorrt_llm/llmapi/llm.py (1)
  • generate (262-344)
tensorrt_llm/executor/executor.py (1)
  • generate (163-213)
tensorrt_llm/executor/ray_gpu_worker.py (1)
  • sleep (209-222)
tensorrt_llm/llmapi/llm_args.py (1)
  • KvCacheConfig (1435-1579)
🪛 Ruff (0.14.7)
tests/integration/defs/llmapi/test_llm_api_connector.py

168-168: Local variable outputs is assigned to but never used

Remove assignment to unused variable outputs

(F841)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (2)
tests/integration/defs/llmapi/test_llm_api_connector.py (1)

426-426: KvCacheConfig max_tokens=144 change is reasonable

Bumping KvCacheConfig(max_tokens) from 120 to 144 for test_connector_multi_request makes sense to ensure there is enough KV capacity for the first two 48-token requests plus the third, longer request once earlier KV is freed. The change is scoped to this test and should help avoid capacity-related flakiness; just ensure CI on the target A10 configuration confirms the behavior you expect.

tests/integration/test_lists/test-db/l0_a10.yml (1)

134-134: Adding test_connector_multi_request to the A10 TensorRT pre-merge list is consistent

The new llmapi/test_llm_api_connector.py::test_connector_multi_request entry matches the existing pattern for other connector tests in this block and appropriately brings the multi-request scenario into the pre-merge TensorRT CI on A10.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27004 [ run ] triggered by Bot. Commit: f13b387

@jthomson04
Copy link
Collaborator Author

/bot kill

Signed-off-by: jthomson04 <[email protected]>
@jthomson04
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27005 [ kill ] triggered by Bot. Commit: cb82c18

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27004 [ run ] completed with state ABORTED. Commit: f13b387

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27005 [ kill ] completed with state SUCCESS. Commit: cb82c18
Successfully killed previous jobs for commit cb82c18

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27006 [ run ] triggered by Bot. Commit: cb82c18

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27006 [ run ] completed with state SUCCESS. Commit: cb82c18
/LLM/main/L0_MergeRequest_PR pipeline #20591 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

@jthomson04
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27031 [ run ] triggered by Bot. Commit: 64d61d1

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27031 [ run ] completed with state SUCCESS. Commit: 64d61d1
/LLM/main/L0_MergeRequest_PR pipeline #20613 completed with status: 'FAILURE'

@pcastonguay
Copy link
Collaborator

/bot run --disable-fail-fast

@pcastonguay pcastonguay changed the title [None][fix] Fix flaky KV connector tests [https://nvbugs/5670672][fix] Fix flaky KV connector tests Dec 5, 2025
@tensorrt-cicd
Copy link
Collaborator

PR_Github #27127 [ run ] triggered by Bot. Commit: 64d61d1

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27127 [ run ] completed with state SUCCESS. Commit: 64d61d1
/LLM/main/L0_MergeRequest_PR pipeline #20697 completed with status: 'SUCCESS'

@jthomson04 jthomson04 merged commit 299601a into NVIDIA:main Dec 5, 2025
7 checks passed
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.

3 participants