Skip to content

[https://nvbugs/6463831][fix] Replace isinstance(self.mpi_session, MpiPoolSession) with `not…#16491

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

[https://nvbugs/6463831][fix] Replace isinstance(self.mpi_session, MpiPoolSession) with `not…#16491
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6463831

Conversation

@trtllm-agent

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

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: isinstance(self.mpi_session, MpiPoolSession) raises TypeError when tests/test_common/session_reuse.py monkey-patches the module-level MpiPoolSession symbol with a factory function.
  • Fix: Replace isinstance(self.mpi_session, MpiPoolSession) with not self.mpi_session.is_comm_session(), the polymorphic predicate already defined on MpiSession base class — immune to module-level symbol rebinding, matches the same session set.
  • 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-process initialization across MPI session types.
    • Prevented test and runtime session substitutions from causing incorrect session detection.

… rebind

The session-reuse test infrastructure (tests/test_common/session_reuse.py)
monkey-patches the module-level MpiPoolSession symbol in
tensorrt_llm.executor.proxy with a factory function to enable pool reuse
across LLM instances. That breaks isinstance(self.mpi_session,
MpiPoolSession) in _start_executor_workers with:

    TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

Switch to the polymorphic MpiSession.is_comm_session() predicate. It is a
method call on the instance, so it does not depend on the module-level
MpiPoolSession symbol staying bound to the class, and it composes with
the _ReusableSession wrapper's __getattr__ delegation. Negating it
selects the same set of local-pool sessions (MpiPoolSession and
subclasses) as the original isinstance check.

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

coderabbitai Bot commented Jul 16, 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: 235cd13f-1e7f-4d8a-8250-686aa0b206e7

📥 Commits

Reviewing files that changed from the base of the PR and between 274043a and 7655db6.

📒 Files selected for processing (1)
  • tensorrt_llm/executor/proxy.py

📝 Walkthrough

Walkthrough

The executor worker startup path now uses is_comm_session() instead of an isinstance check when handling three-element worker status, avoiding failures when MpiPoolSession is rebound by test infrastructure.

Changes

Executor session detection

Layer / File(s) Summary
Worker identity registration predicate
tensorrt_llm/executor/proxy.py
The len(status) == 3 branch uses the polymorphic MPI session predicate and documents the test-time rebinding hazard.

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

Possibly related PRs

Suggested reviewers: schetlur-nv, tburt-nv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific and directly matches the main fix, including the bug link and fix type.
Description check ✅ Passed It includes the root cause, fix, test plan, and bug link, so the key template content is covered.
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.

@mikeiovine

Copy link
Copy Markdown
Collaborator

Close as fix has been submitted already

@mikeiovine mikeiovine 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.

3 participants