Skip to content

fix(mcp): resolve config file paths relative to their source - #43970

Merged
Pavel Feldman (pavelfeldman) merged 1 commit into
mainfrom
triage/playwright-mcp-1836/42251585386-1
Nov 7, 2026
Merged

Pavel Feldman (pavelfeldman) merged 1 commit into
mainfrom
triage/playwright-mcp-1836/42251585386-1

Conversation

@microsoft-playwright-automation

@microsoft-playwright-automation microsoft-playwright-automation Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Resolve file paths before merging each config source: paths in an explicit --config file use the config directory, while CLI and environment paths use cwd. Previously only initPage and initScript received this treatment, so storage-state loading and artifact placement depended on where the server started.

Apply the same rule to profile, launch, storage-state, HAR, video and certificate paths. Absolute paths and inline storage-state objects keep their meaning. A symlinked --config resolves next to the real file.

The same rule applies to the CLI's discovered .playwright/cli.config.json and the global ~/.playwright/cli.config.json: relative paths in them now resolve against the file's directory rather than cwd. That is a behavior change for relative paths in those files, which previously resolved against cwd as a side effect of not being resolved at all.

Also in this change:

  • Extension mode uses the merged executablePath, so a config-file value is honored there too.
  • config.d.ts documents the resolution rule on each path option.

Tests: the MCP config user data dir test checks that a relative outputDir and userDataDir land next to the config file and that the snapshot and screenshot files are written there. A new config storage state test applies a relative storage state in isolated mode and asserts the resulting page state. Config-resolution unit tests cover the per-source rule for MCP and CLI resolvers, the global config, inline storage state and a symlinked config. A CLI test checks the discovered project config via config-print. The new tests fail without the fix.

Fixes microsoft/playwright-mcp#1836

Triaged on Linux by the Playwright bot - agent run

@github-actions

This comment has been minimized.

@pavelfeldman
Pavel Feldman (pavelfeldman) marked this pull request as ready for review November 6, 2026 22:54
@pavelfeldman
Pavel Feldman (pavelfeldman) force-pushed the triage/playwright-mcp-1836/42251585386-1 branch 2 times, most recently from 0844a79 to 7c49b4d Compare November 6, 2026 23:54
Resolve file paths before merging each config source: paths in an explicit
--config file use the config directory, while CLI and environment paths use
cwd. Previously only initPage and initScript received this treatment, so
storage-state loading and artifact placement depended on where the server
started.

Apply the same rule to profile, launch, storage-state, HAR, video and
certificate paths. Absolute paths and inline storage-state objects keep
their meaning. A symlinked --config resolves next to the real file.

The same rule applies to the CLI's discovered `.playwright/cli.config.json`
and the global `~/.playwright/cli.config.json`: relative paths in them now
resolve against the file's directory rather than cwd.

Use the merged executablePath in extension mode so a config-file value is
honored there.

Fixes: microsoft/playwright-mcp#1836
@pavelfeldman
Pavel Feldman (pavelfeldman) force-pushed the triage/playwright-mcp-1836/42251585386-1 branch from 7c49b4d to e31cdff Compare November 7, 2026 00:04
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

5222 passed, 637 skipped


Merge workflow run.

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.

Relative paths in a --config file are resolved against the process cwd, not the config file (outputDir, storageState, ...)

2 participants