Repository navigation
Conversation
… check on Windows The MCP gate answers a blocked call before it writes the log row, on purpose (#80): the row is built outside the write's try, so a throw there must not stop the deny. The test read the file as soon as the answer arrived and, on the CI runners, read it before the row was written. It now polls for the row. Windows has no POSIX file modes: the log file reads 0o666 there, so the 0o600 check runs only off Windows, as in the other tests that check a mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Two test lines from #80, which fail on the CI runners:
server/mcp-gate.test.ts:445now waits for the second log row withexpect.pollinstead of reading the file once.server/tool-guardrail-log.test.ts:28checks the0o600file mode only off Windows, like the other tests that check a mode (server/attachments.test.ts:171,server/admin-activity.test.ts:192).No product code changes. The branch name says "record before reply"; that was the first idea, and it was dropped (see Why).
Why
Since #79/#80 were merged,
mainrun 46787163030 (b5b7b4b) fails two files that passed before:mcp-gate.test.ts› lets a log-mode rule's call through …expected [ { …(6) } ] to match object [ { blockedBy: null }, …(1) ]: one row where two were expectedtool-guardrail-log.test.ts› appends one row per observed rule …expected 438 to be 384: the file reads0o666on Windowsmcp-gate. For a blocked call, the gate answers first and writes the row after (
server/mcp-gate.ts:360-362). That order is deliberate (#80: "The deny is printed before any row is written"): the row is built outside the write'stry(server/tool-guardrail-log.ts:52-66, including the secret masking), so a throw there must never stop the deny. The test read the file as soon as the answer arrived. The gate is another process, so on a slow runner the test can read before the row is written. The product behaves as designed; the test assumed an order the gate does not promise. Writing the row first would make the test pass by weakening that guarantee, so the test waits for the row instead.tool-guardrail-log. Windows has no POSIX modes;
mode: 0o600cannot hold there.How it was verified
Branch from
main8c67e9d, macOS, Node 24.22.1 (the CI version).To make the CI race happen every time locally without touching source, a preload delays only writes to paths containing
guardrail-logby 200 ms (fs.appendFileSyncwrapped, thensyncBuiltinESMExports()), passed asNODE_OPTIONS=--import=<preload>. The gate child inheritsprocess.env(server/mcp-gate.test.ts:91), so the delay applies inside the gate.Before shows the CI assertion with the delayed write; after shows the test passing with the same delay.
main8c67e9d)vitest run server/mcp-gate.test.ts -t "log-mode"FAIL … expected [ { …(6) } ] to match object [ { blockedBy: null }, …(1) ], the CI errorTests 1 passedvitest run server/mcp-gate.test.ts server/tool-guardrail-log.test.ts, with and without the delayTest Files 2 passed (2),Tests 49 passed (49)both waysoxlinton both files exits 0.Not covered
mainrun 46787163030 but not in fix(testing): stop the threads preview importing the removed Boat notice #81's pull request run 46788880591, so the first Windows run of this change will be after merge.mainCI failures have separate causes and are handled in separate PRs.Checklist
pnpm typecheckandpnpm testpass locally: not run in full; the two touched test files pass.dist-server/edits