Shipped filesystem mutation defaults
随发行版交付的文件系统修改默认值
[Apply patch file editing](2026-09-28-apply-patch-file-editing.md) shipped `apply_patch` opt-in and kept `dsh-fs-observation-policy` mounted, so every base-backed profile refused `write`, `edit`, and `apply_patch` on a file the model had not read or that had changed since the read. Benchmark runs of the shipped compositions with the tool enabled and with the policy disabled were compared against the baseline, and the
Source compatibility: Chinese status uses a compatible non-canonical header
English
Problem
Apply patch file editing shipped apply_patch opt-in and kept dsh-fs-observation-policy mounted, so every base-backed profile refused write, edit, and apply_patch on a file the model had not read or that had changed since the read. Benchmark runs of the shipped compositions with the tool enabled and with the policy disabled were compared against the baseline, and the shipped defaults were decided from those results in discussion between the maintainers.
Decision
- The
dsh-basetool-fsrow (headless, SDK, and ACP) and the Webstandardpreset stateapplyPatch: true. The Webptcandcordispresets stateapplyPatch: false, and the shipped PTC overlay sets the same on the base row, so both keep the tool set the PTC compositions were evaluated with. Apply patch follows edit supersedes this bullet: shipped rows state noapplyPatch, which then followsedit, and the PTC compositions offer the tool. - The
dsh-basefs-observation-policyrow shipsdisabled: true. Every mutating tool in a base-backed profile runs against the bare provider:writeoverwrites,editreplaces the unique literal match, andapply_patchapplies hunks on context match alone. A deployment restores the guard for all three withdisabled: falseon that row.sdk-minimalstacks nodsh-baseand is unaffected. - The
writeandeditguidance keeps asking for a prior read without naming the policy; theapply_patchguidance asks for enough hunk context to match one place instead of a prior read. - The policy package is classified as an optional product package, since no default composition mounts it. The two recordings that capture a policy refusal,
fs-policy-rejectandapply-patch-rejected, re-enable the row through a per-scenarioruntime.cordis.yml; the fixed-budget compaction scenarios pinapplyPatch: falsein both their live and replay patches because their thresholds were tuned to the recorded tool set.
Alternatives considered
Enable apply_patch only in the Web standard preset. The SDK/Desktop parity check compares the SDK profile's standard tool set with the Desktop preset, so a Web-only change needs a permanent parity exception for a difference with no product reason; enabling the base row keeps the two equal.
Disable the policy for apply_patch only. A tool-fs switch that skipped the intent waterfalls for patches alone was built and evaluated, but it left write and edit under a guard the shipped compositions no longer wanted and added a second configuration axis beside the policy row; disabling the row decides all three tools in one place and keeps the policy package intact for deployments that want it.
Enable apply_patch in the PTC presets too. Under PTC the tool is a run_code binding rather than a JSON schema, so the cost is small, but the PTC compositions were evaluated without it; the overlay and the Web preset keep the evaluated tool set. Apply patch follows edit later adopted this alternative.
Consequences
Default model requests in base-backed profiles carry the apply_patch schema and guidance, so every recorded request expectation outside the fixed-budget compaction scenarios changed. A model can overwrite or edit a file it never read; the upgrade guide names the one-line patches that restore the guard or drop the tool. Sandbox confinement, Review capture, and fs/observed events are unchanged.
Testing
tool-fs unit tests cover the unguarded paths (policy: false). The keyless SDK smoke edits an existing file the model never read through the shipped sdk profile and checks the bytes on disk. desktop-tools.expected.e2e.ts compares the SDK profile's first model request, tool schemas included, with the Desktop standard preset's; PTC execution is not compared. The recorded corpus replays with the shipped defaults; fs-policy-reject and apply-patch-rejected replay with the policy re-enabled.
中文
问题
Apply patch 文件编辑以 opt-in 方式交付 apply_patch,并保持 dsh-fs-observation-policy 挂载,因此所有叠加 base 的 profile 都会拒绝对模型未读过、或读后已变化的文件执行 write、edit 与 apply_patch。维护者对随发行版交付的组合分别在开启该工具和禁用该策略的情况下跑了 benchmark,与基线比较后讨论得出了随发行版交付的默认值。
决策
dsh-base的tool-fs行(headless、SDK、ACP)与 Web 的standardpreset 写出applyPatch: true。Web 的ptc、cordispreset 写出applyPatch: false,随发行版交付的 PTC overlay 在 base 行上也设为false,两者都保持 PTC 组合评测时的工具集。Apply patch 跟随 edit 取代本条:内置行不写applyPatch,它随之跟随edit,PTC 组合也提供该工具。dsh-base的fs-observation-policy行以disabled: true交付。叠加 base 的 profile 中每个修改工具都直接作用于裸提供方:write覆盖,edit替换唯一的字面匹配,apply_patch只凭上下文匹配应用 hunk。部署在该行上写disabled: false即可为三者恢复防护。sdk-minimal不叠加dsh-base,不受影响。write与edit的提示语仍要求先读,但不再点名该策略;apply_patch的提示语要求给每个 hunk 足够的上下文以匹配唯一位置,而非先读。- 由于没有默认组合挂载策略包,它被归类为可选产品包。录的是策略拒绝的两个场景
fs-policy-reject与apply-patch-rejected通过各自的runtime.cordis.yml把该行开回来;固定 token 预算的压缩场景在 live 与 replay patch 中都钉住applyPatch: false,因为它们的阈值是按录制时的工具集调的。
考虑过的替代方案
只在 Web standard preset 开启 apply_patch。 SDK/Desktop 一致性检查会把 SDK profile 的 standard 工具集与 Desktop preset 比较,仅改 Web 需要为一个没有产品理由的差异永久保留一致性例外;开启 base 行让两边保持一致。
只对 apply_patch 关闭策略。 曾实现并评测过一个让补丁跳过 intent waterfall 的 tool-fs 开关,但它让 write 与 edit 继续受随发行版交付的组合已不需要的防护,并在策略行之外增加了第二个配置维度;禁用该行在一处决定三个工具,并为需要防护的部署完整保留策略包。
在 PTC preset 中也开启 apply_patch。 PTC 下该工具是 run_code 内的绑定而非 JSON schema,代价很小,但 PTC 组合是在没有它的情况下评测的;overlay 与 Web preset 保持评测时的工具集。Apply patch 跟随 edit 后来采用了这一方案。
后果
叠加 base 的 profile 的默认模型请求带有 apply_patch schema 与提示语,因此固定预算压缩场景之外的所有录制请求预期都变化了。模型可以覆盖或编辑从未读过的文件;升级指南给出恢复防护或去掉该工具的一行 patch。沙箱围栏、Review 采集与 fs/observed 事件不变。
测试
tool-fs 单元测试覆盖无防护路径(policy: false)。keyless SDK smoke 通过随发行版交付的 sdk profile 对模型从未读过的既有文件执行 edit 并检查磁盘字节。desktop-tools.expected.e2e.ts 比较 SDK profile 与 Desktop standard preset 的首个模型请求(含工具 schema),不比较 PTC 执行。录制 corpus 以随发行版交付的默认值回放;fs-policy-reject 与 apply-patch-rejected 在策略开回的情况下回放。