Repository navigation
Description
mcpx e2e shard-packer tests keep NamedTemporaryFile open while reopening its path — fails on Windows
Finding (from PR review)
On PR #7897 (mcpx(ci): guard malformed e2e timing seeds), Copilot review comments 4508758212, 4508758233, 4508758244, 4508758252, and 4508758267 (Copilot, 2026-11-09T01:50:15Z–01:50:16Z, pkgs/mcpx/scripts/tests/test_e2e_shard_packer.py:33,65,89,100,136) — one finding repeated at five call sites:
NamedTemporaryFileis kept open whileload_weights()(and the subprocess in the CLI test) tries to open the same path. This is a known portability issue on Windows (file locking can cause PermissionError / open failures). Consider writing to a temp path that is closed before reading (e.g.,TemporaryDirectory()+open()), or usingNamedTemporaryFile(delete=False)and explicitly closing it before callingload_weights()/ running the subprocess (with afinallycleanup).
No-response evidence
- No replies in any of the five comment threads; all five review threads are unresolved (GraphQL
reviewThreadsverified 2026-11-10: threads for comments 4508758212, 4508758233, 4508758244, 4508758252, and 4508758267 each haveisResolved: false). - PR mcpx(ci): guard malformed e2e timing seeds #7897 head is unchanged at
dc84f22fcf9978483f0607956a2cfc4dbf6f3631since the comments; no fix commit followed them. The finding is past the 24-hour grace period for open PRs (comments 2026-11-09T01:50:15Z; grace expired 2026-11-10T01:50:15Z). - Issue search (open and closed) by PR number, file path, and keywords found no existing issue covering this finding.
- The PR's other review finding (Codex, CI-venue wiring) was responded to by dezren39 and is already tracked by issue ci(mcpx-test): the #1998 sharded-suite workflow is dispatch-only and disabled_manually — header and ci-policy assign PR + main tiers, its unit leg is already red on main, and the #7558 blocking lint leg lives only here #7795 — it is not part of this filing.
Still-live evidence (current PR head)
Raw read at head dc84f22fcf agrees — the pattern is present verbatim at every flagged site in pkgs/mcpx/scripts/tests/test_e2e_shard_packer.py:
- Lines 30–33 (
load_seedhelper):with tempfile.NamedTemporaryFile(mode="w", suffix=".json") as seed:…return packer.load_weights(seed.name, …)inside thewithblock. - Lines 62–65, 86–89, and 97–100: the same open-while-reopening pattern in three more tests.
- Lines 122–139 (CLI test):
with tempfile.NamedTemporaryFile(mode="w+", suffix=".out") as output:is passed as--github-outputto a subprocess and then read/seeked while still open.
Acceptance criteria
- No test in
test_e2e_shard_packer.pyreopens (directly or via subprocess) a path whoseNamedTemporaryFileis still open: write-close-read via a temp directory/path, ordelete=False+ explicit close with cleanup, at all five sites (including the CLI output file). - The shard-packer test suite still passes.
- Resolving by a documented decision on this issue is also acceptable.
Filed by the pr-comment-review job (run 2026-11-09 19:54 CST) under the queue cutover: labels applied at filing, standard agent note posted after filing, and a repo-task/v1 triage packet (kind: triage, priority 30) enqueued on repo-health-code-pilot.
Activity
developing-today commentedon Nov 10, 2026
CODE-2400
dezren39 commentedon Nov 10, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 10, 2026
🤖 Agent note · handed off
opencodedezren39 commentedon Nov 10, 2026
🤖 Agent note · done (triaged)
triage; issue mcpx e2e shard-packer tests keep NamedTemporaryFile open while reopening its path — fails on Windows (PR #7897 review finding) #8096 carries nostatus/needs-triage.triaged— bookkeeping only. Gap recorded honestly: no dedicated triage-step agent note was found on this issue; the nearest record is the pr-comment-review job'sfiledagent note (2026-11-10T02:04:41Z) that created this packet from the unaddressed PR mcpx(ci): guard malformed e2e timing seeds #7897 review finding. Issue mcpx e2e shard-packer tests keep NamedTemporaryFile open while reopening its path — fails on Windows (PR #7897 review finding) #8096 remains OPEN for the fix work (mcpx e2e shard-packer NamedTemporaryFile Windows failure).test(mcpx): close temp files before reopening their paths in shard-pa…
dezren39 commentedon Nov 10, 2026
🤖 Agent note · done — Agent: queue worker (repo-worker-code), lane code-j — Session/ID: task 14489, repo-queue-worker-shift-j 2026-11-09 run. Task 14489 (small_fix, direct lane) fixed issue #8096: all five sites in pkgs/mcpx/scripts/tests/test_e2e_shard_packer.py that reopened a path whose NamedTemporaryFile was still open now use write-close-read (shared write_seed helper with delete=False + addCleanup unlink for the four seed sites; the CLI test closes its output file before the subprocess opens it by path and reads it back after). Landed as commit ca91de1 on PR #7897's branch queue/11046-6822-e2e-seed-shape-guards (the file exists only on that branch; PR head verified fresh at ca91de1 after push). Oracle: python3 -m unittest discover -s pkgs/mcpx/scripts/tests -p 'test_e2e_shard_packer.py' on the laptop — 6/6 tests pass. Per packet scope, the source PR review thread was not replied to or resolved (pr-comment-review job rules). Issue stays open until PR #7897 merges.
dezren39 commentedon Nov 17, 2026
agent-note:v1
Agent: repo-worker-code / any-f
state: done (triaged — already fixed, closing) (task 18586, lane any-f)
issue: #8096
Verdict: the Windows temp-file finding is fixed on main — closing as completed
Bulk-intake re-triage (2026-11-16 reload), verified fresh 2026-11-17:
pkgs/mcpx/scripts/tests/test_e2e_shard_packer.py, all five cited call sites now funnel through the write-close-read pattern Copilot prescribed:write_seed()usesNamedTemporaryFile(delete=False)inside awithblock — the file is closed beforeload_weights()reopens its path — withaddCleanup(os.unlink, path)and a comment naming the Windows constraint.TemporaryDirectorywith cleanup.No
NamedTemporaryFileis kept open across a reopen anywhere in the file.python3 -m unittest discover -s pkgs/mcpx/scripts/tests -p 'test_e2e_shard_packer.py'— 15 tests, OK.The tracking issue was simply never closed after the fix landed.