From 04d4e5f97902eaca2020aedb32bb1d32660e5754 Mon Sep 17 00:00:00 2001 From: unsupportedpastels Date: Thu, 5 Nov 2026 05:46:54 +0000 Subject: [PATCH] test(e2e): attribute the model caller by the full socket 4-tuple Linux shares a connect()-assigned local port across different remotes, so matching /proc/net/tcp on the local address alone could pick another process's socket and label the control turn unknown. Match the remote end (the fake model's listener) too. --- .../core/serve_ownership/test_serve_session_ownership.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e/core/serve_ownership/test_serve_session_ownership.py b/tests/e2e/core/serve_ownership/test_serve_session_ownership.py index b5b9a1dee4..ef08521d7c 100644 --- a/tests/e2e/core/serve_ownership/test_serve_session_ownership.py +++ b/tests/e2e/core/serve_ownership/test_serve_session_ownership.py @@ -85,9 +85,11 @@ class _Model(FakeLLMServer): def _owner(self, port: int) -> str: """Label of the started process (or a descendant) holding the client end of ``port``.""" - local = f"0100007F:{port:04X}" + # The whole 4-tuple: Linux shares a connect()-assigned local port across remotes, so another + # process's socket can carry the same local address and sort first. + local, remote = f"0100007F:{port:04X}", f"0100007F:{self.port:04X}" rows = Path("/proc/net/tcp").read_text().splitlines()[1:] - inode = next((f[9] for f in map(str.split, rows) if f[1] == local), None) + inode = next((f[9] for f in map(str.split, rows) if f[1] == local and f[2] == remote), None) for label, proc in self.procs.items(): for pid in _tree(proc.pid): try: