# v0.39.0 route B:自有 bash 工具在所有 agent 上激活失败——私有执行器挂载触发 cordis `shell` 服务冲突 ## 环境 - dsh `0.2.0-rc.2`,web profile,Windows(win32) - dsh-gitbash-shell `0.39.0`(经 `dsh plugin --profile web add dsh-gitbash-shell` 安装,bundle 栈含 `dsh-gitbash-shell`) - 官方四个 preset(会话默认 cordis),`variantPresets: true`、`pwshTool: true`(行 Config 持久值) ## 现象 0.39.0 升级重启后,**所有新建会话/子代理的工具面都是「有 pwsh、无 bash」**。服务器控制台每个 agent 打印一条: ``` [gitbash-shell] own bash tool activation failed for this agent: service "shell" has been registered at <SandboxPwshExecutor> ``` 同一 reconcile 里 pwsh 隐藏/显示开关工作正常(`pwshTool` 开启后官方 pwsh 工具出现且实测可执行 `$PSVersionTable`),gb_* FastCtx 四件套、MSYS 路径方言、终端接管、状态路由全部正常——**唯独自有 bash 工具从未注册**。 ## 复现 官方任一 preset 新建会话即触发,确定性复现,每个 agent 一条失败日志。 ## 根因分析(源码级) `src/inline-tools.js` 的 `bashOncePromise()` 在 `createScope(ctx)` 建立的 scope 内以 cordis class plugin 挂载 `GitBashSandboxExecutor`(`executorScope.ctx.plugin(GitBashSandboxExecutor)`)。该类继承 `@deepseek-ai/dsh-bash-sandbox` 的 `SandboxBashExecutor`(LocalBashExecutor 系),基类自带 **`shell` 服务注册**——挂载即与根上下文中已由官方 `SandboxPwshExecutor` 注册的 `shell` 服务冲突,cordis 抛出: ``` service "shell" has been registered at <SandboxPwshExecutor> ``` 异常被 `provideBash` 的 catch 吞掉(仅日志一行),bash 工具未能注册。 route B 的自述语义是私有执行器「**永不注册为 `ctx.shell` 服务**」(dsh.plugin.json / shell.js 头注释),但基类的服务注册声明使这一前提在挂载时即被打破——route B 又恰好**保留**官方 PowerShell 执行器,冲突因此必然发生。 **0.38.5 不受影响的对照**:旧架构 patch 替换执行器行(禁用 `pwsh-sandbox`、插入 `gitbash-executor`),`shell` 槽只有一家,无冲突。本次真机回退 0.38.5 后 bash 工具立即恢复(见下)。 ## 静态组装树佐证(`dsh --profile web --dump-config`) 组装层完全正常,问题纯运行时: ```yaml # == dsh-gitbash-shell, patched by <profile>\cordis.patch.yml - id: gitbash-shell name: dsh-gitbash-shell config: variantPresets: true pwshTool: true ``` ## 回退验证(0.38.5) `dsh plugin --profile web add dsh-gitbash-shell@0.38.5` + 重启后,新建会话: - `bash` 工具出现在工具面,实测 `echo $BASH_VERSION` → `5.2.21(1)-release`、`command -v bash` → `/usr/bin/bash`、`uname -s` → `MINGW64_NT-10.0-26200`,退出码 0。 即同一台机器、同一部署,仅版本差异:0.39.0 必现失败,0.38.5 完全正常。 ## 对照 v0.39.0 CHANGELOG 真机验证清单(待做项) - 判据②「新会话 bash 工具出现」:**不通过**(本报告) - 判据③「设置卡开 pwsh 工具 → 新会话 pwsh 出现且真实执行」:**通过**(实测 PowerShell 5.1 命令执行正常) ## 附带小问题(非故障,仅噪音) 未安装 dsh-better-sidebar 的部署上,每次启动/打印一条: ``` dsh: [dsh-gitbash-shell] patch: entry "better-sidebar" not found ``` 这是补丁 edit 对缺失行的文档化 warn-and-skip,可考虑降为一次性提示。 ## 建议修复方向 私有执行器挂载时剥离基类的 `shell` 服务注册(覆盖 `static inject`/服务声明,或改以非 class-plugin 方式构造实例),使「私有 scope 内构造、永不注册为 `ctx.shell` 服务」在 route B 下真正成立。
Activity
KannaKuron commentedon Oct 14, 2026
与 #30 为同一报告的双发(内容一致),已在 #30 回复并关闭:这是 #19 的同一问题,v0.39.1 起修复(PR #20 的 ctx.isolate('shell') 私有作用域),请升级到现行 0.39.4。better-sidebar 启动 warn 的结论也见 #30 的补充说明。