From e7692c98f8930511dd402a2a2e81e941678a2a43 Mon Sep 17 00:00:00 2001 From: xiaoan17 Date: Sat, 31 Oct 2026 10:08:25 +0800 Subject: [PATCH] fix(benchmark): pin UTF-8 for the native process start identity read The shipped text-I/O guard fails on main for this line, and the shard lane reports it on every branch: tests/test_loopx_text_io_utf8.py::test_shipped_runtime_pins_utf8_for_every_text_file_read_and_write E Left contains one more item: 'loopx/capabilities/benchmark_toolkit/native_codex_process.py:71' Path.read_text() without a codec uses the process locale, which is exactly the shape the guard exists to reject. Pin the codec the runtime already uses everywhere else. The failure semantics do not change: a process name that is not valid UTF-8 raises UnicodeDecodeError, which is a ValueError, and the existing except (OSError, ValueError, IndexError) already leaves the start identity unknown. Signed-off-by: xiaoan17 --- loopx/capabilities/benchmark_toolkit/native_codex_process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopx/capabilities/benchmark_toolkit/native_codex_process.py b/loopx/capabilities/benchmark_toolkit/native_codex_process.py index e11c365210..feb0da24ba 100644 --- a/loopx/capabilities/benchmark_toolkit/native_codex_process.py +++ b/loopx/capabilities/benchmark_toolkit/native_codex_process.py @@ -68,7 +68,7 @@ def started(self, process: subprocess.Popen[str]) -> None: try: # A missing /proc (or a child that already exited) is unknown. The # parent timestamp is not a substitute for a native start identity. - stat = Path(f"/proc/{process.pid}/stat").read_text() + stat = Path(f"/proc/{process.pid}/stat").read_text(encoding="utf-8") self._data["linux_start_ticks"] = int(stat.rsplit(")", 1)[1].split()[19]) except (OSError, ValueError, IndexError): pass