You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EN summary — With mode: attach, the exclusive browser reservation is bound to the owning Agent's lifetime, which in the web profile is effectively the DSH process. The first Session created/resumed after process start keeps the browser forever; every later Session silently loses the browser tools (no error, no warning, no retry), and there is no unload/idle path that ever releases the reservation.
这与文档描述一致(“A busy attachment leaves that activation without browser tools; its other turns continue”),问题不在独占本身,而在独占窗口(≈进程生命周期)远大于资源的使用窗口(秒/分钟级),且既没有回收路径也没有任何可见提示。
环境
DSH 0.1.7-rc.2(本地 checkout,pnpm dsh web 前台运行,web profile)
packages/experimental/browser-use-runtime/src/index.ts:155 → if (this.options.exclusive && this.entries.size > 0) throw new Error(\${label}: attached browser is already reserved by another Session`)`
可释放 / 可转移:补一条显式释放路径——例如卸载会话(session/close)时释放,或提供“释放/抢占”入口。决策记录里“After release, a newly created or resumed activation can acquire it”的语义已经存在,缺的只是触发释放的手段。
空闲回收:把保留绑定到“最近使用”而不是 Agent 生命周期(类似终端侧 unattendedTimeoutMs),无活动 N 分钟后自动释放,让下一个 create/resume 的会话拿到。
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
现象
用
mode: attach附加到本机已登录 Chrome 时,独占保留(exclusive reservation)永远不会被归还:mcp__chrome-devtools-mcp__*,也没有任何 error/warning/重试;这与文档描述一致(“A busy attachment leaves that activation without browser tools; its other turns continue”),问题不在独占本身,而在独占窗口(≈进程生命周期)远大于资源的使用窗口(秒/分钟级),且既没有回收路径也没有任何可见提示。
环境
0.1.7-rc.2(本地 checkout,pnpm dsh web前台运行,webprofile)@deepseek-ai/dsh-browser-use与@deepseek-ai/dsh-experimental-browser-use-chrome-devtools-mcp,mode: attach,endpoint: ws://127.0.0.1:9222/devtools/browser(附加到本机已有的、已登录 Chrome)复现
dsh web(进程 P0)。mcp__chrome-devtools-mcp__*;宿主进程随即 fork 出chrome-devtools-mcp子进程。本机实测(同一进程内):
lsof -p <dsh-pid> \| grep session.lock显示 8 个会话同时是“活的”(跨 5 个 cwd),最早的锁是 21 小时前——没有任何一次卸载;chrome-devtools-mcp子进程已存活 21.5 小时;它在该会话全部 5442 条事件里 0 次tool/call调用浏览器工具(工具名只出现在request/header的工具目录里),即纯粹因为“开得早”而占位;期望行为
空闲或不再使用的会话应能释放保留(或允许用户显式指定/抢占/释放);当某个会话因保留被占用而拿不到浏览器工具时,应当可见(提示或日志),而不是静默降级。
定位
packages/experimental/browser-use-chrome-devtools-mcp/src/index.ts:37→exclusive: config.mode === 'attach'packages/experimental/browser-use-runtime/src/index.ts:155→if (this.options.exclusive && this.entries.size > 0) throw new Error(\${label}: attached browser is already reserved by another Session`)`BrowserMcpAttachConfig(packages/experimental/browser-use-runtime/src/mcp.ts:23-32)只接受mode/endpoint/toolCallTimeoutMs,没有关闭独占的字段。packages/experimental/browser-use-runtime/src/index.ts:158(agent.ctx.effect(...)→closeEntry)。所以只有 Agent 被销毁才会归还。packages/core/agent/src/index.ts:434("owner unload, unregistering the agent (and emittingagent/disposed)")。在上面那次实测里,21 小时内没有任何一个会话被卸载。session/*RPC 只有create / fork / list / page / prompt / cancel / updateQueue / rename / attachment / projections / control / follow / modelCatalog / initializeDefaultModel / openWorkspacePath / canOpenWorkspacePath / search / selectModel / workspacePathApplications——没有close/unload/delete(packages/api/session-controller)。客户端Session.dispose()(packages/api/session-controller/src/client/sessions/session.ts:599)只停本地的 Remote 迭代器,不通知 host。packages/api/terminal-controller/src/retention.ts,unattendedTimeoutMs),Agent 侧没有 LRU/超时。packages/experimental/browser-use-runtime/src/mcp.ts:178用resources.available(agent)判定,blocked 时只clients.set(...)+refreshBlockedMasks()后return(既不建 MCP 客户端,也不记日志);:214在system-prompt/assemble中把mcp:<name>section 过滤掉。补充观察:该保留只作用于单个 provider 实例(单个 DSH 进程)。决策记录也写明“附加保留机制作用于单个提供方实例;它不协调独立 DSH 进程或外部浏览器客户端”。所以另起一个 DSH 进程能附加到同一个 Chrome 并正常工作——即这是 DSH 进程内的协作策略,而非 CDP 的限制。
影响
在“一个 web 宿主里长期开多个会话/多个 cwd”的用法下,只要开过第二个会话,除第一个之外的所有会话在整个进程生命周期内都拿不到浏览器工具,而且用户看不到任何原因。对本机已登录 Chrome 这类必须 attach 的场景(
mode: launch会走--isolated,拿不到登录态),等于该能力大部分时间不可用。建议的最小修法
不改独占语义也能解决其中大部分问题,按成本从低到高:
logger.warn一次,说明浏览器已被哪个 Session 保留、如何释放。目前是完全静默的。session/close)时释放,或提供“释放/抢占”入口。决策记录里“After release, a newly created or resumed activation can acquire it”的语义已经存在,缺的只是触发释放的手段。unattendedTimeoutMs),无活动 N 分钟后自动释放,让下一个 create/resume 的会话拿到。如果维护者认为 attach 必须始终独占,那么第 1 条成本最低、收益最直接。
备注(判定方法)
mcp__chrome-devtools-mcp__*,以及宿主进程是否 fork 了chrome-devtools-mcp子进程(ps -o ppid= -p <mcp-pid>)。lsof -p <dsh-pid> | grep session.lock。tool/call事件(本机按~/.dsh/sessions/<project>/<session>/session.v4.jsonl.zstd,多帧 zstd,需逐帧解压)。All reactions