Skip to content

[https://nvbugs/6451425][fix] Replace the class-identity isinstance() with the polymorphic predicate…#16421

Closed
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6451425
Closed

[https://nvbugs/6451425][fix] Replace the class-identity isinstance() with the polymorphic predicate…#16421
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6451425

Conversation

@trtllm-agent

@trtllm-agent trtllm-agent commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: session-reuse test harness monkey-patches module-level MpiPoolSession symbol to a factory function, breaking isinstance() check
  • Fix: Replace the class-identity isinstance() with the polymorphic predicate is_comm_session() already defined on MpiSession base class; delegates correctly through the _ReusableSession wrapper and is robust to symbol rebinding
  • Automated fix generated by repair-bot

Test plan

  • Verify fix on the same GPU type as the original failure
  • Check for regressions in related tests

Links

Summary by CodeRabbit

  • Bug Fixes

    • Improved worker initialization handling across supported communication session types.
    • Prevented failures when runtime session implementations differ from their original class references.
  • Tests

    • Removed an outdated waiver for the Eagle3 speculative decoding test, allowing it to run as part of the integration test suite.

… rebind

The test suite's session-reuse helper (tests/test_common/session_reuse.py)
rebinds the module-level MpiPoolSession symbol in
tensorrt_llm.executor.proxy to a factory function so cached pools can be
handed to subsequent bare LLM(...) tests. Once the symbol is a function
object, the isinstance(self.mpi_session, MpiPoolSession) check in
_start_executor_workers raises TypeError: isinstance() arg 2 must be a
type, a tuple of types, or a union.

Switch to the polymorphic predicate self.mpi_session.is_comm_session()
already defined on MpiSession. Method resolution goes through the real
instance (or the _ReusableSession wrapper's __getattr__ delegation),
so this works whether the module symbol is rebound or not, and it is more
robust than a class-based check for a state that already has an abstract
API on the base class.

Also remove the stale waiver for
unittest/_torch/speculative/test_eagle3.py::test_llama_eagle3[True-TRTLLM-True-False-True-True-True-False-False-False]
now that the fix makes the test pass.

Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9611ed05-b563-4d64-9f5b-ec18b5d6d5e0

📥 Commits

Reviewing files that changed from the base of the PR and between 46bf21b and 01787ad.

📒 Files selected for processing (2)
  • tensorrt_llm/executor/proxy.py
  • tests/integration/test_lists/waives.txt
💤 Files with no reviewable changes (1)
  • tests/integration/test_lists/waives.txt

📝 Walkthrough

Walkthrough

Changes

Worker initialization

Layer / File(s) Summary
MPI session status handling and integration waiver
tensorrt_llm/executor/proxy.py, tests/integration/test_lists/waives.txt
Worker initialization now uses is_comm_session() for three-element status payloads, and the Eagle3 test entry is removed from the waiver list.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: asfiyab-nvidia, zhaoyangwang-nvidia, brnguyen2

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: replacing the isinstance check with the polymorphic predicate, and it includes the NVBugs tag and fix type.
Description check ✅ Passed The description covers the root cause, fix, test plan, and bug link, which satisfies the template’s core information despite different headings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@zhaoyangwang-nvidia zhaoyangwang-nvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@fredricz-20070104 fredricz-20070104 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved.

@fredricz-20070104

Copy link
Copy Markdown
Collaborator

Please resolve the conflict to get this one merged.

@brnguyen2

Copy link
Copy Markdown
Collaborator

Superseded by #16444, which has merged.

@brnguyen2 brnguyen2 closed this Jul 16, 2026
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.

5 participants