Repository navigation
fix(browser): 修复 DSH 0.2.2 下 browser_read 和 browser_act 一律失败 - #367
Merged
Merged
Conversation
…0.2.2 tool pipeline Since the upgrade to DSH 0.2.2 (ECNU#276), ctx.tools.execute takes only a model batch ({ calls, signal, agent, toolSet }). The runner behind browser_read and browser_act still passed one call ({ callId, name, arguments, parent }), so every page read or action in the desktop app failed with "Tool batch execution failed". The plugin's test replaced ctx.tools.execute with a hand-written stand-in and was not in CI, so it kept passing. The runner now prepares, dispatches and completes each Playwright MCP call through ToolExecutionPipeline, as DSH's program tool calls do (tool-executor-ptc): under the run's root call, Agent, step tool set, signal and token as parent, so the browser permission still lets the run's own calls through without asking again. Context that hooks add to those calls is deferred to the run's result, and a call that concludes the turn concludes it. read-act.test.mjs now runs the tools in DSH's real registry, executor and pipeline from the pinned Runtime, with only Playwright MCP's tools as stand-ins, and installs the plugin's guard, permission and screenshot note as its apply does. It checks each MCP call's place in the run's call tree, one approval per run, a rejected run not running, step admission, stopping a run, and hook context reaching the batch. CI runs it next to the Sidebar launch test.
This was referenced Nov 26, 2026
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.
问题
桌面版里,Agent 调用
browser_read、browser_act时一律返回 “Error: Tool batch execution failed”,网页既读不到,也没法操作。根因:#250 合入时 DSH 还是 0.2.1,它的 runner 用
ctx.tools.execute({ callId, name, arguments, agent, parent, signal })逐个派发 Playwright MCP 调用。同一天 #276 把 DSH 升级到 0.2.2,之后ctx.tools.execute只接受模型批次{ calls, signal, agent, toolSet },但 runner 没有跟着改。执行器读取calls.map时抛出 TypeError,再被包装成上面的错误。插件测试用的是手写的ctx.tools.execute替身,read-act.test.mjs也不在 CI 里,所以一直没有发现。修改
@deepseek-ai/dsh-tools/pipeline的ToolExecutionPipeline,对每个调用依次执行 prepare、dispatch、complete。DSH 自己的 tool-executor-ptc 派发程序化调用也是这样做的。测试
read-act.test.mjs改为在锁定 Runtime 的真实 DSH 注册表、native 执行器和 pipeline 里运行,只有 Playwright MCP 的工具是替身。测试像插件的apply一样装上 guard、权限和截图说明。新增的检查:validate-pinned-dsh-source.yml的侧栏浏览器那一步,在sidebar.test.mjs之外加跑read-act.test.mjs。这一步已经设置了EDUWORK_TEST_RUNTIME。source-receipt.json:这个测试文件原有一条合成内网地址的审查记录,只更新了其中的哈希。验证
read-act.test.mjs13/13 通过;按 CI 的写法跑 17/17 通过;plugin-locale.test.mjs5/5 通过,permission.test.mjs3/3 通过。browser_read返回带编号的网页;browser_act先输入文字再点链接,返回新网页;