Skip to content

v0.39.0 route B:自有 bash 工具在所有 agent 上激活失败——私有执行器挂载触发 cordis shell 服务冲突 #30

Closed as not planned

Description

@shark-Shek

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
同一 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
异常被 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 \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

  1. KannaKuron commented on Oct 14, 2026

    @KannaKuron
    Owner

    感谢这份报告——根因分析与 #19 完全一致且独立成立(scope 内挂载的 GitBashSandboxExecutor 基类自带 shell 服务注册,与保留的官方 SandboxPwshExecutor 冲突),质量很高。但请先升级:这正是 #19,已随 v0.39.1 修复(PR #20:私有执行器改在 ctx.isolate('shell') 的隔离作用域内构造,基类的 shell 注册落在隔离 scope,永不触及根上下文)。

    你报告的环境是 dsh-0.39.0——缺陷只存在于 route B 的首版;0.39.1 → 现行 0.39.3 均已修复,且 0.39.3 还带着同期的三项加固(#23/#25/#27,后者的「激活日志回读校验」正是针对你看到的这类静默失败——现在注册失败会打显式错误行,不会只有一行 catch 吞掉的日志)。升级后无需回退 0.38.5,route B 的自有 bash 工具会正常激活。

    你顺带报告的 patch: entry "better-sidebar" not found 启动噪音(未安装 dsh-better-sidebar 的部署)已知悉——那是探测式 patch edit 对缺失行的宿主 warn,我们会在下个版本降噪。另外你对「0.38.5 正常 / 0.39.0 必现」的 A/B 对照和 --dump-config 静态佐证都是标准做法, appreciate。

    请升级 0.39.3 验证;若 bash 工具仍未出现(不应发生),带 host 日志回帖,我们重开。

  2. KannaKuron commented on Oct 14, 2026

    @KannaKuron
    Owner

    补充更正:上一条回复里说 better-sidebar 的启动 warn「会在下个版本降噪」——调查后的结论是插件侧无法在保留功能的前提下去除:

    那条 warn 来自宿主 patch 引擎对「edit 目标行不存在」的固有 warn-and-skip(cordis.patch.yml 里对 dsh-better-sidebar 行的探测式 edit 承载 boot 层侧栏终端的 shell 默认值,移除它会让装了 dsh-better-sidebar 的机器失去该默认)。宿主先按 id 索引再求值 !!js 表达式,所以「行不存在」这个分支在表达式有机会返回空值之前就已经 warn 了。

    处理:已写入 README 已知事项(未安装 dsh-better-sidebar 的部署每次启动一条无害 warn,属预期)。抱歉之前的表述给了不准确的预期。另:v0.39.4 已发布(同装 dsh-ops 0.3.0 的互通版本),与你的部署无冲突,升级即可。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions