From dbde8f2e48b77602f4ed58a6df74faa58db79af7 Mon Sep 17 00:00:00 2001 From: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com> Date: Thu, 16 Jul 2026 02:23:10 -0700 Subject: [PATCH] [nvbugs/6464991][fix] drop fragile MpiPoolSession isinstance guard in proxy The isinstance(self.mpi_session, MpiPoolSession) check in _start_executor_workers is fragile: session-reuse test infrastructure (tests/test_common/session_reuse.py) monkey-patches the module-level tensorrt_llm.executor.proxy.MpiPoolSession symbol with a plain function, which makes isinstance() raise "TypeError: isinstance() arg 2 must be a type". It also fails to recognize the _ReusableSession wrapper handed out by the reuse cache. The check gates WorkerProcessMonitor.register(), which already self-filters non-local identities by hostname/pid_namespace, so it is safe to invoke for any session type. Rely on len(status) == 3 alone as the authoritative signal that the worker sent identities. Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com> --- tensorrt_llm/executor/proxy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorrt_llm/executor/proxy.py b/tensorrt_llm/executor/proxy.py index 11451bad5b67..d6f2fd9392dc 100644 --- a/tensorrt_llm/executor/proxy.py +++ b/tensorrt_llm/executor/proxy.py @@ -573,7 +573,7 @@ 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 len(status) == 3: worker_process_identities: List[WorkerProcessIdentity] = status[2] self._worker_process_monitor.register(worker_process_identities)