Browser Use: mounting it makes session creation fail with a misleading 'initial connection or tool synchronization failed' — is this the #3984/#4025 serverName scope issue? #6722
Replies: 1 comment
|
Short version: your chain checks out on master up to the last link, with two corrections — the reservation is no longer process-global for this mount, and the thrown error now carries the real cause even though the message text still hides it. Verified against master (0.1.6-alpha.1), current paths:
Where I'd push back on your own analysis:
Your workaround (disable the two Browser Use rows) is sound and is effectively the only option while the per-session mount is hardcoded. The cross-links are apt: #3984 is the lifecycle-leak report, #4025 the scope-mismatch analysis, and this is the same I haven't reproduced the intermittent failure locally (not verified) — if you can capture the |
Uh oh!
There was an error while loading. Please reload this page.
Browser Use: multi-session
serverNamecollision rejects session creation with a misleading errorComponent:
@deepseek-ai/dsh-experimental-browser-use-playwright-mcp(+dsh-experimental-browser-use-runtime,dsh-browser-use)Version:
0.1.6-alpha.1DSH:
0.1.6-alpha.1Platform: macOS 26.6.2 (Darwin arm64), Node v24.18.0
Severity: blocks session creation entirely once triggered
Summary
After mounting Browser Use (Playwright MCP backend) and restarting
dsh web, creating or resuming any session fails across all workspaces:The error text points at connection, but the actual failure is a
serverNameuniqueness collision indsh-mcp-client's process-wide reservation table. Because Browser Use mounts one MCP client per live Session (all under the fixed nameplaywright-mcp) withfailOnStartupError: true, any overlap between two Sessions' registration windows tears down session creation.Once Browser Use is disabled, session creation recovers immediately.
Environment / config that triggers it
Profile uses
patchReload: live. Another, unrelated MCP server (serverName: dbx) is mounted in the same profile and never fails.Observed symptoms
{"type":"session","version":3,"id":"session-...","cwd":"...","agentPreset":"standard"} {"type":"permission/preset","seq":0,"data":{"preset":"workspace-write"}} {"type":"sandbox/mode","seq":1,"data":{"mode":"workspace-write"}} {"type":"approval/policy","seq":2,"data":{"policy":"ask"}}Root-cause chain (traced in source)
1.
dsh-mcp-clientreservesserverNameprocess-wide, with actx.rootfallbackpackages/mcp/mcp-client/src/index.ts(apply):2. Browser Use mounts one MCP client per live Session, all with the same fixed name
packages/experimental/browser-use-runtime/src/mcp.ts(mountSessionMcp), insideSessionResources.open(agent, signal):and the provider passes the constant name (
browser-use-playwright-mcp/src/index.ts):3.
failOnStartupError: truemakes the collision fatal, then wraps it in a misleading messagedsh-mcp-client:4. Browser Use mounts during the serial, blocking
agent/createdeventmountSessionMcp:Because
agent/createdis serial and awaited, a throw here prevents session creation from ever completing — which is exactly the 3-line stub logs above.Why only Browser Use breaks
serverNamereservation is process-global while the tool registry it feeds is per-agent scoped. Two live Sessions legitimately wanting the same MCP server collide on the name check even when teardown is perfect and instantaneous. Ordinary MCP servers (dbxhere) survive because they use the defaultfailOnStartupError: false, which contains the failure instead of throwing.This matches the analysis already on file in #3984 / #4025 (scope mismatch:
activeServerNameskeyed onctx.rootvs per-agent tool visibility), except the Browser Use path escalates the collision into a hard session-creation failure.Evidence that the MCP server itself is healthy
The failure is not in the Playwright MCP process. All of the following succeeded while Browser Use was mounted and failing:
scrubbedParentEnv()+StdioClientTransport:OK cwd=/Users/lee/LeeProject/space tools=24 148mscwdvalues (including non-ASCII paths):all
OK, 24 tools each, ~380 msOKcwd: allOKinitializereturnsprotocolVersion 2025-06-18; tool list = 24 toolsRuled out as causes:
executablePathvalue, working directory, non-ASCII paths, memory pressure (71 % free), git presence, Chrome singleton lock, concurrent MCP spawn count.Suggested direction
Any one of these would prevent a recoverable condition from killing session creation:
serverNameuniqueness to the registering agent scope rather thanctx.root, matching where the tools actually live — or, if per-process uniqueness is intentional (double-spawn protection), make the error message say so and document the concurrent-Session restriction explicitly.agent/created— a failed browser mount should leave that Session without browser tools (the documentedblockedbehavior inSessionResources) instead of rejecting creation.causein the surfaced error. The wrapper message names "connection or tool synchronization", which sends diagnosis down the wrong path; the actual cause was a registration collision.Note: simply deleting the reservation before checking (as floated in #3984) would make two instances share one
serverNamesilently; #4025 already argues that is worse than the deterministic error.Workaround
Disabling the two Browser Use rows restores session creation immediately. Because
--isolatedis hard-coded in thelaunchbranch,launchcannot persist a profile, so there is no config-level way to avoid the per-Session mount short of not using the provider.Below is the machine-translated Chinese version. 以下为中文版。
Browser Use:多会话
serverName冲突导致会话创建被拒,且报错信息误导组件:
@deepseek-ai/dsh-experimental-browser-use-playwright-mcp(含dsh-experimental-browser-use-runtime、dsh-browser-use)版本:
0.1.6-alpha.1DSH:
0.1.6-alpha.1平台: macOS 26.6.2(Darwin arm64),Node v24.18.0
严重程度: 一旦触发,会话创建被完全阻断
概述
挂载 Browser Use(Playwright MCP 后端)并重启
dsh web后,所有工作区的新建与恢复会话全部失败:报错文字指向「连接」,但真实原因是
dsh-mcp-client进程级serverName保留表中的唯一性冲突。由于 Browser Use 为每个活动会话挂载一个 MCP 客户端(名字固定为playwright-mcp),并设置failOnStartupError: true,任意两个会话的注册窗口重叠,就会让会话创建失败。停用 Browser Use 后,会话创建立即恢复。
触发配置
Profile 使用
patchReload: live。同一 profile 内另一个无关的 MCP 服务器(serverName: dbx)从不失败。观察到的现象
根因链条(源码追溯)
dsh-mcp-client以进程级方式保留serverName,并回退到ctx.root:const owner = scopeOf(ctx) ?? ctx.root,随后若名字已存在即抛错。serverName: options.name(提供方传常量'playwright-mcp'),同时failOnStartupError: true、reconnect: { enabled: false }。failOnStartupError: true把冲突升级为致命:mcp-client 默认registrationFailure: 'contain',Browser Use 路径改为'throw';最终包装成mcp-client(...): initial connection or tool synchronization failed。agent/created中挂载({ prepend: true }且await resources.get(...)),因此抛错会让会话创建永远无法完成——这正是那 3 行空壳日志的成因。为什么只有 Browser Use 会坏
serverName保留是进程全局的,而它服务的工具注册表是按 agent 作用域的。两个活动会话合法地想挂载同一个 MCP 服务器时,即使 teardown 完美且即时,也会在名字检查上冲突。普通 MCP 服务器(此处的dbx)因为使用默认的failOnStartupError: false而把失败包容掉,所以不受影响。这与 #3984 / #4025 中已有的分析一致(
activeServerNames以ctx.root为 key 与 per-agent 工具可见性之间的作用域不匹配),差别在于 Browser Use 路径把这个冲突升级成了硬性的会话创建失败。MCP 服务器本身健康的证据
故障不在 Playwright MCP 进程内。在 Browser Use 已挂载且正在失败期间,以下全部成功:
scrubbedParentEnv()+StdioClientTransport启动同一命令:OK ... tools=24 148mscwd(含非 ASCII 路径)并发 10 个实例:全部 OK,各 24 工具,约 380 mscwd下手动运行:全部 OKinitialize返回protocolVersion 2025-06-18;工具数 24已排除:
executablePath取值、工作目录、非 ASCII 路径、内存压力(71% 空闲)、git 存在性、Chrome 单例锁、并发 MCP 启动数量。建议方向
serverName唯一性收窄到注册的 agent 作用域,与工具实际所在的作用域一致;若进程级唯一性是刻意设计(防重复拉起),请在报错与文档中明确说明该并发限制。agent/created致命——浏览器挂载失败应让该会话没有浏览器工具(即SessionResources中已有的blocked行为),而不是拒绝会话创建。cause。当前包装信息说「连接或工具同步」,把排查引向错误方向;实际原因是注册冲突。注:像 #3984 中设想的「先删再查」会让两个实例静默共用同一个
serverName;#4025 已论证这比确定性报错更糟。规避方式
停用这两行 Browser Use 配置即可立即恢复会话创建。由于
launch分支中--isolated是硬编码的,launch无法持久化 profile,因此在配置层面除了不使用该提供方之外,没有其他办法避免 per-session 挂载。All reactions