Repository navigation
fix(hide-official): verify the assembled surface without a tool array - #414
Open
WeiLinCool wants to merge 1 commit into
Open
WeiLinCool wants to merge 1 commit into
WeiLinCool wants to merge 1 commit into
Conversation
DSH 0.2.1 transforms a PromptPresentation in system-prompt/assemble and attaches `tools` only after the waterfall returns (9d0c97b9d2, "admit conditional tools per step"). The assembly guard read that array unconditionally, so every scoped assembly threw `assembled tool schemas unavailable` as soon as replaceTools was non-empty: the whole session was blocked, not one tool. Resolve the selected official names through the scope view (`tools.get(name, scope)`) instead, which answers the same question without the assembled array, and keep the stricter assembled-surface assertion for hosts that still supply schemas. The fallback stays fail-closed: a selected official tool that is still resolvable in the scope is still a leak. Closes T-Auto#413
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.
Closes #413
What was wrong
With
dsh-ops-hide-officialenabled (replaceToolsnon-empty) on DSH0.2.1, every scoped prompt assembly is rejected:The guard read the waterfall payload's tool array unconditionally:
DSH
0.2.1(9d0c97b9d2 feat(tools): admit conditional tools per step) transforms aPromptPresentationand attachestoolsonly after the waterfall returns, soresult.toolsis alwaysundefinedthere and the guard can never pass.#387/211dc3efixed the same contract change on the PTC side (hasPtcInstruction, text-only hooks); this is the remaining occurrence.Minimal reproduction, used as the regression test — a listener that reproduces the host's shape (drop
toolsbeforenext(), re-attach after, exactly like the host'sreturn { ...transformed, tools }):On
main@dfafddcthat assembly rejects withassembled tool schemas unavailable; with this change it resolves and the selected official tools stay hidden.The change
src/official-tool-hiding.ts: when the payload carries no tool array, resolve the selected official names through the scope view (tools.get(tool, context.scope)) instead of failing on the missing array. A host that still supplies schemas keeps the existing assembled-surface assertion, unchanged.test/lib/official-tool-hiding.mjs: regression that mounts the replacement surface, reproduces the0.2.1payload shape, and asserts the assembly succeeds and the visible surface is intact.docs/CHANGELOG.md:## [Unreleased]entry, English and Chinese.Deliberately not changed: the
collapsed/entry.errorinteraction above the guard (a collapsed PTC scope still needs an assembled array to be proven), and the PTC-side predicate, which211dc3ealready handles.Validation
Red without the change, on the same base commit
dfafddcwith only the new test applied:Also checked end-to-end against a real DSH
0.2.1-rc.3AgentLoop with a scripted provider: before, the session's second assembly fails the same way; after, the turn completes. That run is not part of the suite (it needs a 0.2.1 host), so it is evidence only.pull_request事件触发的CI requiredrun(上方 URL)npm run verify相关读数已贴出(本机缺少可用的嵌套 sandbox,PTC 程序执行类用例在本机跳过,故只贴本次涉及套件与门禁脚本的实际输出)docs/CHANGELOG.md的## [Unreleased]已加中英条目package.jsonEnvironment
24.17.0mainatdfafddcnpm ci --ignore-scripts+npm run build