Skip to content

fix(ptc): publish the allowed pool as resident when dynamic loading is off - #907

Merged
Nicholas023 merged 1 commit into
T-Auto:mainfrom
Nicholas023:fix-ptc-dynamic-tools-resident
Nov 13, 2026
Merged

Nicholas023 merged 1 commit into
T-Auto:mainfrom
Nicholas023:fix-ptc-dynamic-tools-resident

Conversation

@Nicholas023

@Nicholas023 Nicholas023 commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #904

What was wrong

PTC 呈现下关闭某个预设的 dynamicTools(本例 ops-ptc,配置 dynamicTools: false + residentTools: true),该会话既不发布渐进式加载器,也没有任何常驻替代:ops_load_sdk 消失,且 allowedTools 池里没有一个 API 可见。

实测(改前):ops_bash 与 ops_inspect_local_file 可调用,而 ops_grep、ops_glob、ops_read_files、ops_load_sdk 全部 undefined。故障会话 session-bafe0878 的 tools:sdk 段不含任何高级 ops_*,模型只能回答「ops_load_sdk is not a function」。

根因是 config.allowedTools 只有一条通往可见的路径——被 ops_load_sdk 选中;加载器缺席时 entry.selected 恒空。关闭开关等于拆掉唯一通路,却没有补上替代通路,作用域落进不可达状态。

最小复现:任意 PTC 预设行设 dynamicTools: false、residentTools: true,新建会话后查 SDK 名称集合。

The change

dynamic === false 时,把配置池 allowedTools(含 result)并入 resident 发布,而不是让它停在 selectable-only:

const exposed: ApiName[] = gate.dynamic === false && gate.resident !== false
  ? [...config.allowedTools, 'result' as ApiName] : []
const resident = new Set<ApiName>(gate.resident === false ? [] : [...PTC_RESIDENT_TOOLS, ...config.alwaysLoaded, ...exposed])
文件 改动
src/publication/ptc.ts 常驻集在加载器缺席时并入配置池
test/modes.test.mjs ops-ptc 的 dynamicTools: false 用例改为断言池作为常驻发布
src/client/locales.ts 中英两处开关文案说明新语义
docs/configuration-reference.md、docs/配置参考.md residentTools / dynamicTools 两行
docs/dynamic-tool-directory.md、docs/动态工具目录.md 关闭开关后的行为段
docs/CHANGELOG.md ## [Unreleased] 双语条目

刻意没做的事:

Validation

  • 本 PR 有一次 pull_request 事件触发的 CI required run,URL 见下方代码块
  • node scripts/verify-gate.mjs --skip-install 的实际输出(见下)
  • 撤掉本次实现后,相关检查会变红(见下)
  • docs/CHANGELOG.md 的 ## [Unreleased] 已加中英条目
  • 行为变化已同步 4 份中英文文档与 2 处界面文案
  • 未新增依赖,未改 package.json 版本与 optionalDependencies
  • 改了面向模型的可见集合:schema 字节影响见下

行为级红绿:只回退 src/publication/ptc.ts 的 exposed 计算而不动测试,mode-ops-ptc dynamicTools off withdraws the loader but keeps the resident PTC surface 立即变红(a loader-less scope publishes write_file as resident)。

schema / 提示词字节影响:仅当 dynamicTools: false 且 residentTools 开启时,SDK 声明集合从「仅 inspect」变为「inspect + 配置池」。这是该开关的既定目的——给不支持动态工具增删的提供商一条缓存友好路径(动态工具会让缓存命中失效)。默认配置(dynamicTools: true)的字节完全不变。

$ node scripts/verify-gate.mjs --skip-install
  ok   versions
  ok   cargo version
  ok   build the plugin
  ok   native worker unit tests
  ok   build and stage the native worker
  ok   stage complete frozen Niubash payload
  ok   Acquire explicit legacy MSYS fixture
  ok   Legacy Windows IPC payloads
  ok   manifest contract
  ok   full suite verification
  ok   staged runtime closure
  ok   pack the release artifact
  ok   unpack the release artifact
  ok   packed runtime closure

dsh-ops test: 248 suites, 16 worker(s); exclusive suites run afterwards
dsh-ops test: 244 suite(s) passed, 4 skipped in 157s

$ node scripts/check-file-size.mjs
check-file-size: 822 code file(s) checked, all at or under 1000 lines (longest: native/crates/ops-search/src/search.rs (930))

$ gh pr checks 907 --repo T-Auto/dsh-ops
CI required             pass
node-floor              pass
rust-lint               pass
source-size             pass
tools-trial             pass
validate (darwin-arm64) pass
validate (darwin-x64)   pass
validate (linux-x64)    pass
validate (win32-x64)    pass
workflow-lint           pass

$ gh run view 43452412464 --json url,event,conclusion
https://github.com/T-Auto/dsh-ops/actions/runs/43452412464 pull_request success

CI required job: https://github.com/T-Auto/dsh-ops/actions/runs/43452412464/job/131982124894

跳过的 4 个套件均为非 Windows/环境相关:linux-attributes、linux-shell、tui-host、tui-native。

Environment

  • OS / 架构:Windows x64(10.0.26100)
  • Node:v24.21.0;cargo 1.99.1
  • 基于上游 main 的 commit:e7244444(0.5.5)
  • 安装通道:从源码 npm ci --ignore-scripts + 仓库内构建(未走 registry)

…s off

Turning a PTC preset's dynamicTools off removed the loader and left the scope
with no reachable API: the pool stayed selectable-only, so nothing could select
it and nothing was published. A provider that cannot take dynamically added
tools therefore lost every advanced OPS API, and ops_load_sdk with it.

Publish the configured allowedTools pool plus result as resident while dynamic
loading is off, so the same surface stays callable without progressive
disclosure. residentTools stays authoritative: a scope that asked for no
startup APIs keeps publishing none, which is the state the declaration-surface
guard protects.

Refs T-Auto#904
@Nicholas023
Nicholas023 force-pushed the fix-ptc-dynamic-tools-resident branch from e2ad8ea to fe08b34 Compare November 13, 2026 15:25
@Nicholas023
Nicholas023 merged commit d670333 into T-Auto:main Nov 13, 2026
10 checks passed
Nicholas023 added a commit that referenced this pull request Nov 13, 2026
This reverts merge commit d670333 (PR #907), which published a PTC
preset's allowedTools pool as resident whenever dynamic loading was off.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 关闭 dynamicTools 后渐进式披露工具完全不可达:既无 ops_load_sdk,也无任何常驻替代(main 0.5.5)

1 participant