From b5dd5963cfc6b57e1f4c0970ad2bc31bf16e738a Mon Sep 17 00:00:00 2001 From: ms-lead-reviewer Date: Sat, 18 Jul 2026 01:52:00 -0500 Subject: [PATCH] test(#838): bound adapter failure proof --- .../838-broker-acceptance-flake.md | 2 ++ .../mutator-gate/runtime_tools_unittest.py | 22 +++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/scratchpads/838-broker-acceptance-flake.md b/docs/scratchpads/838-broker-acceptance-flake.md index 6934048..1e52a57 100644 --- a/docs/scratchpads/838-broker-acceptance-flake.md +++ b/docs/scratchpads/838-broker-acceptance-flake.md @@ -40,3 +40,5 @@ Eliminate high-contention uncaught JSON parse failures in lease-broker and mutat - Review RED evidence: delayed cross-chunk garbage resolved `{ ok: true }` instead of rejecting, and a truncated `promotion_token` remained in the typed error. The tests use separate timed writes to prevent kernel/event-loop coalescing. - Review remediation: the shared client now accumulates through EOF, requires exactly one terminal newline, then parses inside a rejecting error boundary. Diagnostic bodies are capped at 256 bytes, sensitive broker fields are fully redacted, and a SHA-256 digest preserves correlation without credential disclosure. - Post-review coverage: `broker-test-client.ts` 99.35% statements/lines, 86.66% branches, 100% functions. Final full suite is 73 files / 1,394 tests plus all Python/shell gates; recursive build, typecheck, lint, and format are green. +- Fresh exact-head Codex security review: risk `none`, no findings. Fresh code review found only that the real-adapter subprocess proof lacked a timeout; it now has a five-second bound and fails with runtime/wire context while closing the fake server. The focused Python suite remains 15/15 green. +- Mandatory Opus SECREV remains coordinator-owned and pending before any push/PR decision; this build is intentionally local-only. diff --git a/packages/mosaic/src/mutator-gate/runtime_tools_unittest.py b/packages/mosaic/src/mutator-gate/runtime_tools_unittest.py index ac49b69..0d8b99b 100644 --- a/packages/mosaic/src/mutator-gate/runtime_tools_unittest.py +++ b/packages/mosaic/src/mutator-gate/runtime_tools_unittest.py @@ -254,13 +254,21 @@ class ExecutableEntrypointTest(unittest.TestCase): "MOSAIC_LEASE_SESSION_ID": "d" * 64, "MOSAIC_RUNTIME_GENERATION": "1", } - result = subprocess.run( - [sys.executable, str(TOOLS_DIR / "mutator-gate.py"), "--runtime", runtime], - input=b'{"tool_name":"Read"}\n', - capture_output=True, - env=environment, - check=False, - ) + try: + result = subprocess.run( + [sys.executable, str(TOOLS_DIR / "mutator-gate.py"), "--runtime", runtime], + input=b'{"tool_name":"Read"}\n', + capture_output=True, + env=environment, + check=False, + timeout=5, + ) + except subprocess.TimeoutExpired as exc: + server.close() + thread.join(timeout=2) + self.fail( + f"{runtime} gate hung on wire reply {wire_reply!r}: {exc}" + ) thread.join(timeout=2) self.assertFalse(thread.is_alive())