From 58844a059ddfbef62d7ea6cf1a04117b8db7421f Mon Sep 17 00:00:00 2001 From: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com> Date: Wed, 15 Jul 2026 00:57:15 -0700 Subject: [PATCH] [nvbugs/6272598][fix] Guard MpiPoolSession isinstance against monkey-patch The session-reuse test infrastructure (tests/test_common/session_reuse.py) monkey-patches MpiPoolSession in tensorrt_llm.executor.proxy with a factory function to enable pool reuse across LLM instances. This broke 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 a negative check against the never-patched MpiCommSession / RemoteMpiCommSessionClient types, matching the pattern already used earlier in the same function. Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com> --- tensorrt_llm/executor/proxy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tensorrt_llm/executor/proxy.py b/tensorrt_llm/executor/proxy.py index 11451bad5b67..4c2482304a5e 100644 --- a/tensorrt_llm/executor/proxy.py +++ b/tensorrt_llm/executor/proxy.py @@ -573,7 +573,9 @@ def mpi_done_callback(future: concurrent.futures.Future): raise RuntimeError( "Executor worker returned error") from ready_signal - if isinstance(self.mpi_session, MpiPoolSession) and len(status) == 3: + if not isinstance( + self.mpi_session, + (MpiCommSession, RemoteMpiCommSessionClient)) and len(status) == 3: worker_process_identities: List[WorkerProcessIdentity] = status[2] self._worker_process_monitor.register(worker_process_identities)