Skip to content

[https://nvbugs/6463828][fix] Replace the concrete-type check with the polymorphic…#16492

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

[https://nvbugs/6463828][fix] Replace the concrete-type check with the polymorphic…#16492
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6463828

Conversation

@trtllm-agent

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

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: isinstance(self.mpi_session, MpiPoolSession) raised TypeError because the test-suite monkey-patch in tests/test_common/session_reuse.py replaces tensorrt_llm.executor.proxy.MpiPoolSession with a factory function (not a type), and the actual session is a _ReusableSession wrapper (not a subclass) that delegates via __getattr__.
  • Fix: Replace the concrete-type check with the polymorphic MpiSession.is_comm_session() — returns False for MpiPoolSession (register PIDs), True for comm-based sessions (skip). The _ReusableSession wrapper transparently forwards the method to its real MpiPoolSession via __getattr__.
  • 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 tracking during startup across different MPI session types.
    • Ensured operating system process identities are registered consistently when available.

…PoolSession)

The proxy's post-init worker-PID registration branch guarded on
isinstance(self.mpi_session, MpiPoolSession). Two legitimate patterns in
the codebase break that check:

1. tests/test_common/session_reuse.py monkey-patches
   tensorrt_llm.executor.proxy.MpiPoolSession to a factory *function*
   for session reuse; isinstance(x, <function>) raises TypeError.
2. Session-reuse hands out a _ReusableSession wrapper that delegates
   via __getattr__ to a real MpiPoolSession; it is not a subclass.

Replace the concrete-type check with the polymorphic MpiSession helper
is_comm_session(), which correctly returns False for pool-based sessions
(register PIDs) and True for comm-based sessions (skip). Wrappers that
delegate to a real MpiPoolSession forward is_comm_session() through
__getattr__, so the reuse path works transparently.

Signed-off-by: trtllm-agent <trtllm-agent@nvidia.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: 60a6ad38-cc2b-4ce9-a2e4-27ee48574640

📥 Commits

Reviewing files that changed from the base of the PR and between 4277d15 and a108615.

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

📝 Walkthrough

Walkthrough

GenerationExecutorProxy now registers worker process identities for any non-communication MPI session when initialization returns identity data, replacing the previous MpiPoolSession-specific check.

Changes

MPI worker identity registration

Layer / File(s) Summary
Session-aware worker registration
tensorrt_llm/executor/proxy.py
Worker identity registration now checks not self.mpi_session.is_comm_session() alongside len(status) == 3, with comments documenting communication-session monitoring limitations.

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

Possibly related PRs

Suggested reviewers: asfiyab-nvidia

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: replacing a concrete MPI session type check with a polymorphic helper.
Description check ✅ Passed The description covers the root cause, fix, and test plan, but it omits the template's explicit PR checklist section.
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.

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.

1 participant