Skip to content

fix(mcp): fall back for filenames in unsuitable workspaces - #44155

Merged
Devin Rousso (dcrousso) merged 2 commits into
mainfrom
fix-44138-43960297452-1
Nov 18, 2026
Merged

Devin Rousso (dcrousso) merged 2 commits into
mainfrom
fix-44138-43960297452-1

Conversation

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

Explicit relative output filenames bypass the unsuitable-workspace fallback used for automatically named files. Use the same directory suitability check for both, while preserving absolute filenames and input-file resolution.

Check Windows directory writability by creating an exclusive temporary file: fs.accessSync(W_OK) does not check Windows ACLs.

Fixes #44138

Triaged on Windows by the Playwright bot - agent run

@github-actions

This comment has been minimized.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor Author

🟢 All three failures are pre-existing, not caused by this PR

Hi, I'm the Playwright bot. I checked the failed MCP run against the PR's exact parent on main.

Details and evidence

This verdict covers MCP run 43963281875 at cadae710371c2fe0a3153151b14d5cf0a04848ac.

Pre-existing flake / infra

All three [chrome] failures in tests/mcp/crash.spec.ts also occur in the same Ubuntu/Chrome job on main, at 826ce42b8664ea940424e77ce51f1cdf96dcd37f, the PR's exact parent:

  • :31 — reports the navigation error, then resets and logs the crash: 30-second timeout in the recovery check at line 48, on both commits.
  • :58 — lists only one tab: 30-second timeout and Not connected at the browser_tabs call on line 71, on both commits.
  • :79 — marks non-current crashed tab in the tab list: 30-second timeout and Not connected at the browser_tabs call on line 93, on both commits.

The PR changes output filename handling and Windows directory permission checks, not crash recovery. The Linux writability check remains unchanged. The matching failures on the parent establish that these failures predate this PR; they do not establish whether the underlying problem is intermittent or persistent.

Checked the failures on Linux by the Playwright bot - agent run

@github-actions

This comment has been minimized.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor Author

🟢 All three failures predate this PR

Hi, I'm the Playwright bot. I compared the failed tests with the PR's exact parent on main; this PR did not cause them.

Details and evidence

This verdict covers tests 1 run 43963281877 at cadae710371c2fe0a3153151b14d5cf0a04848ac. All three failures also occur at its parent, 826ce42b8664ea940424e77ce51f1cdf96dcd37f, on the same platforms.

Pre-existing flake / infra

  • Windows JUnit — reporter-junit.spec.ts:350, created and merged: both fail at line 374 because classname is auth\a.test.js, but the test expects auth/a.test.js. The parent's Windows job has both identical failures. A small test correction is to expect path.join('auth', 'a.test.js') for classname, preserving its existing platform-specific format; keep the / expectations for the explicitly normalized file attribute.
  • Linux Chromium — library/video.spec.ts:762, VI-030 should work with video+trace: no screencast-frame event is found, so frame.file throws at line 790, including on retries. The parent's Chromium job has the same error.

The PR changes MCP output filename resolution and directory writability checks. Neither failing test uses the changed MCP output path; the renamed writability helper has no callers outside that path. These comparisons prove the failures predate the PR, not that they are intermittent. The MCP failures already have a separate verdict above.

Checked the failures on Linux by the Playwright bot - agent run

@dcrousso
Devin Rousso (dcrousso) marked this pull request as ready for review November 17, 2026 18:30
if (process.platform === 'win32') {
// fs.accessSync does not check Windows ACLs.
const probe = path.join(dir, `.playwright-write-test-${createGuid()}`);
fs.writeFileSync(probe, '', { flag: 'wx' });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isWritableDirectory now creates and deletes a probe file on every outputDir() call, i.e. on every output file and every checkFile when --output-dir is not set. That is a sync write + unlink in the user's project dir per tool call, visible to file watchers, AV and OneDrive.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cached directory suitability per session and workspace, shared by automatic and explicit output paths. Repeated outputDir() and checkFile() calls no longer create probe files; a new session checks again.

Revised on Windows by the Playwright bot - agent run

Comment thread tests/mcp/file-paths.spec.ts Outdated
const cwd = testInfo.outputPath('readonly');
const outputDir = testInfo.outputPath('output');
await fs.promises.mkdir(cwd);
execFileSync('icacls', [cwd, '/deny', '*S-1-1-0:(WD,AD)']);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A chmod 555 variant would cover the response.ts change on POSIX too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extended the existing test to use chmod 0555 on POSIX while retaining the Windows ACL case. The POSIX branch could not be run on this Windows runner.

Revised on Windows by the Playwright bot - agent run

@microsoft-playwright-automation

This comment has been minimized.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor Author

Hi, I'm the Playwright bot. I addressed both review comments.

Directory suitability is now cached per session and workspace, so repeated output and file checks do not create more probe files. The existing permission regression now uses chmod 0555 on POSIX and directory ACLs on Windows.

Build and npm run flint passed. The changed and nearby tests passed across Chrome, Chromium, Firefox, WebKit and Edge: 152 passed, 358 expected skips. Both regressions fail without their fixes and pass with them. Permission-sensitive checks used a child process with backup and restore privileges disabled. The POSIX branch could not be run on this Windows runner.

Revised on Windows by the Playwright bot - agent run

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

3 failed
❌ [chrome] › mcp/crash.spec.ts:31 › crash recovery › reports the navigation error, then resets and logs the crash @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/crash.spec.ts:58 › crash recovery › lists only one tab @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/crash.spec.ts:79 › crash recovery › marks non-current crashed tab in the tab list @mcp-ubuntu-latest-chrome

5243 passed, 641 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 failed
❌ [playwright-test] › reporter-junit.spec.ts:350 › created › should add file attribute relative to fileRoot @playwright-x64-server2025-64-core-node22
❌ [playwright-test] › reporter-junit.spec.ts:350 › merged › should add file attribute relative to fileRoot @playwright-x64-server2025-64-core-node22

23642 passed, 716 skipped


Merge workflow run.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor Author

🟢 All five failures are pre-existing, not caused by this PR

Hi, I'm the Playwright bot. I checked the MCP failures and the newer tests 1 report for the same head.

Details and evidence

This verdict covers MCP run 44378085082 and tests 1 run 44378084978, both at ea496f2a015b96b542fcd0bfab918b80ec8358f6.

The PR changes MCP output filename resolution, caches directory suitability checks, and adds a Windows writability probe. It does not change crash recovery or the JUnit reporter; the underlying Linux writability check is unchanged.

Pre-existing flake / infra

  • Ubuntu/Chrome crash recovery — mcp/crash.spec.ts:31, :58, :79: all three tests also fail in the independent MCP report on #44219, from run 44373341421. That PR changes only the review workflow trigger and contains none of this PR's changes. This covers “reports the navigation error, then resets and logs the crash,” “lists only one tab,” and “marks non-current crashed tab in the tab list.”
  • Windows JUnit — reporter-junit.spec.ts:350, created and merged: both also fail in the independent tests 1 report on #44219, from run 44373341403. The assertion at line 374 hard-codes auth/a.test.js for classname, which keeps platform separators. The small test correction is expect(byDefault['classname']).toBe(path.join('auth', 'a.test.js')); keep the / expectations for the explicitly normalized file attribute.

These reports establish that the same tests fail without this PR, not that they are intermittent. The history database and raw job logs were unavailable, so this comparison uses the published test reports and source code.

Checked the failures on Linux by the Playwright bot - agent run

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor Author

🟢 Both failures predate this PR

Hi, I'm the Playwright bot. I checked the failed tests 1 run against the Windows logs on main; this PR did not cause either failure.

Details and evidence

This verdict covers run 44378084978 at ea496f2a015b96b542fcd0bfab918b80ec8358f6. The PR changes MCP output paths and directory suitability checks, not the JUnit reporter or its tests.

Pre-existing flake / infra

  • Windows JUnit — reporter-junit.spec.ts:350, created and merged, “should add file attribute relative to fileRoot”: both fail at line 374 because classname is auth\a.test.js, but the assertion expects auth/a.test.js. Both have the identical error in the Windows job on main, at bfc459c18e032e664120c960294cd0de4f3a19a2. This is a pre-existing platform-specific assertion error, not evidence of an intermittent flake.

The small test correction is expect(byDefault['classname']).toBe(path.join('auth', 'a.test.js')). Keep the / expectations for file: the reporter explicitly normalizes that attribute, but preserves platform separators in classname.

Checked the failures on Linux by the Playwright bot - agent run

@dcrousso
Devin Rousso (dcrousso) merged commit 0116d08 into main Nov 18, 2026
31 of 33 checks passed
@dcrousso
Devin Rousso (dcrousso) deleted the fix-44138-43960297452-1 branch November 18, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MCP]: explicit filename fails with EPERM when the server cwd is C:\Windows\System32 (no fallback as in #40544)

2 participants