From 8f798da97df81faf68b9fb3d93a76bfc962cc77d Mon Sep 17 00:00:00 2001 From: sjw1231 Date: Wed, 21 Oct 2026 17:21:01 +0800 Subject: [PATCH] fix(tool-fs): leave sandbox decisions to providers and bound patch diffs Drop the preflight sandbox fence. It derived writable roots in the local process, so under the SSH provider it threw on remote additionalWritableRoots and compared remote targets against local temp roots; write and edit never fenced in the tool layer. The provider now refuses a denied operation at commit, and a commit whose first operation failed without any change rejects like a preflight refusal so the sandbox escalation path keeps its error code. Classify FS_ABORTED as unknown: a cancelled remote request rejects while the provider may still be writing, so no stat comparison can settle it. Document that a cancelled call receives the registry's abort result like every tool. Store no diff for creations, matching write, and bound the move source basis by diffBasisMaxBytes so persisted metadata never holds whole files; FsMoveOutcome.sourceBefore becomes nullable. Omit deletions from the call preview and from result diffs without a basis instead of rendering them as empty creations, and count distinct files in the preview title. Reject a NUL byte beyond the read sampling window in preflight, name targets by display path in atomic-write diagnostics, align the apply_patch guidance with the edit wording and mention delete and move, read the stopped flag and applied diffs tool-agnostically in the client models, skip the permission-bit snapshot under root, list fs/delete-intent in the tool catalog, and refresh the fs-patch description, group README, fs-sandbox summary, and ui-tool README. --- docs/subsystems/filesystem.i18n.yaml | 12 ++--- docs/subsystems/filesystem.md | 16 +++---- docs/subsystems/filesystem.zh.md | 16 +++---- docs/tool-catalog.i18n.yaml | 2 +- docs/tool-catalog.md | 4 +- docs/tool-catalog.zh.md | 2 +- packages/client/ui-tool/README.i18n.yaml | 4 +- packages/client/ui-tool/README.md | 9 +--- packages/client/ui-tool/README.zh.md | 9 +--- .../src/client/tool/models/diff-card-model.ts | 9 ++-- .../src/client/tool/models/tool-call-model.ts | 5 +- .../ui-tool/tests/diff-card.client.spec.tsx | 7 +-- .../extensions/tool-cordis/src/api-catalog.ts | 4 +- packages/fs/README.i18n.yaml | 8 ++-- packages/fs/README.md | 10 ++-- packages/fs/README.zh.md | 10 ++-- packages/fs/fs-local/src/fsio.ts | 23 ++++----- packages/fs/fs-local/src/index.ts | 29 +++++------- packages/fs/fs-local/tests/fsio.spec.ts | 15 +++--- .../fs/fs-local/tests/patch-mutations.spec.ts | 9 ++++ packages/fs/fs-patch/package.json | 2 +- packages/fs/fs-sandbox/README.i18n.yaml | 4 +- packages/fs/fs-sandbox/README.md | 2 +- packages/fs/fs-sandbox/README.zh.md | 2 +- packages/fs/fs/src/index.ts | 2 +- packages/fs/fs/src/types.ts | 6 +-- packages/fs/tool-fs/README.i18n.yaml | 16 +++---- packages/fs/tool-fs/README.md | 10 ++-- packages/fs/tool-fs/README.zh.md | 10 ++-- packages/fs/tool-fs/src/apply-patch-output.ts | 28 +++++++---- .../tool-fs/src/apply-patch-presentation.ts | 18 +++---- packages/fs/tool-fs/src/apply-patch.ts | 4 +- packages/fs/tool-fs/src/patch/execute.ts | 4 +- packages/fs/tool-fs/src/patch/plan.ts | 2 +- packages/fs/tool-fs/src/patch/preflight.ts | 47 +++++++++---------- .../tests/apply-patch-presentation.spec.ts | 25 +++++----- packages/fs/tool-fs/tests/apply-patch.spec.ts | 17 ++++--- .../fs/tool-fs/tests/patch/commit.spec.ts | 33 ++++++++++++- .../fs/tool-fs/tests/patch/preflight.spec.ts | 47 +++++-------------- packages/ssh/ssh/src/schemas.ts | 4 +- scripts/doc-standard.spec.ts | 2 +- scripts/gen-tool-catalog.ts | 2 +- .../verify-package-readme-model-experience.ts | 2 +- .../sdk/bash-tool/system-prompt.expected.md | 2 +- .../sdk/bash-tool/tool-schemas.expected.json | 2 +- .../desktop-context/system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 4 +- .../system-prompt.1.expected.md | 2 +- .../tool-schemas.1.expected.json | 2 +- .../system-prompt.1.expected.md | 2 +- .../tool-schemas.1.expected.json | 2 +- .../system-prompt.1.expected.md | 2 +- .../tool-schemas.1.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.1.expected.md | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.1.expected.json | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.1.expected.md | 2 +- .../tool-schemas.1.expected.json | 2 +- .../system-prompt.1.expected.md | 2 +- .../tool-schemas.1.expected.json | 2 +- .../sdk/text-turn/system-prompt.expected.md | 2 +- .../sdk/text-turn/tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 6 +-- .../tool-schemas.expected.json | 2 +- .../system-prompt.1.expected.md | 2 +- .../system-prompt.2.expected.md | 2 +- .../system-prompt.expected.md | 8 ++-- .../tool-schemas.expected.json | 4 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 4 +- .../apply-patch-partial/session.v4.jsonl | 2 +- .../apply-patch-update/session.v4.jsonl | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../both-mode-turn/system-prompt.expected.md | 4 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../cua-native/system-prompt.expected.md | 2 +- .../cua-native/tool-schemas.expected.json | 2 +- .../session/cua-ptc/system-prompt.expected.md | 4 +- .../system-prompt.expected.md | 4 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 4 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 4 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 6 +-- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- snapshots/session/headless.snapshot.ts | 2 + .../lsp-definition/system-prompt.expected.md | 2 +- .../lsp-definition/tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 4 +- .../mcp-resources/system-prompt.expected.md | 2 +- .../mcp-resources/tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 4 +- .../tool-schemas.expected.json | 4 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 4 +- .../system-prompt.expected.md | 2 +- .../office-skills/system-prompt.expected.md | 2 +- .../office-skills/tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 4 +- .../system-prompt.expected.md | 4 +- .../tool-schemas.expected.json | 4 +- .../plugin-manager/system-prompt.expected.md | 2 +- .../plugin-manager/tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../provider-cwd/system-prompt.expected.md | 2 +- .../provider-cwd/tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 4 +- .../system-prompt.expected.md | 4 +- .../ptc-persistent/system-prompt.expected.md | 4 +- .../system-prompt.expected.md | 4 +- .../ptc-python-turn/system-prompt.expected.md | 4 +- .../ptc-read-image/system-prompt.expected.md | 4 +- .../ptc-turn/system-prompt.expected.md | 4 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../pwsh-tool-turn/system-prompt.expected.md | 2 +- .../pwsh-tool-turn/tool-schemas.expected.json | 2 +- .../ralph-loop/system-prompt.1.expected.md | 2 +- .../ralph-loop/system-prompt.2.expected.md | 2 +- .../ralph-loop/system-prompt.expected.md | 2 +- .../ralph-loop/tool-schemas.1.expected.json | 2 +- .../ralph-loop/tool-schemas.2.expected.json | 2 +- .../ralph-loop/tool-schemas.expected.json | 2 +- .../read-image/system-prompt.expected.md | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.1.expected.md | 2 +- .../tool-schemas.1.expected.json | 2 +- .../tool-schemas.expected.json | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.1.expected.md | 2 +- .../tool-schemas.1.expected.json | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 4 +- .../tool-schemas.expected.json | 2 +- .../team-targets/system-prompt.expected.md | 2 +- .../team-targets/tool-schemas.expected.json | 2 +- .../text-turn/system-prompt.expected.md | 2 +- .../text-turn/tool-schemas.expected.json | 2 +- .../web-fetch/system-prompt.expected.md | 2 +- .../web-fetch/tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../system-prompt.expected.md | 2 +- .../tool-schemas.expected.json | 2 +- .../worktree/system-prompt.expected.md | 2 +- .../worktree/tool-schemas.expected.json | 2 +- 186 files changed, 429 insertions(+), 409 deletions(-) diff --git a/docs/subsystems/filesystem.i18n.yaml b/docs/subsystems/filesystem.i18n.yaml index ce85a37157..b8eb98d2a0 100644 --- a/docs/subsystems/filesystem.i18n.yaml +++ b/docs/subsystems/filesystem.i18n.yaml @@ -3,8 +3,8 @@ # After editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/subsystems/filesystem.md /filesystem: - en: 8816a31732c1fe16 - zh: 372c22d11d220bea + en: 43c2a032cfbcfb13 + zh: 7781e8b14e143381 /filesystem/target-identity-and-metadata-provider-contract: en: 1e55f1c74f0ade3f zh: faecf389a2fb0a93 @@ -12,8 +12,8 @@ en: 3ab3a02918d41178 zh: 78ff80be8599ba43 /filesystem/write-and-edit-guards-provider-contract: - en: 2d5f148d79802cf9 - zh: 70fb89582a138175 + en: a7c449176367a0d6 + zh: ecb49a885304db62 /filesystem/the-fs-policy-events-provider-contract-vocabulary: en: b25951ca185a890e zh: 42a1344a2cc860a9 @@ -27,8 +27,8 @@ en: cfa56ed5d1eb2ff9 zh: 04be764f3dc8a48c /filesystem/patch-execution-consumer: - en: cd796ff507f51816 - zh: 294ca04bf6553f72 + en: 7b462db42ab89b10 + zh: 968219ded2b55d69 /filesystem/error-taxonomy-provider-contract: en: ca206569d4e2528d zh: e36d70ad39a73570 diff --git a/docs/subsystems/filesystem.md b/docs/subsystems/filesystem.md index e7f9b2e79b..db2500ebaf 100644 --- a/docs/subsystems/filesystem.md +++ b/docs/subsystems/filesystem.md @@ -2,7 +2,7 @@ English | [中文](filesystem.zh.md) -The optional filesystem capability composes these roles: [dsh-fs](../../packages/fs/fs) owns `ctx.fs` and guarded file mutations, [dsh-fs-local](../../packages/fs/fs-local) implements local disk, [dsh-fs-observation-policy](../../packages/fs/fs-observation-policy) records observed presence or absence and adds freshness rules through events rather than a service, and [dsh-tool-fs](../../packages/fs/tool-fs) directly executes model-facing read/write/edit calls and renders windows. It is outside the agent-loop spine; alternate backends do not change policy or tool schemas. The pure [dsh-fs-patch](../../packages/fs/fs-patch/README.md) library supplies patch parsing, text application, and affected-path collection. +The optional filesystem capability composes these roles: [dsh-fs](../../packages/fs/fs) owns `ctx.fs` and guarded file mutations, [dsh-fs-local](../../packages/fs/fs-local) implements local disk, [dsh-fs-observation-policy](../../packages/fs/fs-observation-policy) records observed presence or absence and adds freshness rules through events rather than a service, and [dsh-tool-fs](../../packages/fs/tool-fs) directly executes model-facing read/write/edit calls and renders windows. It is outside the agent-loop spine; alternate backends do not change policy or tool schemas. The pure [dsh-fs-patch](../../packages/fs/fs-patch/README.md) library supplies patch parsing and text application. `dsh-fs-observation-policy` is optional. Without it, the `FileSystem` Service Definition, a provider, and the `dsh-tool-fs` Consumer form the complete, unconstrained filesystem seam: `write` unconditionally creates or overwrites, and `edit` unconditionally replaces literal text. The policy plugin changes these operations by deciding the `fs/*` waterfalls. Removing it does not break the tool because the tool calls `ctx.fs` and dispatches events; it does not call policy methods. A deployment that loads `dsh-tool-fs` is expected to also load `dsh-fs-observation-policy` so the default behavior is read-before-write/edit. @@ -190,7 +190,7 @@ The same optional guard rules cover patches, deletion, and moves. Providers perf | `moveFile` source | `fs/edit-intent` | Source absent only when `sourceDeleted` is true. | | `moveFile` destination | `fs/write-intent` | Destination present at `destination.version`. | -Patch, delete, and move sources must be regular files; missing or stale sources report `FS_STALE_VERSION`. Patch matching runs on LF-normalized text inside the mutation lock, and a mismatch reports `FS_PATCH_MISMATCH` with the patch hunk line and stage. Moves reject identical target keys with `FS_SAME_TARGET`, use write guards for their destination, and preserve source line endings and mode. Deletion and overwritten-destination bases are bounded nullable LF text. A move is two effects: the destination may be published while source removal fails. Cancellation is checked before local destination staging; after that, the provider completes both effects and reports their outcome. +Patch, delete, and move sources must be regular files; missing or stale sources report `FS_STALE_VERSION`. Patch matching runs on LF-normalized text inside the mutation lock, and a mismatch reports `FS_PATCH_MISMATCH` with the patch hunk line and stage. Moves reject identical target keys with `FS_SAME_TARGET`, use write guards for their destination, and preserve source line endings and mode. Deletion, move-source, and overwritten-destination bases are bounded nullable LF text. A move is two effects: the destination may be published while source removal fails. Cancellation is checked before local destination staging; after that, the provider completes both effects and reports their outcome. Targets already follow symlinks, so a caller that rejects symlink sources inspects the path with `lstat` before `resolve`. @@ -213,10 +213,10 @@ interface FsMoveSourceFailure { ``` ```ts type-equiv -/** Published destination and removal status; sourceBefore is the LF source text captured under the move lock. */ +/** Published destination and removal status; sourceBefore is the bounded LF source basis captured under the move lock. */ type FsMoveOutcome = - | { sourceBefore: string; destination: FsWriteOutcome; sourceDeleted: true } - | { sourceBefore: string; destination: FsWriteOutcome; sourceDeleted: false; sourceFailure: FsMoveSourceFailure } + | { sourceBefore: string | null; destination: FsWriteOutcome; sourceDeleted: true } + | { sourceBefore: string | null; destination: FsWriteOutcome; sourceDeleted: false; sourceFailure: FsMoveSourceFailure } ``` Both `writeText` and `editText` take their version guard OPTIONALLY: omit it for an unconditional (bare-provider) mutation, supply it to guard. `writeText`'s guard is an `FsWriteIntent` — `createIfAbsent` creates a missing target and rejects an existing one with `FS_NOT_OBSERVED`, including a target that appears after the provider's initial probe because publication itself must be no-replace; `replaceIfVersion` replaces only when the target exists at the observed version, else `FS_STALE_VERSION`. Omitting `expected` unconditionally creates-or-overwrites. The union itself carries only the two guarded intents; "no guard" is expressed by omission, so write and edit both use the same optional `expected` field. @@ -349,7 +349,7 @@ Observed state is a `WeakMap>` held inside ## Patch execution (consumer) -The internal [tool-fs patch executor](../../packages/fs/tool-fs/README.md#understand-the-implementation) dispatches intent decisions in preflight without emitting observations, simulates preceding operations, and reacquires guards for each commit. Provider results determine which effects are recorded; executor details and failure guarantees belong to the package README. +The internal [tool-fs patch executor](../../packages/fs/tool-fs/README.md#understand-the-implementation) dispatches intent decisions in preflight without emitting observations, simulates preceding operations, and reacquires guards for each commit. Sandbox containment stays with the provider at commit, as for `write` and `edit`. Provider results determine which effects are recorded; executor details and failure guarantees belong to the package README. | Operation | Preflight intent on first target use | Commit intent | Successful observation | |---|---|---|---| @@ -358,7 +358,7 @@ The internal [tool-fs patch executor](../../packages/fs/tool-fs/README.md#unders | delete | `fs/delete-intent` | `fs/delete-intent` | target absent | | move | source `fs/edit-intent`; destination `fs/write-intent` | same two intents, freshly dispatched | destination present(version); source absent only when removed | -The `apply_patch` tool returns strict commit values with per-operation diagnostics and full-text change inputs for rendering; persisted metadata holds diff hunks and a stopped flag. Syntax and preflight refusals set `isError: true`; commit reports retain `isError: false` even when stopped so known partial diffs reach Session presentation. The [tool README](../../packages/fs/tool-fs/README.md#use-this-package) owns formatting and recovery. +The `apply_patch` tool returns strict commit values with per-operation diagnostics and full-text change inputs for rendering; persisted metadata holds diff hunks from the provider's bounded bases and a stopped flag. Syntax and preflight refusals set `isError: true`; commit reports retain `isError: false` even when stopped so known partial diffs reach Session presentation, except that a cancelled call receives the tool registry's abort result like every other tool. The [tool README](../../packages/fs/tool-fs/README.md#use-this-package) owns formatting and recovery. ## Error taxonomy (provider contract) @@ -610,7 +610,7 @@ abstract deleteFile( target: FsTarget, expected?: { version: FsVersion }, signal * @param sandboxPolicy - the per-call mode and workspace root both paths run * under; a sandboxing backend fences them, the bare backend ignores it. * Omit to leave the backend its own default. - * @returns the locked LF source text, the destination outcome, and the source-removal status. + * @returns the bounded LF source basis, the destination outcome, and the source-removal status. */ abstract moveFile( source: FsTarget, destination: FsTarget, options: { hunks?: readonly PatchHunk[] expectedSource?: { version: FsVersion } expectedDestination?: FsWriteIntent }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise ``` diff --git a/docs/subsystems/filesystem.zh.md b/docs/subsystems/filesystem.zh.md index d22ac834b9..a5cc8a9973 100644 --- a/docs/subsystems/filesystem.zh.md +++ b/docs/subsystems/filesystem.zh.md @@ -2,7 +2,7 @@ [English](filesystem.md) | 中文 -可选的文件系统能力由以下角色组成:[dsh-fs](../../packages/fs/fs) 拥有 `ctx.fs` 和受防护的文件变更操作;[dsh-fs-local](../../packages/fs/fs-local) 实现本地磁盘后端;[dsh-fs-observation-policy](../../packages/fs/fs-observation-policy) 记录观测到的存在或缺失状态,并通过事件(而非服务)添加新鲜度规则;[dsh-tool-fs](../../packages/fs/tool-fs) 直接执行面向模型的 read/write/edit 调用并渲染窗口。它位于 agent loop(智能体循环)主干之外;替换后端不会改变策略或工具 schema。纯库 [dsh-fs-patch](../../packages/fs/fs-patch/README.zh.md) 提供补丁解析、文本应用与受影响路径收集。 +可选的文件系统能力由以下角色组成:[dsh-fs](../../packages/fs/fs) 拥有 `ctx.fs` 和受防护的文件变更操作;[dsh-fs-local](../../packages/fs/fs-local) 实现本地磁盘后端;[dsh-fs-observation-policy](../../packages/fs/fs-observation-policy) 记录观测到的存在或缺失状态,并通过事件(而非服务)添加新鲜度规则;[dsh-tool-fs](../../packages/fs/tool-fs) 直接执行面向模型的 read/write/edit 调用并渲染窗口。它位于 agent loop(智能体循环)主干之外;替换后端不会改变策略或工具 schema。纯库 [dsh-fs-patch](../../packages/fs/fs-patch/README.zh.md) 提供补丁解析与文本应用。 `dsh-fs-observation-policy` 是可选插件。没有该插件时,`FileSystem` 服务定义、一个提供方和 `dsh-tool-fs` 消费方组成完整且不受约束的文件系统 seam:`write` 无条件创建或覆盖,`edit` 无条件替换字面文本。策略插件通过裁决 `fs/*` waterfall(瀑布式事件)来改变这些操作。移除该插件不会破坏工具,因为工具调用 `ctx.fs` 并分发事件,而不调用策略方法。加载了 `dsh-tool-fs` 的部署也应加载 `dsh-fs-observation-policy`,使默认行为为「先读后写/编辑」。 @@ -190,7 +190,7 @@ type ApplyHunksResult = | `moveFile` 源 | `fs/edit-intent` | 仅在 `sourceDeleted` 为 true 时记录源缺失。 | | `moveFile` 目标 | `fs/write-intent` | 目标存在于 `destination.version`。 | -补丁、删除和移动的源必须是普通文件;源缺失或版本陈旧报告 `FS_STALE_VERSION`。补丁在变更锁内对 LF 规范化文本匹配,不匹配报告 `FS_PATCH_MISMATCH`,包含补丁 hunk 行号与阶段。移动以 `FS_SAME_TARGET` 拒绝相同目标 key,对目标使用写入防护,并保留源的行尾风格与模式。删除和被覆盖目标的基线是有界、可空的 LF 文本。移动是两个效果:目标可能已发布而源删除失败。本地移动在暂存目标前检查取消;随后提供方完成两端效果并报告结果。 +补丁、删除和移动的源必须是普通文件;源缺失或版本陈旧报告 `FS_STALE_VERSION`。补丁在变更锁内对 LF 规范化文本匹配,不匹配报告 `FS_PATCH_MISMATCH`,包含补丁 hunk 行号与阶段。移动以 `FS_SAME_TARGET` 拒绝相同目标 key,对目标使用写入防护,并保留源的行尾风格与模式。删除、移动源和被覆盖目标的基线是有界、可空的 LF 文本。移动是两个效果:目标可能已发布而源删除失败。本地移动在暂存目标前检查取消;随后提供方完成两端效果并报告结果。 目标已跟随符号链接,因此拒绝符号链接源的调用方在 `resolve` 前用 `lstat` 检查路径。 @@ -213,10 +213,10 @@ interface FsMoveSourceFailure { ``` ```ts type-equiv -/** Published destination and removal status; sourceBefore is the LF source text captured under the move lock. */ +/** Published destination and removal status; sourceBefore is the bounded LF source basis captured under the move lock. */ type FsMoveOutcome = - | { sourceBefore: string; destination: FsWriteOutcome; sourceDeleted: true } - | { sourceBefore: string; destination: FsWriteOutcome; sourceDeleted: false; sourceFailure: FsMoveSourceFailure } + | { sourceBefore: string | null; destination: FsWriteOutcome; sourceDeleted: true } + | { sourceBefore: string | null; destination: FsWriteOutcome; sourceDeleted: false; sourceFailure: FsMoveSourceFailure } ``` `writeText` 和 `editText` 的版本守卫都是可选的:省略守卫时执行无条件的裸提供方变更,提供守卫时则执行相应的条件检查。`writeText` 的守卫是 `FsWriteIntent`:`createIfAbsent` 在目标缺失时创建,目标已存在时以 `FS_NOT_OBSERVED` 拒绝;即使目标在提供方初始探测后才出现,也必须拒绝,因为发布操作本身不得替换。`replaceIfVersion` 仅在目标存在且版本匹配时替换,否则报 `FS_STALE_VERSION`。省略 `expected` 则无条件创建或覆盖。联合类型本身只包含两种有守卫的意图;「无守卫」通过省略表达,因此 write 和 edit 都使用同一个可选的 `expected` 字段。 @@ -349,7 +349,7 @@ interface FileReadOutcome { ## 补丁执行(消费方) -内部 [tool-fs 补丁执行器](../../packages/fs/tool-fs/README.zh.md#understand-the-implementation) 在预检时分发意图决策而不发出观察、模拟前序操作,并在每次提交时重新取得防护。提供方结果决定记录哪些效果;执行器细节与失败保证由包 README 维护。 +内部 [tool-fs 补丁执行器](../../packages/fs/tool-fs/README.zh.md#understand-the-implementation) 在预检时分发意图决策而不发出观察、模拟前序操作,并在每次提交时重新取得防护。沙箱围栏与 `write`、`edit` 一样由提供方在提交时判断。提供方结果决定记录哪些效果;执行器细节与失败保证由包 README 维护。 | 操作 | 首次使用目标的预检意图 | 提交意图 | 成功观察 | |---|---|---|---| @@ -358,7 +358,7 @@ interface FileReadOutcome { | delete | `fs/delete-intent` | `fs/delete-intent` | 目标 absent | | move | 源 `fs/edit-intent`;目标 `fs/write-intent` | 重新分发同一组意图 | 目标 present(version);仅在源删除成功时记录 absent | -`apply_patch` 工具返回严格的提交值,包含各操作诊断及用于渲染的完整文本变更输入;持久化元数据只保留 diff hunk 与停止标志。语法和预检拒绝为 `isError: true`;停止的提交报告仍为 `isError: false`,确保已知部分 diff 进入 Session 展示。[工具 README](../../packages/fs/tool-fs/README.zh.md#use-this-package) 维护格式与恢复规则。 +`apply_patch` 工具返回严格的提交值,包含各操作诊断及用于渲染的完整文本变更输入;持久化元数据只保留基于提供方有界基线的 diff hunk 与停止标志。语法和预检拒绝为 `isError: true`;停止的提交报告仍为 `isError: false`,确保已知部分 diff 进入 Session 展示,但被取消的调用与其他工具一样收到工具注册表的中止结果。[工具 README](../../packages/fs/tool-fs/README.zh.md#use-this-package) 维护格式与恢复规则。 ## 错误分类体系(提供方约定) @@ -610,7 +610,7 @@ abstract deleteFile( target: FsTarget, expected?: { version: FsVersion }, signal * @param sandboxPolicy - the per-call mode and workspace root both paths run * under; a sandboxing backend fences them, the bare backend ignores it. * Omit to leave the backend its own default. - * @returns the locked LF source text, the destination outcome, and the source-removal status. + * @returns the bounded LF source basis, the destination outcome, and the source-removal status. */ abstract moveFile( source: FsTarget, destination: FsTarget, options: { hunks?: readonly PatchHunk[] expectedSource?: { version: FsVersion } expectedDestination?: FsWriteIntent }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise ``` diff --git a/docs/tool-catalog.i18n.yaml b/docs/tool-catalog.i18n.yaml index 6320941f10..cebe7a4100 100644 --- a/docs/tool-catalog.i18n.yaml +++ b/docs/tool-catalog.i18n.yaml @@ -9,7 +9,7 @@ en: 6cc2cd9ced70bb09 zh: 1c0e6cb4ba2ed637 /tool-schema-catalog/tool-package-map: - en: 0d7e753871fbfce5 + en: dad1914a662799c7 zh: fee2f9428abcf719 /tool-schema-catalog/deepseek-ai-dsh-plugin-manager: en: e0143916bb634762 diff --git a/docs/tool-catalog.md b/docs/tool-catalog.md index 20306ceee7..4b9843ea57 100644 --- a/docs/tool-catalog.md +++ b/docs/tool-catalog.md @@ -29,7 +29,7 @@ This table connects model-visible tool names to the plugin package and service s | `@deepseek-ai/dsh-tool-bash-persistent` | `bash` | `ctx.workingDirectory`, `ctx.tools`, `ctx.terminals`, `an owning Agent at execution time` | `tool/call`, `PTY shell state`, `tool/result` | - | One owner-isolated persistent bash tool; deployment composition supplies the PTY backend and may override the model-facing environment description. | | `@deepseek-ai/dsh-tool-pwsh-persistent` | `pwsh` | `ctx.workingDirectory`, `ctx.tools`, `ctx.terminals`, `an owning Agent at execution time` | `tool/call`, `PTY shell state`, `tool/result` | - | One owner-isolated persistent pwsh tool, the Windows counterpart of the persistent bash tool; deployment composition supplies a pwsh-dialect PTY backend and may override the model-facing environment description. | | `@deepseek-ai/dsh-tool-str-replace-editor` | `str_replace_editor` | `ctx.tools`, `ctx.fs` | `tool/call`, `fs/observed after view presence/absence, edit absence, or successful mutation`, `tool/result` | - | Standalone view/create/unique literal replace/line insert tool over the filesystem seam; it composes with any shell or terminal API. | -| `@deepseek-ai/dsh-tool-fs` | `apply_patch`, `edit`, `read`, `read_image`, `write` | `ctx.workingDirectory`, `ctx.tools`, `ctx.fs`, `ctx.systemPrompt`, `ctx.attachments (image-tool registration)`, `ctx.llm + an image-capable route (image-tool execution)` | `tool/call`, `fs/write-intent or fs/edit-intent for mutations`, `fs/observed after read presence/absence or successful file operation`, `durable attachment (read_image)`, `tool/result` | - | The read-before-write/edit policy is added by `@deepseek-ai/dsh-fs-observation-policy` (an `fs/*` event-gate plugin, no schema change); a deployment that loads these tools is expected to also load it. The image tool is not registered without `ctx.attachments`; its schema is route-independent, and execution refuses unless the exact routed model declares image input. | +| `@deepseek-ai/dsh-tool-fs` | `apply_patch`, `edit`, `read`, `read_image`, `write` | `ctx.workingDirectory`, `ctx.tools`, `ctx.fs`, `ctx.systemPrompt`, `ctx.attachments (image-tool registration)`, `ctx.llm + an image-capable route (image-tool execution)` | `tool/call`, `fs/write-intent, fs/edit-intent, or fs/delete-intent for mutations`, `fs/observed after read presence/absence or successful file operation`, `durable attachment (read_image)`, `tool/result` | - | The read-before-write/edit policy is added by `@deepseek-ai/dsh-fs-observation-policy` (an `fs/*` event-gate plugin, no schema change); a deployment that loads these tools is expected to also load it. The image tool is not registered without `ctx.attachments`; its schema is route-independent, and execution refuses unless the exact routed model declares image input. | | `@deepseek-ai/dsh-tool-fs-search` | `glob`, `grep` | `ctx.workingDirectory`, `ctx.tools`, `ctx.subprocess`, `ctx.systemPrompt` | `tool/call`, `tool/result` | - | glob and grep are unconditional discovery tools that spawn the packaged ripgrep binary (`@vscode/ripgrep`) through ctx.subprocess as ordinary foreground calls (never background jobs) — no host `rg` install and no shell layer. The catalog uses `sampleOverCapGlobResults: true`; deployments must choose that behavior explicitly. Capped results save the complete formatted list through the optional ctx.spillStore backend; returned locators are follow-up-readable/searchable when the backend exposes local paths in co-located deployments. | | `@deepseek-ai/dsh-tool-terminal` | `terminal_close`, `terminal_list`, `terminal_open`, `terminal_read`, `terminal_send`, `terminal_signal` | `ctx.workingDirectory`, `ctx.tools`, `ctx.terminals`, `ctx.systemPrompt`, `ctx.jobs at call time for run_in_background` | `tool/call`, `tool/result` | - | The six terminal tools are opt-in and complement one-shot shell/filesystem tools. `terminal_send(run_in_background: true)` registers with `ctx.jobs`; TUI, named key sequences, BEL, resize, auto-start, and cross-agent sharing are absent from the schema. | | `@deepseek-ai/dsh-tool-goal` | `create_goal`, `get_goal`, `update_goal` | `ctx.tools`, `ctx.agents`, `ctx.goals`, `ctx.systemPrompt`, `a calling Agent in an authorized open turn` | `tool/call`, `goal/change for mutations`, `tool/result` | - | create, edit, pause, and resume require direct-human root authority; complete and blocked also accept the exact current goal round. The default blocked lower bound is three admitted rounds. | @@ -1009,7 +1009,7 @@ Create, update, delete, or move UTF-8 text files with one Codex-style patch; pre "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." } }, "required": [ diff --git a/docs/tool-catalog.zh.md b/docs/tool-catalog.zh.md index 05e67f6495..e9a150b2c7 100644 --- a/docs/tool-catalog.zh.md +++ b/docs/tool-catalog.zh.md @@ -1015,7 +1015,7 @@ pwsh 工具是 Windows 组合中 bash 执行器 seam 的 PowerShell 方言消费 "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." } }, "required": [ diff --git a/packages/client/ui-tool/README.i18n.yaml b/packages/client/ui-tool/README.i18n.yaml index dcfac1c9d8..532f5b459c 100644 --- a/packages/client/ui-tool/README.i18n.yaml +++ b/packages/client/ui-tool/README.i18n.yaml @@ -21,8 +21,8 @@ en: 2e3c306b13d3bc25 zh: 77127f01763b3976 /deepseek-ai-dsh-client-ui-tool/use-this-package/built-in-views: - en: ec5d7df3f08bacf7 - zh: f1388a87bf092285 + en: bb1e69cb3065aaf8 + zh: 130e9a722791548d /deepseek-ai-dsh-client-ui-tool/understand-the-implementation: en: 00bc7b0c84edc603 zh: 1cfcf5b435248a91 diff --git a/packages/client/ui-tool/README.md b/packages/client/ui-tool/README.md index 4b0eb76508..b2a1b54dc6 100644 --- a/packages/client/ui-tool/README.md +++ b/packages/client/ui-tool/README.md @@ -51,19 +51,12 @@ Every registered view receives the explicit `preparing`, `start`, and `result` p File-tool rows prefer a complete `file_path`; other generic rows, including search and unregistered tools, prefer a non-empty `description` before their variant-specific argument fallback. Read `args` during rendering or view construction: a preparing reader grows in place, and only previously observed answer changes trigger subsequent block publication. -This package owns the generic fallback and the built-in shell/pwsh, read, read_image, write/edit, running `str_replace_editor` `create`/`str_replace`, grep/glob, web, todo, question, and PTC dispatch presentations. Structured cards derive directly from first-party raw event fields; Host `presentCall` and `presentResult` values never enter the Client. Running atomic rows share one left-to-right highlight across their titles, separators, summaries, and suffixes, while settled rows stay static. Running and settled foreground standard `bash`/`pwsh` and `terminal_send` calls use terminal cards at the root and in PTC dispatch children, subject to the same argument, result, and error checks. Persistent `bash`/`pwsh` calls use terminal cards only while running. Shell output ending in a recognized spill-policy notice uses expandable generic output in shell rows and generic output in Details; a displaced or omitted exit marker cannot establish success. Settled persistent-shell results stay generic because reset and partial-output diagnostics do not always describe one process exit status; root persistent results are expandable. Valid explicit background `bash`/`pwsh` calls use the terminal Start presentation; a successful launch acknowledgement retains the command and cwd in a static command-only card without output or execution status. Launch failures retain generic arguments and errors, while background `terminal_send` stays generic. Inspect preserves the original arguments and acknowledgement; later job output is not attached to this card ([decision](../../../.agents/notes/implemented/bug-fix/2026-10-10-background-shell-command-display.md)). Expanded terminal commands and background inputs wrap to the available width while preserving authored line breaks and selectable text; terminal output keeps its column-preserving layout. Only horizontal overflow adds a named keyboard focus target. Inspect is available when provided. The acknowledgement does not report the job's exit status. A native or PTC dispatch failure carrying `AUTO_REVIEW_DENIED` shows the Auto review verdict in its collapsed row and one normalized not-executed reason when expanded; a missing or whitespace-only reason uses localized fallback text. `ui-skill` demonstrates a business-owned registration for `skill`. +This package owns the generic fallback and the built-in shell/pwsh, read, read_image, write/edit, `apply_patch`, running `str_replace_editor` `create`/`str_replace`, grep/glob, web, todo, question, and PTC dispatch presentations. The `apply_patch` row shares the write/edit component: it shows its title without a single-file summary, derives no diff while running, shows the applied hunks from settled `meta.diffs`, and a result whose metadata is marked stopped renders as an error with its failure text beside the known diffs. Structured cards derive directly from first-party raw event fields; Host `presentCall` and `presentResult` values never enter the Client. Running atomic rows share one left-to-right highlight across their titles, separators, summaries, and suffixes, while settled rows stay static. Running and settled foreground standard `bash`/`pwsh` and `terminal_send` calls use terminal cards at the root and in PTC dispatch children, subject to the same argument, result, and error checks. Persistent `bash`/`pwsh` calls use terminal cards only while running. Shell output ending in a recognized spill-policy notice uses expandable generic output in shell rows and generic output in Details; a displaced or omitted exit marker cannot establish success. Settled persistent-shell results stay generic because reset and partial-output diagnostics do not always describe one process exit status; root persistent results are expandable. Valid explicit background `bash`/`pwsh` calls use the terminal Start presentation; a successful launch acknowledgement retains the command and cwd in a static command-only card without output or execution status. Launch failures retain generic arguments and errors, while background `terminal_send` stays generic. Inspect preserves the original arguments and acknowledgement; later job output is not attached to this card ([decision](../../../.agents/notes/implemented/bug-fix/2026-10-10-background-shell-command-display.md)). Expanded terminal commands and background inputs wrap to the available width while preserving authored line breaks and selectable text; terminal output keeps its column-preserving layout. Only horizontal overflow adds a named keyboard focus target. Inspect is available when provided. The acknowledgement does not report the job's exit status. A native or PTC dispatch failure carrying `AUTO_REVIEW_DENIED` shows the Auto review verdict in its collapsed row and one normalized not-executed reason when expanded; a missing or whitespace-only reason uses localized fallback text. `ui-skill` demonstrates a business-owned registration for `skill`. Question rows pair answers with questions by id, using the tool result or the `userQuestions` projection for late replies. An answerable call has a button to reopen its panel. Once a late reply is in the agent Inbox, the row shows its submitted answers; “View answers” expands its read-only transcript while admission is pending. A settled call with answers opens the panel read-only. Closed calls without answers and invalid records offer no button. Cancelled and interrupted rows show their verdict without inventing answers. If no panel provider accepts the button action, it expands the row. Unsupported or ambiguous input falls back to flattened Tool text. Answer-panel buttons belong to the question renderer. It composes `DisclosureRow` with its own action and transcript; generic `ToolRow` does not select or dispatch question actions. - -| Tool | Title | Presentation | -|---|---|---| -| `apply_patch` | Apply patch | Edit row; settled `meta.diffs` only, with stopped result text beside known diffs | - -The patch row shows its title without a single-file summary. Running calls derive no diff; settled calls use known hunks from metadata, and a stopped commit retains its failure text alongside them. - ----- diff --git a/packages/client/ui-tool/README.zh.md b/packages/client/ui-tool/README.zh.md index b6cc7bbd44..365bdaf3a6 100644 --- a/packages/client/ui-tool/README.zh.md +++ b/packages/client/ui-tool/README.zh.md @@ -51,19 +51,12 @@ owner 载荷为 `ToolCallOwnerProps`:`callId`、`toolName`、`phase` 判别字 文件工具行优先使用完整的 `file_path`;其他通用行(包括搜索和未注册的工具)优先使用非空 `description`,再回退到各自类别的参数摘要。应在渲染或构造视图时读取 `args`:准备态读器原地增长,后续仅在已观察答案变化时重新发布块。 -本包拥有 generic fallback,以及 shell/pwsh、read、read_image、write/edit、运行中的 `str_replace_editor` `create`/`str_replace`、grep/glob、web、todo、question 与 PTC dispatch 的内置展示。结构化卡片直接从第一方原始 event 字段派生;Host `presentCall` 与 `presentResult` 值不会进入 Client。运行中的原子工具行以同一道高光从左到右扫过标题、分隔符、摘要与后缀;已完成行保持静态。运行中与已完成的前台标准 `bash`/`pwsh` 和 `terminal_send` 调用,无论位于根还是 PTC dispatch 子调用中,都在通过相同的参数、结果和错误检查后使用 terminal 卡片。持久 `bash`/`pwsh` 调用仅在运行中使用 terminal 卡片。以已识别的 spill 策略提示结尾的 shell 输出,在 shell 行中使用可展开的 generic 输出,在 Details 中使用 generic 输出;位置被改变或被省略的退出标记无法证明成功。已完成的持久 shell 结果保持 generic 展示,因为 reset 与部分输出诊断不一定描述单个进程的退出状态;根调用的持久 shell 结果可展开。合法的主动后台 `bash`/`pwsh` 调用使用 terminal Start 展示;成功启动回执后,静态仅命令卡片保留 command 和 cwd,不显示输出或执行状态。启动失败保留通用参数与错误展示,后台 `terminal_send` 仍为 generic。Inspect 保留原始参数及回执,后续 job 输出不接回此卡片([决定](../../../.agents/notes/implemented/bug-fix/2026-10-10-background-shell-command-display.zh.md))。展开的终端命令与后台输入按可用宽度自动折行,保留原有换行和可选文本;终端输出保持按列对齐的排版。仅横向溢出时添加具名的键盘聚焦目标。提供 Inspect 时也可使用。回执不表示后台任务的退出状态。带有 `AUTO_REVIEW_DENIED` 的原生或 PTC dispatch 失败会在折叠行显示 Auto review 裁决,展开时显示一行归一化后的“未执行”原因;原因缺失或只有空白时使用本地化 fallback 文案。`ui-skill` 展示了业务包自行拥有的 `skill` 注册项。 +本包拥有 generic fallback,以及 shell/pwsh、read、read_image、write/edit、`apply_patch`、运行中的 `str_replace_editor` `create`/`str_replace`、grep/glob、web、todo、question 与 PTC dispatch 的内置展示。`apply_patch` 行复用 write/edit 组件:显示工具标题而不给出单文件摘要,运行态不推导 diff,完成态展示 `meta.diffs` 中已应用的 hunk,元数据标记为停止的结果按错误呈现,并在已知 diff 旁保留失败文本。结构化卡片直接从第一方原始 event 字段派生;Host `presentCall` 与 `presentResult` 值不会进入 Client。运行中的原子工具行以同一道高光从左到右扫过标题、分隔符、摘要与后缀;已完成行保持静态。运行中与已完成的前台标准 `bash`/`pwsh` 和 `terminal_send` 调用,无论位于根还是 PTC dispatch 子调用中,都在通过相同的参数、结果和错误检查后使用 terminal 卡片。持久 `bash`/`pwsh` 调用仅在运行中使用 terminal 卡片。以已识别的 spill 策略提示结尾的 shell 输出,在 shell 行中使用可展开的 generic 输出,在 Details 中使用 generic 输出;位置被改变或被省略的退出标记无法证明成功。已完成的持久 shell 结果保持 generic 展示,因为 reset 与部分输出诊断不一定描述单个进程的退出状态;根调用的持久 shell 结果可展开。合法的主动后台 `bash`/`pwsh` 调用使用 terminal Start 展示;成功启动回执后,静态仅命令卡片保留 command 和 cwd,不显示输出或执行状态。启动失败保留通用参数与错误展示,后台 `terminal_send` 仍为 generic。Inspect 保留原始参数及回执,后续 job 输出不接回此卡片([决定](../../../.agents/notes/implemented/bug-fix/2026-10-10-background-shell-command-display.zh.md))。展开的终端命令与后台输入按可用宽度自动折行,保留原有换行和可选文本;终端输出保持按列对齐的排版。仅横向溢出时添加具名的键盘聚焦目标。提供 Inspect 时也可使用。回执不表示后台任务的退出状态。带有 `AUTO_REVIEW_DENIED` 的原生或 PTC dispatch 失败会在折叠行显示 Auto review 裁决,展开时显示一行归一化后的“未执行”原因;原因缺失或只有空白时使用本地化 fallback 文案。`ui-skill` 展示了业务包自行拥有的 `skill` 注册项。 问题行按 id 配对问题与答案;答案来自工具结果,迟到回答则来自 `userQuestions` 投影。可回答的调用提供按钮以重新打开面板。迟到回复进入 agent Inbox 后,问题行显示已提交的答案;等待准入期间,「查看回答」展开只读的行内记录。带有答案的已结算调用则以只读方式打开面板。没有答案的已关闭调用和无效记录不提供按钮。已取消和已中断的行显示裁决,不虚构答案。若面板提供方不接受按钮操作,点击会展开该行。不受支持或含糊的输入回退为压平的工具文本。 回答面板按钮归问题 renderer 所有。它使用 `DisclosureRow` 组合自己的操作与 transcript;通用 `ToolRow` 不选择或派发问题操作。 - -| 工具 | 标题 | 展示 | -|---|---|---| -| `apply_patch` | 应用补丁 | 编辑行;仅完成态使用 `meta.diffs`,已知 diff 旁保留停止原因文本 | - -补丁行显示工具标题,不给出单文件摘要。运行态不推导 diff;完成态读取元数据中的已知 hunk,停止的提交同时保留失败文本。 - ----- diff --git a/packages/client/ui-tool/src/client/tool/models/diff-card-model.ts b/packages/client/ui-tool/src/client/tool/models/diff-card-model.ts index d9bb7365bb..40c30215e7 100644 --- a/packages/client/ui-tool/src/client/tool/models/diff-card-model.ts +++ b/packages/client/ui-tool/src/client/tool/models/diff-card-model.ts @@ -94,18 +94,19 @@ function appliedDiffs(meta: unknown): DiffHunk[] | 'empty' | null { * A successful write with valid empty metadata uses its argument-derived * whole-file diff, matching create and identical-overwrite presentation; * `str_replace_editor` settles through Generic because it has no result view. + * A settled call whose arguments carry no single intended diff, such as a + * multi-file patch, shows only the applied diffs its result metadata records. * @param block - running or settled Tool block. * @returns the diff-card props, or null for the generic path. */ export function diffCardModel(block: ToolCallBlock): DiffCardModel | null { if (block.parentCallId !== undefined) return null - if ('kind' in block && block.call?.name === 'apply_patch') { - if (block.isError) return null + const intended = intendedDiff(block) + if (intended === null) { + if (!('kind' in block) || block.isError) return null const applied = appliedDiffs(block.meta) return applied === null || applied === 'empty' ? null : { card: { diffs: applied } } } - const intended = intendedDiff(block) - if (intended === null) return null if (!('kind' in block)) return { card: { diffs: [intended.diff] } } if (intended.tool === 'str_replace_editor') return null if (block.isError) return null diff --git a/packages/client/ui-tool/src/client/tool/models/tool-call-model.ts b/packages/client/ui-tool/src/client/tool/models/tool-call-model.ts index 65506898fa..8088575ef5 100644 --- a/packages/client/ui-tool/src/client/tool/models/tool-call-model.ts +++ b/packages/client/ui-tool/src/client/tool/models/tool-call-model.ts @@ -306,7 +306,8 @@ export function toolRowModel(toolName: string, block: ToolCallBlock, cwd?: strin const titleKey = toolTitleKey(toolName) const done = 'kind' in block const argsRaw = done ? block.call?.argsRaw ?? '' : block.phase === 'start' ? block.argsRaw : null - const patchStopped = toolName === 'apply_patch' && done && typeof block.meta === 'object' && block.meta !== null + // Result metadata marks a settled call that did not finish every requested effect. + const stopped = done && typeof block.meta === 'object' && block.meta !== null && !Array.isArray(block.meta) && (block.meta as Record).stopped === true const primary = argumentSummary(variant, block.args, cwd, home) const argumentPath = primary.filePath ?? (argsRaw === null ? undefined : deriveFilePath(variant, argsRaw)) @@ -317,7 +318,7 @@ export function toolRowModel(toolName: string, block: ToolCallBlock, cwd?: strin : recordedPath ?? (canUseArgumentPath ? argumentPath : undefined) const state: ToolRowState = !done ? block.phase === 'preparing' ? 'preparing' : 'running' : block.error?.code === 'interrupted' ? 'stopped' - : block.isError || patchStopped ? 'error' : 'ok' + : block.isError || stopped ? 'error' : 'ok' // The argument view serves every stage; the raw text is the fallback when it carries nothing useful. const base = toolName === 'apply_patch' ? '' : primary.summary !== '' || argsRaw === null ? primary.summary : argsRaw === '' ? block.callId diff --git a/packages/client/ui-tool/tests/diff-card.client.spec.tsx b/packages/client/ui-tool/tests/diff-card.client.spec.tsx index e18b7d902b..e9d09db38f 100644 --- a/packages/client/ui-tool/tests/diff-card.client.spec.tsx +++ b/packages/client/ui-tool/tests/diff-card.client.spec.tsx @@ -50,10 +50,11 @@ const settled = (over?: Partial): ToolResultNode => { } describe('diffCardModel', () => { - it('derives patch diffs only from settled metadata without parsing the patch', () => { + it('derives applied diffs from settled metadata when the arguments carry no single intended diff', () => { const call = { name: 'apply_patch', argsRaw: '{"patch":"invalid"}' } expect(diffCardModel(running(call))).toBeNull() expect(diffCardModel(settled({ call }))).toEqual({ card: { diffs: DIFFS } }) + expect(diffCardModel(settled({ call: null }))).toEqual({ card: { diffs: DIFFS } }) expect(diffCardModel(settled({ call, isError: true }))).toBeNull() expect(diffCardModel(settled({ call, meta: {} }))).toBeNull() expect(diffCardModel(settled({ call, meta: { diffs: [] } }))).toBeNull() @@ -137,8 +138,8 @@ describe('diffCardModel', () => { }) }) - it('returns null for missing calls, errors, malformed args, unrelated tools, and child dispatches', () => { - expect(diffCardModel(settled({ call: null }))).toBeNull() + it('returns null for errors, malformed args, unrelated tools, and child dispatches', () => { + expect(diffCardModel(settled({ call: null, meta: {} }))).toBeNull() expect(diffCardModel(settled({ isError: true }))).toBeNull() expect(diffCardModel(running({ argsRaw: '{' }))).toBeNull() expect(diffCardModel(running({ name: 'read' }))).toBeNull() diff --git a/packages/extensions/tool-cordis/src/api-catalog.ts b/packages/extensions/tool-cordis/src/api-catalog.ts index 41246769d0..1ab9df5968 100644 --- a/packages/extensions/tool-cordis/src/api-catalog.ts +++ b/packages/extensions/tool-cordis/src/api-catalog.ts @@ -1292,7 +1292,7 @@ export const SERVICE_API: readonly ServiceApiEntry[] = [ signature: 'abstract moveFile( source: FsTarget, destination: FsTarget, options: { hunks?: readonly PatchHunk[] expectedSource?: { version: FsVersion } expectedDestination?: FsWriteIntent }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise', description: 'Publish the source text, optionally patched, at the destination, then remove the source. Both targets stay locked in canonical order. Identical targets report `FS_SAME_TARGET`; the source guard follows `patchText` and the destination guard follows `writeText`. The two effects are separate: a published destination with a retained source is a final outcome reported through `sourceDeleted: false`.', parameters: [{ name: 'source', description: 'the resolved regular source; its line-ending style and mode carry over.' }, { name: 'destination', description: 'the resolved destination within the same provider.' }, { name: 'options', description: 'optional hunks and the source/destination guards; an omitted guard is unconditional.' }, { name: 'signal', description: 'checked before destination staging; the commit then completes both effects.' }, { name: 'sandboxPolicy', description: 'the per-call mode and workspace root both paths run under; a sandboxing backend fences them, the bare backend ignores it. Omit to leave the backend its own default.' }], - returns: 'the locked LF source text, the destination outcome, and the source-removal status.', + returns: 'the bounded LF source basis, the destination outcome, and the source-removal status.', }, ], }, @@ -5761,7 +5761,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'FsMoveOutcome', - declaration: 'export type FsMoveOutcome = {\n sourceBefore: string;\n destination: FsWriteOutcome;\n sourceDeleted: true;\n} | {\n sourceBefore: string;\n destination: FsWriteOutcome;\n sourceDeleted: false;\n sourceFailure: FsMoveSourceFailure;\n};', + declaration: 'export type FsMoveOutcome = {\n sourceBefore: string | null;\n destination: FsWriteOutcome;\n sourceDeleted: true;\n} | {\n sourceBefore: string | null;\n destination: FsWriteOutcome;\n sourceDeleted: false;\n sourceFailure: FsMoveSourceFailure;\n};', }, { name: 'FsMoveSourceFailure', diff --git a/packages/fs/README.i18n.yaml b/packages/fs/README.i18n.yaml index 71bfe0ceb3..d89809460c 100644 --- a/packages/fs/README.i18n.yaml +++ b/packages/fs/README.i18n.yaml @@ -9,14 +9,14 @@ en: 659c4654ba00d846 zh: 7107fd3d4d0e6f7c /packages-fs/summary: - en: 7d52fac0842e833e - zh: 53402054019f2e45 + en: dede47a1cff44fed + zh: c37941b1df99118d /packages-fs/table-of-contents: en: 1eb35b015a6c423f zh: a8a3dceee2c9e943 /packages-fs/packages: - en: 67ec32541e82a3f9 - zh: ef2b04f25e2ef634 + en: f6aedc7d3f84419d + zh: 387565b9ec6fe73c /packages-fs/related-documentation: en: 2682ce38d0a99122 zh: 6e794fcfd13c3ef3 diff --git a/packages/fs/README.md b/packages/fs/README.md index c9b9e157ba..cab75bc08a 100644 --- a/packages/fs/README.md +++ b/packages/fs/README.md @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -The `fs/` group gives agents durable, policy-governed access to files: the `ctx.fs` service contract in `fs/`, the host-filesystem and sandbox-enforcing backends in `fs-local/` and `fs-sandbox/`, the read-before-edit policy in `fs-observation-policy/`, and the model-facing tools in `tool-fs/` (`read`, `read_image`, `write`, `edit`) and `tool-fs-search/` (`glob`, `grep`). A deployment mounts one backend, loads the policy for freshness-guarded mutations, and registers the tool packages the model should see; backends swap without touching the tools or the policy. File I/O takes no timeout by design: a deadline would kill work the OS still finishes, so cancellation is a best-effort signal at syscall boundaries. +The `fs/` group gives agents durable, policy-governed access to files: the `ctx.fs` service contract in `fs/`, the host-filesystem and sandbox-enforcing backends in `fs-local/` and `fs-sandbox/`, the read-before-edit policy in `fs-observation-policy/`, and the model-facing tools in `tool-fs/` (`read`, `read_image`, `write`, `edit`, `apply_patch`) and `tool-fs-search/` (`glob`, `grep`). A deployment mounts one backend, loads the policy for freshness-guarded mutations, and registers the tool packages the model should see; backends swap without touching the tools or the policy. File I/O takes no timeout by design: a deadline would kill work the OS still finishes, so cancellation is a best-effort signal at syscall boundaries. ## Table of Contents @@ -28,10 +28,10 @@ The packages below provide filesystem access and patch parsing; the subsystem re |---|---|---| | [`fs/`](fs/README.md) | `ctx.fs` service contract: execution-world paths, bounded text I/O, and atomic mutations with an optional version guard | `ctx.fs` | | [`fs-patch/`](fs-patch/README.md) | Pure Codex-style patch parsing and hunk application | none | -| [`fs-local/`](fs-local/README.md) | Host-filesystem backend: reads, writes, and edits real files on the local machine | registers on `ctx.fs` | -| [`fs-sandbox/`](fs-sandbox/README.md) | Sandbox-enforcing backend: fences writes and edits by the per-call sandbox mode while reads pass through | registers on `ctx.fs` | -| [`fs-observation-policy/`](fs-observation-policy/README.md) | Read-before-edit policy: records observed presence or absence and guards write/edit through the `fs/*` events | `fs/*` listeners | -| [`tool-fs/`](tool-fs/README.md) | Model-facing `read`, `read_image`, `write`, and `edit` tools plus their executor | registers on `ctx.tools` | +| [`fs-local/`](fs-local/README.md) | Host-filesystem backend: reads, writes, edits, patches, deletes, and moves real files on the local machine | registers on `ctx.fs` | +| [`fs-sandbox/`](fs-sandbox/README.md) | Sandbox-enforcing backend: fences every mutation by the per-call sandbox mode while reads pass through | registers on `ctx.fs` | +| [`fs-observation-policy/`](fs-observation-policy/README.md) | Read-before-edit policy: records observed presence or absence and guards mutations through the `fs/*` events | `fs/*` listeners | +| [`tool-fs/`](tool-fs/README.md) | Model-facing `read`, `read_image`, `write`, `edit`, and `apply_patch` tools plus their executor | registers on `ctx.tools` | | [`tool-fs-search/`](tool-fs-search/README.md) | Model-facing `glob` and `grep` discovery tools backed by the packaged ripgrep binary | registers on `ctx.tools` | | [`tool-str-replace-editor/`](tool-str-replace-editor/README.md) | Standalone `str_replace_editor` tool: `view`, `create`, `str_replace`, and `insert` over `ctx.fs` | registers on `ctx.tools` | diff --git a/packages/fs/README.zh.md b/packages/fs/README.zh.md index aa62e09ace..917c90d21b 100644 --- a/packages/fs/README.zh.md +++ b/packages/fs/README.zh.md @@ -9,7 +9,7 @@ kind: "package-group" ## 概述 -`fs/` 组为 agent(智能体)提供持久、受策略约束的文件访问:`fs/` 定义 `ctx.fs` 服务约定,`fs-local/` 与 `fs-sandbox/` 提供宿主文件系统与沙箱强制后端,`fs-observation-policy/` 提供编辑前读取策略,`tool-fs/`(`read`、`read_image`、`write`、`edit`)与 `tool-fs-search/`(`glob`、`grep`)提供面向模型的工具。部署挂载一个后端,加载策略以获得新鲜度防护的变更,并注册模型应看到的工具包;后端可以更换,无需改动工具或策略。文件 I/O 有意不设超时:deadline 只会杀掉操作系统仍会完成的工作,因此取消只是系统调用边界的尽力而为信号。 +`fs/` 组为 agent(智能体)提供持久、受策略约束的文件访问:`fs/` 定义 `ctx.fs` 服务约定,`fs-local/` 与 `fs-sandbox/` 提供宿主文件系统与沙箱强制后端,`fs-observation-policy/` 提供编辑前读取策略,`tool-fs/`(`read`、`read_image`、`write`、`edit`、`apply_patch`)与 `tool-fs-search/`(`glob`、`grep`)提供面向模型的工具。部署挂载一个后端,加载策略以获得新鲜度防护的变更,并注册模型应看到的工具包;后端可以更换,无需改动工具或策略。文件 I/O 有意不设超时:deadline 只会杀掉操作系统仍会完成的工作,因此取消只是系统调用边界的尽力而为信号。 ## 目录 @@ -28,10 +28,10 @@ kind: "package-group" |---|---|---| | [`fs/`](fs/README.zh.md) | `ctx.fs` 服务约定:执行世界路径、有界文本 I/O,以及带可选版本防护的原子变更 | `ctx.fs` | | [`fs-patch/`](fs-patch/README.zh.md) | Codex 风格补丁的纯解析与 hunk 应用 | 无 | -| [`fs-local/`](fs-local/README.zh.md) | 宿主文件系统后端:读取、写入并编辑本机上的真实文件 | 注册到 `ctx.fs` | -| [`fs-sandbox/`](fs-sandbox/README.zh.md) | 沙箱强制后端:按每次调用的沙箱模式约束写入与编辑,读取直接通过 | 注册到 `ctx.fs` | -| [`fs-observation-policy/`](fs-observation-policy/README.zh.md) | 编辑前读取策略:记录观测到的存在或缺失,并通过 `fs/*` 事件防护写入/编辑 | `fs/*` 监听器 | -| [`tool-fs/`](tool-fs/README.zh.md) | 面向模型的 `read`、`read_image`、`write` 与 `edit` 工具及其执行器 | 注册到 `ctx.tools` | +| [`fs-local/`](fs-local/README.zh.md) | 宿主文件系统后端:读取、写入、编辑、打补丁、删除并移动本机上的真实文件 | 注册到 `ctx.fs` | +| [`fs-sandbox/`](fs-sandbox/README.zh.md) | 沙箱强制后端:按每次调用的沙箱模式约束全部变更,读取直接通过 | 注册到 `ctx.fs` | +| [`fs-observation-policy/`](fs-observation-policy/README.zh.md) | 编辑前读取策略:记录观测到的存在或缺失,并通过 `fs/*` 事件防护变更 | `fs/*` 监听器 | +| [`tool-fs/`](tool-fs/README.zh.md) | 面向模型的 `read`、`read_image`、`write`、`edit` 与 `apply_patch` 工具及其执行器 | 注册到 `ctx.tools` | | [`tool-fs-search/`](tool-fs-search/README.zh.md) | 由打包 ripgrep 二进制支持的面向模型 `glob` 与 `grep` 发现工具 | 注册到 `ctx.tools` | | [`tool-str-replace-editor/`](tool-str-replace-editor/README.zh.md) | 独立的 `str_replace_editor` 工具:基于 `ctx.fs` 的 `view`、`create`、`str_replace` 与 `insert` | 注册到 `ctx.tools` | diff --git a/packages/fs/fs-local/src/fsio.ts b/packages/fs/fs-local/src/fsio.ts index 5b8ea47522..a6e3da2bba 100644 --- a/packages/fs/fs-local/src/fsio.ts +++ b/packages/fs/fs-local/src/fsio.ts @@ -609,11 +609,11 @@ function writeIoError(path: string, error: unknown): unknown { * @param mode - POSIX mode to apply, or undefined to retain the new-file default. * @param signal - cancellation checked before final publication. * @param internals - Test hook for pinning temp names and observing the staged file. - * @param createIfAbsent - when provided, publish with a hard-link no-replace - * primitive; a concurrent creator's file is preserved and this write is - * rejected with `FS_NOT_OBSERVED` using the supplied display path. - * @param existingDestination - whether Windows must preserve destination security; defaults - * to mode presence for ordinary writes. Moves pass destination presence separately from source mode. + * @param options - `displayPath` names the target in diagnostics (defaults to `absolutePath`); + * `createIfAbsent` publishes with a hard-link no-replace primitive, so a concurrent creator's + * file is preserved and this write is rejected with `FS_NOT_OBSERVED`; `existingDestination` + * states whether Windows must preserve destination security and defaults to mode presence, + * while moves pass destination presence separately from the source mode. */ export async function writeFileAtomic( absolutePath: string, @@ -621,12 +621,13 @@ export async function writeFileAtomic( mode: number | undefined, signal: AbortSignal | undefined, internals: FsIoInternals = {}, - createIfAbsent?: { displayPath: string }, - existingDestination = mode !== undefined, + options: { displayPath?: string; createIfAbsent?: boolean; existingDestination?: boolean } = {}, ): Promise { + const displayPath = options.displayPath ?? absolutePath + const existingDestination = options.existingDestination ?? mode !== undefined throwIfAborted(signal, 'write') const directory = dirname(absolutePath) - try { await mkdir(directory, { recursive: true }) } catch (error) { throw writeIoError(absolutePath, error) } + try { await mkdir(directory, { recursive: true }) } catch (error) { throw writeIoError(displayPath, error) } throwIfAborted(signal, 'write') const stagingDirName = internals.tempDirName?.(absolutePath) ?? `.${basename(absolutePath)}.${process.pid}.${randomUUID()}.tmpdir` @@ -661,11 +662,11 @@ export async function writeFileAtomic( handle = undefined throwIfAborted(signal, 'write') - if (createIfAbsent !== undefined) { + if (options.createIfAbsent) { try { await linkFile(tempPath, absolutePath) } catch (error: unknown) { - await throwGuardedCreateFailure(error, absolutePath, createIfAbsent.displayPath, inspectPublicationTarget) + await throwGuardedCreateFailure(error, absolutePath, displayPath, inspectPublicationTarget) } } else if (platform === 'win32' && existingDestination) { try { @@ -686,7 +687,7 @@ export async function writeFileAtomic( } } catch (error: unknown) { /* v8 ignore next -- abort-mid-write needs a writeFile/signal race; the non-abort (rename/open) side is tested. */ - let failure: unknown = isAbortError(error) ? new FsError('write aborted', 'FS_ABORTED') : writeIoError(absolutePath, error) + let failure: unknown = isAbortError(error) ? new FsError('write aborted', 'FS_ABORTED') : writeIoError(displayPath, error) /* v8 ignore next 8 -- reached only if writeFile/sync throws with the handle open (IO fault); close-failure is a double fault. */ if (handle) { try { diff --git a/packages/fs/fs-local/src/index.ts b/packages/fs/fs-local/src/index.ts index 4171b7dcc4..e9ee2b8395 100644 --- a/packages/fs/fs-local/src/index.ts +++ b/packages/fs/fs-local/src/index.ts @@ -232,14 +232,8 @@ export class LocalFileSystem extends FileSystem { const before = diffable ? await readTextForDiff(target.targetKey, this.config.diffBasisMaxBytes, signal) : null - await writeFileAtomic( - target.targetKey, - content, - existing?.mode, - signal, - this.internals, - expected?.kind === 'createIfAbsent' ? { displayPath: target.displayPath } : undefined, - ) + await writeFileAtomic(target.targetKey, content, existing?.mode, signal, this.internals, + { displayPath: target.displayPath, createIfAbsent: expected?.kind === 'createIfAbsent' }) const after = await probe(target.targetKey) return { operation: existing ? 'update' : 'create', @@ -276,7 +270,7 @@ export class LocalFileSystem extends FileSystem { const original = await readForEdit(target.targetKey, target.displayPath, signal) const edited = applyLiteralEdit(original.content, edit.oldString, edit.newString, edit.replaceAll, target.displayPath) const content = restoreLineEndings(edited.content, original.lineEndings) - await writeFileAtomic(target.targetKey, content, existing.mode, signal, this.internals) + await writeFileAtomic(target.targetKey, content, existing.mode, signal, this.internals, { displayPath: target.displayPath }) const after = await probe(target.targetKey) return { @@ -296,7 +290,8 @@ export class LocalFileSystem extends FileSystem { const existing = await this.requireFile(target, expected, 'patch') const original = await readForEdit(target.targetKey, target.displayPath, signal) const after = this.patchContent(target, original.content, hunks) - await writeFileAtomic(target.targetKey, restoreLineEndings(after, original.lineEndings), existing.mode, signal, this.internals) + await writeFileAtomic(target.targetKey, restoreLineEndings(after, original.lineEndings), existing.mode, signal, this.internals, + { displayPath: target.displayPath }) return { version: this.versionAfterWrite(await probe(target.targetKey), target), before: original.content, after } }) } @@ -329,22 +324,24 @@ export class LocalFileSystem extends FileSystem { await this.internals.inspectBeforeMutation?.(source) if (signal?.aborted) throw new FsError('move aborted', 'FS_ABORTED') // After this checkpoint, complete both effects and report them even if cancellation arrives. - await writeFileAtomic(destination.targetKey, content, sourceInfo.mode, undefined, this.internals, - options.expectedDestination?.kind === 'createIfAbsent' ? { displayPath: destination.displayPath } : undefined, - existing !== null) + await writeFileAtomic(destination.targetKey, content, sourceInfo.mode, undefined, this.internals, { + displayPath: destination.displayPath, + createIfAbsent: options.expectedDestination?.kind === 'createIfAbsent', + existingDestination: existing !== null, + }) const outcome: FsWriteOutcome = { operation: existing ? 'update' : 'create', version: this.versionAfterWrite(await probe(destination.targetKey), destination), before, after, } + const sourceBefore = Buffer.byteLength(original.content, 'utf8') < this.config.diffBasisMaxBytes ? original.content : null try { await removeFile(source.targetKey, source.displayPath, this.internals) } catch (error) { // removeFile maps I/O failures; unexpected defects must still reject. if (!(error instanceof FsError)) throw error - return { sourceBefore: original.content, destination: outcome, sourceDeleted: false, - sourceFailure: { code: error.code, message: error.message } } + return { sourceBefore, destination: outcome, sourceDeleted: false, sourceFailure: { code: error.code, message: error.message } } } - return { sourceBefore: original.content, destination: outcome, sourceDeleted: true } + return { sourceBefore, destination: outcome, sourceDeleted: true } }) } diff --git a/packages/fs/fs-local/tests/fsio.spec.ts b/packages/fs/fs-local/tests/fsio.spec.ts index aa419bb9a5..05913db397 100644 --- a/packages/fs/fs-local/tests/fsio.spec.ts +++ b/packages/fs/fs-local/tests/fsio.spec.ts @@ -827,7 +827,7 @@ describe('writeFileAtomic — temp-file safety', () => { await expect(writeFileAtomic(file, 'ours', undefined, undefined, { linkFile: async () => { throw denied }, - }, { displayPath: file })).rejects.toMatchObject({ code: 'FS_IO_ERROR', cause: denied }) + }, { displayPath: file, createIfAbsent: true })).rejects.toMatchObject({ code: 'FS_IO_ERROR', cause: denied }) await expect(stat(file)).rejects.toMatchObject({ code: 'ENOENT' }) expect((await readdir(dir)).filter(name => name.includes('.tmp'))).toEqual([]) }) @@ -840,7 +840,7 @@ describe('writeFileAtomic — temp-file safety', () => { await expect(writeFileAtomic(file, 'ours', undefined, undefined, { linkFile: async () => { throw linkFailure }, inspectPublicationTarget: async () => { throw inspectionFailure }, - }, { displayPath: file })).rejects.toMatchObject({ code: 'FS_IO_ERROR', cause: inspectionFailure }) + }, { displayPath: file, createIfAbsent: true })).rejects.toMatchObject({ code: 'FS_IO_ERROR', cause: inspectionFailure }) await expect(stat(file)).rejects.toMatchObject({ code: 'ENOENT' }) expect((await readdir(dir)).filter(name => name.includes('.tmp'))).toEqual([]) }) @@ -851,7 +851,7 @@ describe('writeFileAtomic — temp-file safety', () => { await expect(writeFileAtomic(file, 'ours', undefined, undefined, { linkFile: async () => { throw collision }, - }, { displayPath: file })).rejects.toMatchObject({ + }, { displayPath: file, createIfAbsent: true })).rejects.toMatchObject({ code: 'FS_NOT_OBSERVED', message: `cannot overwrite existing "${file}" without reading it first`, cause: collision, @@ -866,7 +866,7 @@ describe('writeFileAtomic — temp-file safety', () => { await expect(writeFileAtomic(file, 'ours', undefined, undefined, { inspectTemp: async () => { await writeFile(file, 'competitor') }, - }, { displayPath })).rejects.toMatchObject({ + }, { displayPath, createIfAbsent: true })).rejects.toMatchObject({ code: 'FS_NOT_OBSERVED', message: `cannot overwrite existing "${displayPath}" without reading it first`, }) @@ -875,7 +875,7 @@ describe('writeFileAtomic — temp-file safety', () => { await rm(file) await expect(writeFileAtomic(file, 'ours', undefined, undefined, { inspectTemp: async () => { await mkdir(file) }, - }, { displayPath })).rejects.toMatchObject({ + }, { displayPath, createIfAbsent: true })).rejects.toMatchObject({ code: 'FS_NOT_REGULAR_FILE', message: `cannot write "${displayPath}": not a regular file`, }) @@ -888,7 +888,7 @@ describe('writeFileAtomic — temp-file safety', () => { await expect(writeFileAtomic(file, 'ours', undefined, undefined, { removeStagingDir: async () => { throw cleanupFailure }, - }, { displayPath: file })).resolves.toBeUndefined() + }, { displayPath: file, createIfAbsent: true })).resolves.toBeUndefined() expect(await readFile(file, 'utf8')).toBe('ours') }) @@ -1007,6 +1007,9 @@ describe('atomic write failures', () => { await expect(writeFileAtomic(target, 'content', undefined, undefined)).rejects.toMatchObject({ code: 'FS_PERMISSION_DENIED', message: `cannot write "${target}": permission denied`, }) + await expect(writeFileAtomic(target, 'content', undefined, undefined, {}, { displayPath: '~/shown' })).rejects.toMatchObject({ + code: 'FS_PERMISSION_DENIED', message: 'cannot write "~/shown": permission denied', + }) } expect(await readdir(locked)).toEqual([]) } finally { await chmod(locked, 0o755) } diff --git a/packages/fs/fs-local/tests/patch-mutations.spec.ts b/packages/fs/fs-local/tests/patch-mutations.spec.ts index 61e9d09255..dd7f6ef509 100644 --- a/packages/fs/fs-local/tests/patch-mutations.spec.ts +++ b/packages/fs/fs-local/tests/patch-mutations.spec.ts @@ -128,6 +128,15 @@ describe('moveFile', () => { if (process.platform !== 'win32') expect((await stat(join(root, 'nested/b'))).mode & 0o777).toBe(0o640) }) + it('bounds the source basis by diffBasisMaxBytes while still publishing the whole text', async () => { + const { fs, file, bytes } = await setup(16) + const text = `${'x'.repeat(32)}\n` + const source = await file('large', text) + const result = await fs.moveFile(source, await file('moved'), {}) + expect(result).toEqual({ sourceBefore: null, sourceDeleted: true, destination: { operation: 'create', version: expect.any(String) as string, before: null, after: text } }) + expect(await bytes('moved')).toBe(text) + }) + it('creates missing parent directories and applies hunks before publication', async () => { const { fs, file, bytes } = await setup() const source = await file('a', 'old\r\n') diff --git a/packages/fs/fs-patch/package.json b/packages/fs/fs-patch/package.json index f03a098c16..b886cd429e 100644 --- a/packages/fs/fs-patch/package.json +++ b/packages/fs/fs-patch/package.json @@ -1,6 +1,6 @@ { "name": "@deepseek-ai/dsh-fs-patch", - "description": "Pure Codex-style patch parser and affected-path collection", + "description": "Pure Codex-style patch parser and LF text updater with structured match failures", "version": "0.2.1-rc.2", "publishConfig": { "access": "public" diff --git a/packages/fs/fs-sandbox/README.i18n.yaml b/packages/fs/fs-sandbox/README.i18n.yaml index 1f5bd503cd..2bc2f48443 100644 --- a/packages/fs/fs-sandbox/README.i18n.yaml +++ b/packages/fs/fs-sandbox/README.i18n.yaml @@ -9,8 +9,8 @@ en: 68f0a0a66d33b6ec zh: 62fed2012166c111 /deepseek-ai-dsh-fs-sandbox/summary: - en: ae186a7675a9332b - zh: 323e9043c1d90a83 + en: 3fa6d9a13393ed2d + zh: d91675872102ae2a /deepseek-ai-dsh-fs-sandbox/table-of-contents: en: d152484eb41ac6b4 zh: 09388d293f9be9cb diff --git a/packages/fs/fs-sandbox/README.md b/packages/fs/fs-sandbox/README.md index f7dd84a051..f1f6ba320e 100644 --- a/packages/fs/fs-sandbox/README.md +++ b/packages/fs/fs-sandbox/README.md @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -`dsh-fs-sandbox` confines model file writes and edits according to each session's sandbox mode while preserving the local filesystem's read behavior. In `read-only`, it rejects every mutation; in `workspace-write`, it permits targets only inside the session workspace or a platform temporary root; in `danger-full-access`, it does not restrict mutations. Use it instead of `fs-local` with `ctx.sandboxPolicy` when sessions need workspace-confined file changes. Denied operations return `FS_SANDBOX_DENIED`, which filesystem tools present with the active mode and a same-turn escalation hint. +`dsh-fs-sandbox` confines model file writes, edits, patches, deletions, and moves according to each session's sandbox mode while preserving the local filesystem's read behavior. In `read-only`, it rejects every mutation; in `workspace-write`, it permits targets only inside the session workspace or a platform temporary root; in `danger-full-access`, it does not restrict mutations. Use it instead of `fs-local` with `ctx.sandboxPolicy` when sessions need workspace-confined file changes. Denied operations return `FS_SANDBOX_DENIED`, which filesystem tools present with the active mode and a same-turn escalation hint. ## Table of Contents diff --git a/packages/fs/fs-sandbox/README.zh.md b/packages/fs/fs-sandbox/README.zh.md index 450e902b19..ecd33cd78f 100644 --- a/packages/fs/fs-sandbox/README.zh.md +++ b/packages/fs/fs-sandbox/README.zh.md @@ -9,7 +9,7 @@ kind: "package-reference" ## 概述 -`dsh-fs-sandbox` 按各会话的沙箱模式限制模型对文件的写入与编辑,同时保留本地文件系统的读取行为。`read-only` 拒绝所有变更;`workspace-write` 只允许目标位于会话工作区或平台临时根目录内;`danger-full-access` 不限制变更。当会话需要将文件变更限制在工作区内时,使用它代替 `fs-local`,并加载 `ctx.sandboxPolicy`。被拒绝的操作返回 `FS_SANDBOX_DENIED`,文件系统工具会显示当前模式和同轮次升级提示。 +`dsh-fs-sandbox` 按各会话的沙箱模式限制模型对文件的写入、编辑、打补丁、删除与移动,同时保留本地文件系统的读取行为。`read-only` 拒绝所有变更;`workspace-write` 只允许目标位于会话工作区或平台临时根目录内;`danger-full-access` 不限制变更。当会话需要将文件变更限制在工作区内时,使用它代替 `fs-local`,并加载 `ctx.sandboxPolicy`。被拒绝的操作返回 `FS_SANDBOX_DENIED`,文件系统工具会显示当前模式和同轮次升级提示。 ## 目录 diff --git a/packages/fs/fs/src/index.ts b/packages/fs/fs/src/index.ts index 3c0566251b..a49e7ff0e2 100644 --- a/packages/fs/fs/src/index.ts +++ b/packages/fs/fs/src/index.ts @@ -362,7 +362,7 @@ export abstract class FileSystem extends Service { * @param sandboxPolicy - the per-call mode and workspace root both paths run * under; a sandboxing backend fences them, the bare backend ignores it. * Omit to leave the backend its own default. - * @returns the locked LF source text, the destination outcome, and the source-removal status. + * @returns the bounded LF source basis, the destination outcome, and the source-removal status. */ abstract moveFile( source: FsTarget, diff --git a/packages/fs/fs/src/types.ts b/packages/fs/fs/src/types.ts index a0ab70ddef..6ece2c04e4 100644 --- a/packages/fs/fs/src/types.ts +++ b/packages/fs/fs/src/types.ts @@ -181,10 +181,10 @@ export interface FsMoveSourceFailure { message: string } -/** Published destination and removal status; sourceBefore is the LF source text captured under the move lock. */ +/** Published destination and removal status; sourceBefore is the bounded LF source basis captured under the move lock. */ export type FsMoveOutcome = - | { sourceBefore: string; destination: FsWriteOutcome; sourceDeleted: true } - | { sourceBefore: string; destination: FsWriteOutcome; sourceDeleted: false; sourceFailure: FsMoveSourceFailure } + | { sourceBefore: string | null; destination: FsWriteOutcome; sourceDeleted: true } + | { sourceBefore: string | null; destination: FsWriteOutcome; sourceDeleted: false; sourceFailure: FsMoveSourceFailure } /** Stable filesystem failure codes shared by providers, consumers, and wire validators. */ export const FS_ERROR_CODES = [ diff --git a/packages/fs/tool-fs/README.i18n.yaml b/packages/fs/tool-fs/README.i18n.yaml index 457c2dc9f5..37030fb254 100644 --- a/packages/fs/tool-fs/README.i18n.yaml +++ b/packages/fs/tool-fs/README.i18n.yaml @@ -30,8 +30,8 @@ en: 53d4ac2db089ef39 zh: 214ea051ed56f500 /deepseek-ai-dsh-tool-fs/use-this-package/failures-and-recovery: - en: 448f8afbbf3a90d1 - zh: e87db5c1868cc94e + en: f7c7834de37e1ece + zh: ff08efcf7c08379a /deepseek-ai-dsh-tool-fs/understand-the-implementation: en: e30f7038c28e93f8 zh: a3868dbd90367b13 @@ -39,14 +39,14 @@ en: 1f4d7213aa3d0d60 zh: aa6573f96c8b5220 /deepseek-ai-dsh-tool-fs/understand-the-implementation/source-map: - en: 7cda5167ece32686 - zh: 30a00318f70bf5d5 + en: 459b773aafc6c163 + zh: ccd729aded7d98ba /deepseek-ai-dsh-tool-fs/understand-the-implementation/per-tool-flow: - en: 9e75dd547b41ce02 - zh: 62184c725aaf862c + en: 35fbee1ef9811806 + zh: 17c725e2b742c073 /deepseek-ai-dsh-tool-fs/understand-the-implementation/observation-and-concurrency: - en: 6a54598ec69f6f20 - zh: 27d31d22ee926622 + en: 2bd1d4eb86c2b360 + zh: 2a52540af8c85e5f /deepseek-ai-dsh-tool-fs/further-exploration: en: 485bc55482f576bc zh: fc5fa55b41098bd0 diff --git a/packages/fs/tool-fs/README.md b/packages/fs/tool-fs/README.md index 6b468e46f4..169de9c7cd 100644 --- a/packages/fs/tool-fs/README.md +++ b/packages/fs/tool-fs/README.md @@ -81,7 +81,7 @@ With the policy plugin mounted, `write` and `edit` obtain their guard from the ` ### Failures and recovery -For `apply_patch`, syntax and preflight refusals throw with `isError: true` before any disk change. `FsError` preserves filesystem codes; `PatchToolError extends HarnessError` carries `PATCH_SYNTAX` and `PATCH_SYMLINK_SOURCE`. Once commit starts, the tool returns a value with `isError: false` even on failure or uncertainty, so known partial effects retain their diff metadata. `phase`, `cancelled`, ordered `operations` and `affectedPaths` describe the commit; each operation retains its index, kind, display paths, patch line, status, diagnostic and known changes. Full `before`/`after` text serves rendering and PTC; the Session stores the rendered result plus `meta.diffs` and `meta.stopped`. Deletions and move sources use `newText: ''` in diff metadata because `FileDiff.newText` cannot be null. +For `apply_patch`, syntax and preflight refusals throw with `isError: true` before any disk change. `FsError` preserves filesystem codes; `PatchToolError extends HarnessError` carries `PATCH_SYNTAX` and `PATCH_SYMLINK_SOURCE`. Once commit starts, the tool returns a value with `isError: false` even on failure or uncertainty, so known partial effects retain their diff metadata; a call cancelled during commit receives the tool registry's abort result like every other tool, and its completed changes remain visible through Review. `phase`, `cancelled`, ordered `operations` and `affectedPaths` describe the commit; each operation retains its index, kind, display paths, patch line, status, diagnostic and known changes. Full `before`/`after` text serves rendering and PTC; the Session stores the rendered result plus `meta.diffs` and `meta.stopped`. Creations store no diff, as for `write`; deletions and move sources store a removal diff only when the provider returned a bounded basis, using `newText: ''` because `FileDiff.newText` cannot be null. Failures are normalized as `Error: ` with a structured code preserved for callers. Stable messages include `file_path must be a non-empty string`, `limit must be less than or equal to `, `cannot read "": not found`, `cannot read "": not a regular file`, and the image-route refusal `cannot read "" as an image: model "" does not declare image input; switch to an image-capable model to read images`. `FS_NOT_OBSERVED` is normalized to `cannot modify "": file has not been read — read the file, then retry`, independent of whether the policy or provider rejected the operation; `FS_STALE_VERSION` retains the provider's reason and appends `— re-read the file, then retry`. After the reread confirms absence, `edit` reports `FS_NOT_FOUND` instead of repeating a stale remedy, while `write` uses guarded creation. @@ -112,7 +112,7 @@ The tools are the executor; policy is an event gate. The tools inject no policy | [`src/edit.ts`](src/edit.ts) | `edit` executor: intent waterfall, literal edit, observation | | [`src/patch/index.ts`](src/patch/index.ts), [`types.ts`](src/patch/types.ts) | Internal `executePatch` entry and serializable per-operation reports | | [`src/patch/plan.ts`](src/patch/plan.ts) | Parse and resolve Session-relative paths; preserve ordered operations sharing a canonical target | -| [`src/patch/preflight.ts`](src/patch/preflight.ts) | Simulate preceding successes and collect observation, sandbox, type, and hunk failures before any write | +| [`src/patch/preflight.ts`](src/patch/preflight.ts) | Simulate preceding successes and collect observation, type, text, and hunk failures before any write | | [`src/patch/execute.ts`](src/patch/execute.ts) | Reacquire guards, commit sequentially, record actual effects, and classify uncertain failures | | [`src/read-render.ts`](src/read-render.ts) | Cordis-free windowing and envelope formatting | | [`src/sandbox.ts`](src/sandbox.ts) | Escalation API shared by the mutating tools: policy resolution and denial-marker mapping | @@ -123,7 +123,7 @@ The tools are the executor; policy is an event gate. The tools inject no policy All four tools share one flow shape: resolve the path with the calling session's cwd, run the applicable gate, perform exactly one provider operation, and emit `fs/observed` only after success. `read` and `read_image` pay one `stat` for type and size routing; `write` and `edit` pay none because their guard comes from the intent slot, and provider failures surface as typed `FsError` results. The per-tool executors live in `src/read.ts`, `src/read-image.ts`, `src/write.ts`, and `src/edit.ts`. -The internal patch executor accepts a raw patch and an already resolved sandbox policy. It builds an ordered plan, preflights all operations against simulated state, then commits through `writeText`, `patchText`, `deleteFile`, or one `moveFile` call. A refused preflight operation has no simulated effect, and any refusal prevents every write. A syntax report carries the parser failure; a preflight report lists the refused operations; a commit report keeps one entry per operation with `completed`, `failed`, `unknown`, or `skipped` status and known LF text changes. Unresolved paths retain their raw patch spelling; resolved paths use provider display paths. Programming errors reject the call. +The internal patch executor accepts a raw patch and an already resolved sandbox policy. It builds an ordered plan, preflights all operations against simulated state, then commits through `writeText`, `patchText`, `deleteFile`, or one `moveFile` call. A refused preflight operation has no simulated effect, and any refusal prevents every write. Sandbox containment is not simulated: the provider decides it at each commit, as for `write` and `edit`, so a denied operation stops the patch with the earlier operations retained. A syntax report carries the parser failure; a preflight report lists the refused operations; a commit report keeps one entry per operation with `completed`, `failed`, `unknown`, or `skipped` status and known LF text changes. Unresolved paths retain their raw patch spelling; resolved paths use provider display paths. Programming errors reject the call. ### Observation and concurrency @@ -131,7 +131,7 @@ The internal patch executor accepts a raw patch and an already resolved sandbox Patch preflight reads never emit `fs/observed`. The first preflight operation on a target dispatches its intent; later operations on that target use the simulated state. Each commit dispatches its intents again to obtain current guards. Add and update record presence, delete records absence, and move records its destination plus source absence only after successful removal; a partial move is `failed` with a destination-only change. The move source baseline comes from `moveFile` under its lock. -After a mutation rejects with `FS_IO_ERROR` or `FS_ABORTED`, the executor compares each affected target's version with a fresh `stat` taken without the cancelled signal. Unchanged targets mean a known failure; a changed target or failed comparison means `unknown`, which records no observation or change. Execution stops at the first failed or unknown commit, or before an operation whose signal is aborted. +After a mutation rejects with `FS_IO_ERROR`, the executor compares each affected target's version with a fresh `stat`. Unchanged targets mean a known failure; a changed target or failed comparison means `unknown`, which records no observation or change. `FS_ABORTED` is always `unknown`: a cancelled remote request rejects while the provider may still be writing. Execution stops at the first failed or unknown commit, or before an operation whose signal is aborted. @@ -265,7 +265,7 @@ The `apply_patch` schema requires one `patch` string containing `*** Begin Patch ##### System guidance ```markdown -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. ``` ##### Result examples diff --git a/packages/fs/tool-fs/README.zh.md b/packages/fs/tool-fs/README.zh.md index 314818b5a9..5cb2a7e3de 100644 --- a/packages/fs/tool-fs/README.zh.md +++ b/packages/fs/tool-fs/README.zh.md @@ -81,7 +81,7 @@ kind: "package-reference" ### 失败与恢复 -`apply_patch` 的语法与预检拒绝在磁盘变更前抛错,结果为 `isError: true`。`FsError` 保留文件系统错误码;`PatchToolError extends HarnessError` 携带 `PATCH_SYNTAX` 和 `PATCH_SYMLINK_SOURCE`。进入提交后,即使失败或结果不确定也返回 `isError: false` 的值,确保已知部分效果的 diff 元数据得以保留。`phase`、`cancelled`、有序 `operations` 与 `affectedPaths` 描述提交;每条操作保留索引、种类、展示路径、补丁行号、状态、诊断与已知变更。完整 `before`/`after` 文本供渲染和 PTC 使用;Session 保存渲染文本以及 `meta.diffs` 与 `meta.stopped`。删除与移动源在 diff 元数据中使用 `newText: ''`,因为 `FileDiff.newText` 不可为 null。 +`apply_patch` 的语法与预检拒绝在磁盘变更前抛错,结果为 `isError: true`。`FsError` 保留文件系统错误码;`PatchToolError extends HarnessError` 携带 `PATCH_SYNTAX` 和 `PATCH_SYMLINK_SOURCE`。进入提交后,即使失败或结果不确定也返回 `isError: false` 的值,确保已知部分效果的 diff 元数据得以保留;提交期间被取消的调用与其他工具一样收到工具注册表的中止结果,已完成的变更仍可通过 Review 查看。`phase`、`cancelled`、有序 `operations` 与 `affectedPaths` 描述提交;每条操作保留索引、种类、展示路径、补丁行号、状态、诊断与已知变更。完整 `before`/`after` 文本供渲染和 PTC 使用;Session 保存渲染文本以及 `meta.diffs` 与 `meta.stopped`。新建与 `write` 一样不保存 diff;删除与移动源仅在提供方返回有界基线时保存删除 diff,并使用 `newText: ''`,因为 `FileDiff.newText` 不可为 null。 失败被规范化为 `Error: `,并为调用方保留结构化错误码。稳定消息包括 `file_path must be a non-empty string`、`limit must be less than or equal to `、`cannot read "": not found`、`cannot read "": not a regular file`,以及图像路由拒绝 `cannot read "" as an image: model "" does not declare image input; switch to an image-capable model to read images`。无论拒绝来自策略还是提供方,`FS_NOT_OBSERVED` 都规范化为 `cannot modify "": file has not been read — read the file, then retry`;`FS_STALE_VERSION` 保留提供方原因并追加 `— re-read the file, then retry`。该次重新读取确认缺失后,`edit` 报告 `FS_NOT_FOUND` 而不会重复陈旧恢复指令,`write` 则使用防护创建。 @@ -112,7 +112,7 @@ kind: "package-reference" | [`src/edit.ts`](src/edit.ts) | `edit` 执行器:意图 waterfall、字面量编辑、观察 | | [`src/patch/index.ts`](src/patch/index.ts)、[`types.ts`](src/patch/types.ts) | 内部 `executePatch` 入口与可序列化的逐操作报告 | | [`src/patch/plan.ts`](src/patch/plan.ts) | 解析补丁并按 Session 工作目录解析路径;保留共享规范化目标的有序操作 | -| [`src/patch/preflight.ts`](src/patch/preflight.ts) | 模拟前序成功操作,在任何写入前收集观察、沙箱、类型与 hunk 失败 | +| [`src/patch/preflight.ts`](src/patch/preflight.ts) | 模拟前序成功操作,在任何写入前收集观察、类型、文本与 hunk 失败 | | [`src/patch/execute.ts`](src/patch/execute.ts) | 重新获取防护、顺序提交、记录实际效果并判断不确定失败 | | [`src/read-render.ts`](src/read-render.ts) | 不依赖 Cordis 的窗口构建与信封格式化 | | [`src/sandbox.ts`](src/sandbox.ts) | 各变更工具共享的升权 API:策略解析与拒绝标记映射 | @@ -123,7 +123,7 @@ kind: "package-reference" 四个工具共享同一种流程形态:用调用会话的 cwd 解析路径、运行适用的门禁、恰好执行一次提供方操作,并且只在成功后发出 `fs/observed`。`read` 与 `read_image` 为类型与大小路由付出一次 `stat`;`write` 与 `edit` 不执行 stat,因为防护来自意图槽位,提供方失败以类型化 `FsError` 结果呈现。各工具执行器位于 `src/read.ts`、`src/read-image.ts`、`src/write.ts` 与 `src/edit.ts`。 -内部补丁执行器接收原始补丁和已解析的沙箱策略。它建立有序计划,针对模拟状态预检全部操作,再通过 `writeText`、`patchText`、`deleteFile` 或一次 `moveFile` 调用提交。被预检拒绝的操作不产生模拟效果,任何拒绝都会阻止全部写入。语法报告携带解析器失败;预检报告列出被拒绝的操作;提交报告为每个操作保留 `completed`、`failed`、`unknown` 或 `skipped` 状态及已知的 LF 文本变化。未解析的路径保留补丁原始写法;已解析的路径使用提供方显示路径。编程错误使调用拒绝。 +内部补丁执行器接收原始补丁和已解析的沙箱策略。它建立有序计划,针对模拟状态预检全部操作,再通过 `writeText`、`patchText`、`deleteFile` 或一次 `moveFile` 调用提交。被预检拒绝的操作不产生模拟效果,任何拒绝都会阻止全部写入。沙箱围栏不参与模拟:与 `write`、`edit` 一样由提供方在每次提交时判断,被拒绝的操作使补丁停止并保留之前的操作。语法报告携带解析器失败;预检报告列出被拒绝的操作;提交报告为每个操作保留 `completed`、`failed`、`unknown` 或 `skipped` 状态及已知的 LF 文本变化。未解析的路径保留补丁原始写法;已解析的路径使用提供方显示路径。编程错误使调用拒绝。 ### 观察与并发 @@ -131,7 +131,7 @@ kind: "package-reference" 补丁预检读取从不发出 `fs/observed`。对目标的首次预检操作分发意图;同一目标的后续操作使用模拟状态。每次提交重新分发意图以取得当前防护。新增与更新记录存在,删除记录缺失,移动记录目标存在,且仅在源删除成功后记录源缺失;部分移动为 `failed`,只包含目标变化。移动源基线由 `moveFile` 在锁内返回。 -变更以 `FS_IO_ERROR` 或 `FS_ABORTED` 拒绝后,执行器使用不携带已取消信号的新 `stat` 比较每个受影响目标的版本。全部未变表示已知失败;任何目标已变或比较失败均为 `unknown`,不记录观察或变化。执行在首个失败或未知提交后停止,或在信号已取消的操作开始前停止。 +变更以 `FS_IO_ERROR` 拒绝后,执行器使用新的 `stat` 比较每个受影响目标的版本。全部未变表示已知失败;任何目标已变或比较失败均为 `unknown`,不记录观察或变化。`FS_ABORTED` 一律为 `unknown`:被取消的远端请求在提供方可能仍在写入时就已拒绝。执行在首个失败或未知提交后停止,或在信号已取消的操作开始前停止。 @@ -265,7 +265,7 @@ Read a file before editing it (the default fs-observation-policy requires it), u ##### 系统提示 ```markdown -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. ``` ##### 结果示例 diff --git a/packages/fs/tool-fs/src/apply-patch-output.ts b/packages/fs/tool-fs/src/apply-patch-output.ts index cd33d2cf64..5388b46dba 100644 --- a/packages/fs/tool-fs/src/apply-patch-output.ts +++ b/packages/fs/tool-fs/src/apply-patch-output.ts @@ -3,7 +3,7 @@ import { FsError } from '@deepseek-ai/dsh-fs' import { HarnessError } from '@deepseek-ai/dsh-llm' import { computeHunkDiffs } from './diff.ts' import type { FileDiff, InferValue } from '@deepseek-ai/dsh-tools' -import type { PatchExecutionReport, PatchFailureCode } from './patch/types.ts' +import type { PatchExecutionReport, PatchFailureCode, PatchRefusal } from './patch/types.ts' /** Strict canonical output; full file texts feed rendering and are excluded from presentation metadata. */ export const patchOutputSchema = { @@ -48,20 +48,29 @@ function rejection(code: PatchFailureCode, message: string): HarnessError { ? new PatchToolError(message, code) : new FsError(message, code) } +function refusalError(first: PatchRefusal, ...rest: PatchRefusal[]): HarnessError { + const refusals = [first, ...rest] + const lines = refusals.map(({ operation, failure }) => + `- operation ${operation.index + 1} (${operation.kind} ${operation.path}, patch line ${operation.patchLine}): ${failure.message}`) + return rejection(first.failure.code, `Patch rejected before any change (${refusals.length} problems):\n${lines.join('\n')}`) +} + /** - * Convert a report into a commit value, or reject before any disk change. + * Convert a report into a commit value, or reject while no disk change exists. + * A commit whose first operation failed without any change, such as a provider sandbox + * denial, rejects like a preflight refusal so the error code reaches the same retry paths. * @param report - executor report. * @returns a flat, lossless JSON commit value, including partial failures. - * @throws FsError or PatchToolError for syntax or preflight refusals. + * @throws FsError or PatchToolError for syntax, preflight, or first-operation refusals. */ export function patchToolValue(report: PatchExecutionReport): PatchToolValue { if (report.phase === 'syntax') { throw rejection(report.failure.code, report.failure.message) } - if (report.phase === 'preflight') { - const lines = report.refusals.map(({ operation, failure }) => - `- operation ${operation.index + 1} (${operation.kind} ${operation.path}, patch line ${operation.patchLine}): ${failure.message}`) - throw rejection(report.refusals[0].failure.code, `Patch rejected before any change (${report.refusals.length} problems):\n${lines.join('\n')}`) + if (report.phase === 'preflight') throw refusalError(...report.refusals) + const [first, ...rest] = report.outcomes + if (first?.status === 'failed' && first.changes.length === 0 && rest.every(outcome => outcome.status === 'skipped')) { + throw refusalError(first) } return { phase: 'commit', cancelled: report.cancelled, affectedPaths: report.affectedPaths, operations: report.outcomes.map(outcome => ({ @@ -120,7 +129,8 @@ export function renderPatch(value: PatchToolValue): string { /** * Derive hunks only from known completed effects, including a partial move destination. - * @param value - canonical commit value containing whole-file baselines. + * Creations store no diff, as for `write`; a removal without a bounded basis stores none either. + * @param value - canonical commit value containing the provider's bounded baselines. * @returns serializable diff hunks and an explicit stopped flag; no whole-file change records. */ export function patchPresentationMeta(value: PatchToolValue): { @@ -130,7 +140,7 @@ export function patchPresentationMeta(value: PatchToolValue): { const diffs = value.operations.flatMap((operation) => { if (operation.status !== 'completed' && operation.status !== 'failed') return [] return (operation.changes ?? []).flatMap(({ path, before, after }): FileDiff[] => { - if (before === null) return [{ path, oldText: null, newText: after ?? '' }] + if (before === null) return [] if (after === null) return [{ path, oldText: before, newText: '' }] return computeHunkDiffs(path, before, after) }) diff --git a/packages/fs/tool-fs/src/apply-patch-presentation.ts b/packages/fs/tool-fs/src/apply-patch-presentation.ts index 18d2f67a90..fb85129c61 100644 --- a/packages/fs/tool-fs/src/apply-patch-presentation.ts +++ b/packages/fs/tool-fs/src/apply-patch-presentation.ts @@ -6,6 +6,7 @@ import { diffsFromMeta, stoppedFromMeta } from './diff.ts' /** * Preview the requested operations without resolving paths or reading the filesystem. + * A deletion has no diff text to preview and appears only among the locations. * @param patch - raw patch argument. * @returns a diff call view, or undefined when syntax is invalid. */ @@ -15,20 +16,21 @@ export function presentPatchCall(patch: string): DiffCallView | undefined { if (!(error instanceof PatchParseError)) throw error return undefined } - const diffs = operations.map((operation): FileDiff => { + const diffs = operations.flatMap((operation): FileDiff[] => { const path = operation.path switch (operation.kind) { - case 'add': return { path, oldText: null, newText: operation.content } - case 'delete': return { path, oldText: null, newText: '' } - case 'update': return { path, oldText: operation.hunks.flatMap(hunk => hunk.oldLines).join('\n') || null, - newText: operation.hunks.flatMap(hunk => hunk.newLines).join('\n') } + case 'add': return [{ path, oldText: null, newText: operation.content }] + case 'delete': return [] + case 'update': return [{ path, oldText: operation.hunks.flatMap(hunk => hunk.oldLines).join('\n') || null, + newText: operation.hunks.flatMap(hunk => hunk.newLines).join('\n') }] /* v8 ignore next -- Exhaustive closed parser union. */ default: return assertNever(operation) } }) - return { card: 'diff', title: `Apply patch (${operations.length} files)`, diffs, - locations: operations.flatMap(operation => [{ path: operation.path }, - ...operation.kind === 'update' && operation.moveTo !== undefined ? [{ path: operation.moveTo }] : []]), + const paths = new Set(operations.flatMap(operation => + operation.kind === 'update' && operation.moveTo !== undefined ? [operation.path, operation.moveTo] : [operation.path])) + return { card: 'diff', title: `Apply patch (${paths.size} ${paths.size === 1 ? 'file' : 'files'})`, diffs, + locations: [...paths].map(path => ({ path })), } } diff --git a/packages/fs/tool-fs/src/apply-patch.ts b/packages/fs/tool-fs/src/apply-patch.ts index d405024ad5..55268936fc 100644 --- a/packages/fs/tool-fs/src/apply-patch.ts +++ b/packages/fs/tool-fs/src/apply-patch.ts @@ -19,7 +19,7 @@ export function applyApplyPatchTool(ctx: Context, sandbox: FsSandboxController): name: 'tool:apply_patch', order: ctx.systemPrompt.getSectionOrder('TOOL_APPLY_PATCH'), text: ({ scope }) => ctx.tools.get('apply_patch', scope) === undefined ? '' : 'Prefer apply_patch over separate edit calls for changes across files or separated regions. ' - + 'Read files before updating or deleting them when the observation policy is enabled. ' + + 'Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. ' + 'Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed.', }) ctx.tools.register(defineTool({ @@ -32,7 +32,7 @@ export function applyApplyPatchTool(ctx: Context, sandbox: FsSandboxController): + 'Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, ' + 'with @@ or @@ context and space-prefixed context, + added, or - removed lines; ' + '*** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. ' - + 'Paths are relative to the Session working directory. Read existing files before updating them.', + + 'Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them.', }, ...sandbox.escalationModes.length > 0 ? sandbox.schemaFields() : {}, }, diff --git a/packages/fs/tool-fs/src/patch/execute.ts b/packages/fs/tool-fs/src/patch/execute.ts index 37cd5f3bda..c6cf6da5a7 100644 --- a/packages/fs/tool-fs/src/patch/execute.ts +++ b/packages/fs/tool-fs/src/patch/execute.ts @@ -106,7 +106,9 @@ export async function commitPatch( } catch (error) { if (!(error instanceof FsError)) throw error const failure = patchFailure(sandbox, policy, error, failurePath) - const uncertain = started && (error.code === 'FS_ABORTED' || error.code === 'FS_IO_ERROR') && !await unchanged(ctx, before) + // A cancelled remote request rejects while the provider may still be writing, so no + // stat can settle an aborted mutation; an I/O failure is settled by unchanged versions. + const uncertain = started && (error.code === 'FS_ABORTED' || (error.code === 'FS_IO_ERROR' && !await unchanged(ctx, before))) outcome = uncertain ? { status: 'unknown', operation: record, failure: { ...failure, message: `${failure.message} — re-read the affected files before retrying` } } : { status: 'failed', operation: record, failure, changes: [] } diff --git a/packages/fs/tool-fs/src/patch/plan.ts b/packages/fs/tool-fs/src/patch/plan.ts index 195947c230..baab3634aa 100644 --- a/packages/fs/tool-fs/src/patch/plan.ts +++ b/packages/fs/tool-fs/src/patch/plan.ts @@ -110,7 +110,7 @@ export function patchFailure( /** * List all targets the operation can mutate, with destination first for a move. * @param operation - resolved operation. - * @returns targets requiring a sandbox check and uncertainty comparison. + * @returns targets whose versions the uncertainty comparison records. */ export function mutationTargets(operation: PlannedOperation): FsTarget[] { return operation.kind === 'move' ? [operation.destination, operation.target] : [operation.target] diff --git a/packages/fs/tool-fs/src/patch/preflight.ts b/packages/fs/tool-fs/src/patch/preflight.ts index 1c80cca5ba..532b60d7ad 100644 --- a/packages/fs/tool-fs/src/patch/preflight.ts +++ b/packages/fs/tool-fs/src/patch/preflight.ts @@ -3,13 +3,12 @@ import type { Context } from '@deepseek-ai/cordis' import { FsError } from '@deepseek-ai/dsh-fs' import type { FsInfo, FsTarget, FsTargetKey } from '@deepseek-ai/dsh-fs' import { applyHunks } from '@deepseek-ai/dsh-fs-patch' -import { writableRoots } from '@deepseek-ai/dsh-sandbox' import type { SandboxExecutionPolicy } from '@deepseek-ai/dsh-sandbox' import type { ToolExecution } from '@deepseek-ai/dsh-tools' import { assertNever } from '@deepseek-ai/dsh-util-values' import type { FsSandboxController } from '../sandbox.ts' import { sessionResolveOptions } from '../session-cwd.ts' -import { destinationIntent, mutationTargets, patchFailure, sourceIntent } from './plan.ts' +import { destinationIntent, patchFailure, sourceIntent } from './plan.ts' import type { PatchFailure, PatchRefusal, PlannedOperation } from './types.ts' interface SimulatedFile { @@ -20,12 +19,12 @@ interface SimulatedFile { } class Preflight { - failurePath = '' - private roots: Promise | undefined + private failurePath = '' private readonly states = new Map() constructor( - private readonly ctx: Context, private readonly exec: ToolExecution, private readonly policy: SandboxExecutionPolicy | undefined, + private readonly ctx: Context, private readonly sandbox: FsSandboxController, private readonly exec: ToolExecution, + private readonly policy: SandboxExecutionPolicy | undefined, ) {} private async state(target: FsTarget): Promise { @@ -37,17 +36,6 @@ class Preflight { return state } - private async fence(operation: PlannedOperation): Promise { - if (this.policy === undefined || this.policy.mode === 'danger-full-access') return - if (this.policy.mode === 'read-only') throw new FsError('filesystem mutations are denied', 'FS_SANDBOX_DENIED') - const roots = await (this.roots ??= Promise.all(writableRoots(this.policy).map(root => this.ctx.fs.resolve(root)))) - for (const target of mutationTargets(operation)) { - if (!roots.some(root => this.ctx.fs.contains(root, target))) { - throw new FsError(`cannot modify "${target.displayPath}": outside writable roots`, 'FS_SANDBOX_DENIED') - } - } - } - private regular(state: SimulatedFile, target: FsTarget): void { if (state.info !== undefined && state.info.type !== 'file') { throw new FsError(`cannot modify "${target.displayPath}": not a regular file`, 'FS_NOT_REGULAR_FILE') @@ -75,7 +63,12 @@ class Preflight { } private async content(state: SimulatedFile, target: FsTarget): Promise { - if (state.content === undefined) state.content = (await this.ctx.fs.readText(target, this.exec.signal)).replace(/\r\n/g, '\n') + if (state.content === undefined) { + const text = await this.ctx.fs.readText(target, this.exec.signal) + // readText samples only a prefix for NUL bytes; the mutation path rejects any NUL. + if (text.includes('\0')) throw new FsError(`cannot patch "${target.displayPath}": binary file`, 'FS_NOT_TEXT') + state.content = text.replace(/\r\n/g, '\n') + } return state.content } @@ -84,9 +77,16 @@ class Preflight { ...(content === undefined ? {} : { content }) }) } + /** Simulate one operation; a filesystem refusal becomes the operation's failure. */ async check(operation: PlannedOperation): Promise { this.failurePath = operation.target.displayPath - await this.fence(operation) + try { return await this.simulate(operation) } catch (error) { + if (!(error instanceof FsError)) throw error + return patchFailure(this.sandbox, this.policy, error, this.failurePath) + } + } + + private async simulate(operation: PlannedOperation): Promise { if (operation.kind === 'move' && operation.target.targetKey === operation.destination.targetKey) { throw new FsError(`cannot move "${operation.target.displayPath}" to itself`, 'FS_SAME_TARGET') } @@ -135,10 +135,11 @@ class Preflight { /** * Collect every independent preflight refusal while simulating only admitted operations. + * Sandbox containment is the provider's decision at commit, as for write and edit. * @param ctx - filesystem service owner; reads never emit observations. * @param sandbox - model-facing denial mapper. * @param exec - observation actor and cancellation signal. - * @param policy - resolved confinement policy. + * @param policy - resolved confinement policy used to label refusals. * @param operations - complete resolved operation plan. * @returns refused operations in patch order; any refusal forbids the commit phase. */ @@ -146,14 +147,10 @@ export async function preflightPatch( ctx: Context, sandbox: FsSandboxController, exec: ToolExecution, policy: SandboxExecutionPolicy | undefined, operations: readonly PlannedOperation[], ): Promise { - const preflight = new Preflight(ctx, exec, policy) + const preflight = new Preflight(ctx, sandbox, exec, policy) const refusals: PatchRefusal[] = [] for (const operation of operations) { - let failure: PatchFailure | undefined - try { failure = await preflight.check(operation) } catch (error) { - if (!(error instanceof FsError)) throw error - failure = patchFailure(sandbox, policy, error, preflight.failurePath) - } + const failure = await preflight.check(operation) if (failure !== undefined) refusals.push({ operation: operation.record, failure }) } return refusals diff --git a/packages/fs/tool-fs/tests/apply-patch-presentation.spec.ts b/packages/fs/tool-fs/tests/apply-patch-presentation.spec.ts index 947f7c0200..96d3ecad5e 100644 --- a/packages/fs/tool-fs/tests/apply-patch-presentation.spec.ts +++ b/packages/fs/tool-fs/tests/apply-patch-presentation.spec.ts @@ -6,16 +6,17 @@ import { renderPatch, patchPresentationMeta, type PatchToolValue } from '../src/ import { stoppedFromMeta } from '../src/diff.ts' import { add, move, patch, remove, setup, update } from './patch/harness.ts' -it('previews every operation using raw paths and both move endpoints', async () => { - const text = patch(add('a'), update('b'), remove('c'), move('d', 'e'), '*** Update File: empty\n@@\n+insert') - const expected = { card: 'diff', title: 'Apply patch (5 files)', diffs: [ +it('previews every operation using raw paths, counting distinct files including move endpoints', async () => { + const text = patch(add('a'), update('b'), remove('c'), move('d', 'e'), '*** Update File: empty\n@@\n+insert', update('b', 'new', 'last')) + const expected = { card: 'diff', title: 'Apply patch (6 files)', diffs: [ { path: 'a', oldText: null, newText: 'new\n' }, { path: 'b', oldText: 'old', newText: 'new' }, - { path: 'c', oldText: null, newText: '' }, { path: 'd', oldText: 'old', newText: 'new' }, - { path: 'empty', oldText: null, newText: 'insert' }, + { path: 'd', oldText: 'old', newText: 'new' }, { path: 'empty', oldText: null, newText: 'insert' }, + { path: 'b', oldText: 'new', newText: 'last' }, ], locations: ['a', 'b', 'c', 'd', 'e', 'empty'].map(path => ({ path })) } expect(presentPatchCall(text)).toEqual(expected) const t = await setup() expect(t.ctx.tools.get('apply_patch')?.presentCall?.({ patch: text })).toEqual(expected) + expect(presentPatchCall(patch(remove('only')))).toEqual({ card: 'diff', title: 'Apply patch (1 file)', diffs: [], locations: [{ path: 'only' }] }) expect(presentPatchCall('invalid')).toBeUndefined() }) @@ -42,15 +43,17 @@ it.each([undefined, null, [], 'stopped', {}, { stopped: 'true' }, { stopped: fal expect(stoppedFromMeta(meta)).toBe(false) }) -it('presents nullable creation/deletion baselines and omits unavailable changes', () => { +it('stores no diff for creations or for removals without a bounded basis', () => { const value: PatchToolValue = { phase: 'commit', cancelled: false, affectedPaths: ['a', 'b'], operations: [ { index: 0, kind: 'delete', path: 'a', patchLine: 2, status: 'completed', changes: [{ path: 'a', before: null, after: null }] }, - { index: 1, kind: 'update', path: 'b', patchLine: 3, status: 'failed', code: 'FS_PERMISSION_DENIED', message: 'denied' }, - { index: 2, kind: 'add', path: 'c', patchLine: 7, status: 'skipped' }, + { index: 1, kind: 'add', path: 'd', patchLine: 3, status: 'completed', changes: [{ path: 'd', before: null, after: 'created\n' }] }, + { index: 2, kind: 'delete', path: 'e', patchLine: 5, status: 'completed', changes: [{ path: 'e', before: 'gone\n', after: null }] }, + { index: 3, kind: 'update', path: 'b', patchLine: 6, status: 'failed', code: 'FS_PERMISSION_DENIED', message: 'denied' }, + { index: 4, kind: 'add', path: 'c', patchLine: 7, status: 'skipped' }, ] } - expect(patchPresentationMeta(value)).toEqual({ stopped: true, diffs: [{ path: 'a', oldText: null, newText: '' }] }) - expect(renderPatch(value)).toBe('Patch stopped after 1 of 3 operations.\nCompleted:\nD a\nFailed:\n' - + '- operation 2 (update b, patch line 3): denied\nNot executed:\n- operation 3 (add c)') + expect(patchPresentationMeta(value)).toEqual({ stopped: true, diffs: [{ path: 'e', oldText: 'gone\n', newText: '' }] }) + expect(renderPatch(value)).toBe('Patch stopped after 3 of 5 operations.\nCompleted:\nA d\nD a\nD e\nFailed:\n' + + '- operation 4 (update b, patch line 6): denied\nNot executed:\n- operation 5 (add c)') }) it('reports cancellation and a move failure with no written destination', () => { diff --git a/packages/fs/tool-fs/tests/apply-patch.spec.ts b/packages/fs/tool-fs/tests/apply-patch.spec.ts index 4d6bbc2b66..29c351dd2e 100644 --- a/packages/fs/tool-fs/tests/apply-patch.spec.ts +++ b/packages/fs/tool-fs/tests/apply-patch.spec.ts @@ -10,7 +10,7 @@ import type { PtcRunRequest, PtcRunSpec } from '@deepseek-ai/dsh-ptc-runtime' import { add, move, patch, remove, setup, update } from './patch/harness.ts' const guidance = 'Prefer apply_patch over separate edit calls for changes across files or separated regions. ' - + 'Read files before updating or deleting them when the observation policy is enabled. ' + + 'Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. ' + 'Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed.' type Fixture = Awaited> @@ -60,11 +60,10 @@ it('returns exact native values and applied metadata for all four operation kind ] }, ], affectedPaths: ['edit', 'created', 'delete', 'destination', 'source'].map(path) }) expect(result.content).toEqual([{ type: 'text', text: `Success. Updated the following files:\nA ${path('created')}\nM ${path('edit')}\nM ${path('destination')}\nD ${path('delete')}` }]) + // Creations store no diff, as for write; removals store the provider's bounded basis. expect(result.meta).toEqual({ stopped: false, diffs: [ { path: path('edit'), oldText: 'old', newText: 'new' }, - { path: path('created'), oldText: null, newText: 'new\n' }, { path: path('delete'), oldText: 'gone\n', newText: '' }, - { path: path('destination'), oldText: null, newText: 'new\n' }, { path: path('source'), oldText: 'old\n', newText: '' }, ] }) expect(await t.bytes('edit')).toBe('new\n') @@ -121,9 +120,7 @@ it('keeps a partial move as a value with its destination diff and exact stop tex expect(result.content).toEqual([{ type: 'text', text: `Patch stopped after 1 of 3 operations.\nCompleted:\nA ${path('first')}\nFailed:\n` + `- operation 2 (move ${path('a')} -> ${path('b')}, patch line 4): source removal denied\n` + ` destination ${path('b')} was written; source ${path('a')} remains\nNot executed:\n- operation 3 (add ${path('last')})` }]) - expect(result.meta).toEqual({ stopped: true, diffs: [ - { path: path('first'), oldText: null, newText: 'new\n' }, { path: path('b'), oldText: null, newText: 'new\n' }, - ] }) + expect(result.meta).toEqual({ stopped: true, diffs: [] }) expect(await t.bytes('a')).toBe('old\n') expect(await t.bytes('b')).toBe('new\n') await expect(t.bytes('last')).rejects.toMatchObject({ code: 'ENOENT' }) @@ -149,10 +146,12 @@ it('advertises escalation only for a confining backend and throws the sandbox re expect(bare.ctx.tools.get('apply_patch')?.parameters).not.toHaveProperty('properties.sandbox_permissions') const t = await setup({ mode: 'read-only' }) expect(t.ctx.tools.get('apply_patch')?.parameters).toHaveProperty('properties.sandbox_permissions') + // The provider denies the first commit; with nothing written, the tool rejects like a preflight refusal. const result = await t.ctx.tools.execute({ signal: t.exec.signal, callId: t.exec.callId, name: 'apply_patch', - arguments: { patch: patch(add(resolve(t.workspace, 'a'))) } }) + arguments: { patch: patch(add(resolve(t.workspace, 'a')), add(resolve(t.workspace, 'b'))) } }) expect(result.error?.info).toEqual({ name: 'FsError', code: 'FS_SANDBOX_DENIED' }) expect(result.content).toEqual([{ type: 'text', text: `Error: Patch rejected before any change (1 problems):\n- operation 1 (add ${resolve(t.workspace, 'a')}, patch line 2): [sandbox: file access denied under read-only mode]\n[sandbox: escalation available — retry this exact operation once with sandbox_permissions (the narrowest wider mode that suffices) + justification; the approval prompt asks the user]` }]) + expect(result.meta).toBeUndefined() }) class PatchPtcRuntime extends PtcRuntime { @@ -184,7 +183,7 @@ it('dispatches native and PTC patch calls with identical values', async () => { expect(await t.bytes('a')).toBe('new\n') }) -it.skipIf(process.platform === 'win32' || process.getuid?.() === 0)('retains completed diffs after a real write permission failure', async () => { +it.skipIf(process.platform === 'win32' || process.getuid?.() === 0)('retains completed operations after a real write permission failure', async () => { const t = await setup() const locked = resolve(t.workspace, 'locked') await mkdir(locked, { mode: 0o555 }) @@ -196,7 +195,7 @@ it.skipIf(process.platform === 'win32' || process.getuid?.() === 0)('retains com expect(result.content).toEqual([{ type: 'text', text: `Patch stopped after 1 of 3 operations.\nCompleted:\nA ${first}\nFailed:\n` + `- operation 2 (add ${denied}, patch line 4): cannot write "${denied}": permission denied\nNot executed:\n` + `- operation 3 (add ${resolve(t.workspace, 'last')})` }]) - expect(result.meta).toEqual({ stopped: true, diffs: [{ path: first, oldText: null, newText: 'new\n' }] }) + expect(result.meta).toEqual({ stopped: true, diffs: [] }) expect(await t.bytes('first')).toBe('new\n') await expect(t.bytes('last')).rejects.toMatchObject({ code: 'ENOENT' }) } finally { await chmod(locked, 0o755) } diff --git a/packages/fs/tool-fs/tests/patch/commit.spec.ts b/packages/fs/tool-fs/tests/patch/commit.spec.ts index 6a4c52dc23..d0fae88348 100644 --- a/packages/fs/tool-fs/tests/patch/commit.spec.ts +++ b/packages/fs/tool-fs/tests/patch/commit.spec.ts @@ -55,14 +55,15 @@ it('stops between operations after cancellation without undoing the first write' await expect(t.editIntent('b')).rejects.toMatchObject({ code: 'FS_NOT_OBSERVED' }) }) -it('reports cancellation during staged writing as failed when stat confirms no change', async () => { +it('reports cancellation during staged writing as unknown without a stat comparison', async () => { const t = await setup() let writes = 0 t.fs.internals.inspectTemp = () => { if (++writes === 2) t.controller.abort() } const a = t.record('add', 'a') + // The staged file never reaches its target, so a stat comparison would have called this failed. expect(await t.run(patch(add('a'), add('b'), add('c')))).toEqual({ phase: 'commit', outcomes: [ { status: 'completed', operation: a, changes: [{ path: a.path, before: null, after: 'new\n' }] }, - { status: 'failed', operation: t.record('add', 'b', 1, 4), failure: { code: 'FS_ABORTED', message: 'write aborted' }, changes: [] }, + { status: 'unknown', operation: t.record('add', 'b', 1, 4), failure: { code: 'FS_ABORTED', message: 'write aborted — re-read the affected files before retrying' } }, { status: 'skipped', operation: t.record('add', 'c', 2, 6) }, ], affectedPaths: [a.path], cancelled: true }) expect(await t.bytes('a')).toBe('new\n') @@ -188,3 +189,31 @@ it('reports the locked move source after an external edit following preflight', expect(reads).toHaveBeenCalledTimes(1) expect(await t.bytes('b')).toBe('new\nexternal\n') }) + +it('stops at the first provider sandbox denial under read-only policy', async () => { + const t = await setup({ mode: 'read-only' }) + await t.file('a', 'old\n') + const b = t.record('add', 'b') + expect(await t.run(patch(add('b'), update('a'), remove('a')))).toEqual({ phase: 'commit', outcomes: [ + { status: 'failed', operation: b, failure: { code: 'FS_SANDBOX_DENIED', message: expect.stringContaining('[sandbox: file access denied under read-only mode]') as string }, changes: [] }, + { status: 'skipped', operation: t.record('update', 'a', 1, 4) }, + { status: 'skipped', operation: t.record('delete', 'a', 2, 8) }, + ], affectedPaths: [], cancelled: false }) + expect(await t.bytes('a')).toBe('old\n') + await expect(t.bytes('b')).rejects.toMatchObject({ code: 'ENOENT' }) + expect(t.observations).toEqual([]) +}) + +it('retains earlier writes when the provider denies a move destination outside writable roots', async () => { + const t = await setup({ mode: 'workspace-write' }) + await t.file('a', 'old\n') + const outside = resolve(process.cwd(), 'patch-commit-outside-root') + const b = t.record('add', 'b') + expect(await t.run(patch(add('b'), move('a', outside)))).toEqual({ phase: 'commit', outcomes: [ + { status: 'completed', operation: b, changes: [{ path: b.path, before: null, after: 'new\n' }] }, + { status: 'failed', operation: t.record('move', 'a', 1, 4, outside), failure: { code: 'FS_SANDBOX_DENIED', message: expect.stringContaining('[sandbox: file access denied under workspace-write mode]') as string }, changes: [] }, + ], affectedPaths: [b.path], cancelled: false }) + expect(await t.bytes('a')).toBe('old\n') + expect(await t.bytes('b')).toBe('new\n') + expect(t.observations.map(event => event.path)).toEqual([b.path]) +}) diff --git a/packages/fs/tool-fs/tests/patch/preflight.spec.ts b/packages/fs/tool-fs/tests/patch/preflight.spec.ts index 4060deb1f7..238d213193 100644 --- a/packages/fs/tool-fs/tests/patch/preflight.spec.ts +++ b/packages/fs/tool-fs/tests/patch/preflight.spec.ts @@ -93,33 +93,6 @@ it.each(['add', 'move'] as const)('attributes an unread %s destination to its re await expect(t.editIntent('b')).rejects.toMatchObject({ code: 'FS_NOT_OBSERVED' }) }) -it('rejects every operation under read-only policy', async () => { - const t = await setup({ mode: 'read-only' }) - await t.file('a', 'old\n') - const records = [t.record('add', 'b'), t.record('update', 'a', 1, 4), t.record('delete', 'a', 2, 8), t.record('move', 'a', 3, 9, 'c')] - expect(await t.run(patch(add('b'), update('a'), remove('a'), move('a', 'c')))).toEqual({ phase: 'preflight', refusals: records.map(operation => ({ - operation, failure: { code: 'FS_SANDBOX_DENIED', message: expect.stringContaining('[sandbox: file access denied under read-only mode]') as string }, - })) }) - expect(await t.bytes('a')).toBe('old\n') - await expect(t.bytes('b')).rejects.toMatchObject({ code: 'ENOENT' }) - expect(t.observations).toEqual([]) - expect(await t.editIntent('a')).toEqual({ version: await t.version('a') }) -}) - -it('prevents all writes when a move destination is outside writable roots', async () => { - const t = await setup({ mode: 'workspace-write' }) - await t.file('a', 'old\n') - const outside = resolve(process.cwd(), 'patch-preflight-outside-root') - const a = t.record('move', 'a', 1, 4, outside) - expect(await t.run(patch(add('b'), move('a', outside)))).toEqual({ phase: 'preflight', refusals: [ - { operation: a, failure: { code: 'FS_SANDBOX_DENIED', message: expect.stringContaining('[sandbox: file access denied under workspace-write mode]') as string } }, - ] }) - expect(await t.bytes('a')).toBe('old\n') - await expect(t.bytes('b')).rejects.toMatchObject({ code: 'ENOENT' }) - expect(t.observations).toEqual([]) - expect(await t.editIntent('a')).toEqual({ version: await t.version('a') }) -}) - it.each(['update', 'delete', 'add', 'move'] as const)('rejects non-regular %s targets with bare guards', async (kind) => { const t = await setup({ policy: false }) await mkdir(resolve(t.workspace, 'directory')) @@ -149,6 +122,18 @@ it.each(['update', 'add'] as const)('rejects a stale observed version before %s' expect(await t.editIntent('a')).toEqual(observed) }) +it('rejects a NUL byte beyond the read sampling window before any write', async () => { + const t = await setup() + const binary = `${'text\n'.repeat(2048)}\0tail\n` + await t.file('a', binary) + expect(await t.run(patch(add('created'), '*** Update File: a\n@@\n-text\n+new'))).toEqual({ phase: 'preflight', refusals: [ + { operation: t.record('update', 'a', 1, 4), failure: { code: 'FS_NOT_TEXT', message: `cannot patch "${resolve(t.workspace, 'a')}": binary file` } }, + ] }) + await expect(t.bytes('created')).rejects.toMatchObject({ code: 'ENOENT' }) + expect(await t.bytes('a')).toBe(binary) + expect(t.observations).toEqual([]) +}) + it.each(['FS_NOT_TEXT', 'FS_TOO_LARGE'] satisfies FsErrorCode[])('preserves a preflight read failure %s', async (code) => { const t = await setup() await t.file('a', 'old\n') @@ -229,11 +214,3 @@ it('names the missing move source operation', async () => { failure: { code: 'FS_NOT_FOUND', message: `cannot move "${resolve(t.workspace, 'missing')}": not found` } }], }) }) - -it('resolves writable roots once while admitting multiple operations', async () => { - const t = await setup({ mode: 'workspace-write' }) - const resolve = vi.spyOn(t.fs, 'resolve') - // A later unread source prevents provider commits, isolating admission's root lookups. - await t.run(patch(add('a'), add('b'), update('unread'))) - expect(resolve.mock.calls.filter(([path]) => path === t.workspace)).toHaveLength(1) -}) diff --git a/packages/ssh/ssh/src/schemas.ts b/packages/ssh/ssh/src/schemas.ts index 69ab458139..b414270a74 100644 --- a/packages/ssh/ssh/src/schemas.ts +++ b/packages/ssh/ssh/src/schemas.ts @@ -55,8 +55,8 @@ export const moveOptionsSchema = z.object({ export const deleteResultSchema = z.object({ before: z.string().nullable() }).strict() /** Move completion preserves a published destination even when source removal fails. */ export const moveResultSchema = z.discriminatedUnion('sourceDeleted', [ - z.object({ sourceBefore: z.string(), destination: writeResultSchema, sourceDeleted: z.literal(true) }).strict(), - z.object({ sourceBefore: z.string(), destination: writeResultSchema, sourceDeleted: z.literal(false), sourceFailure: z.object({ + z.object({ sourceBefore: z.string().nullable(), destination: writeResultSchema, sourceDeleted: z.literal(true) }).strict(), + z.object({ sourceBefore: z.string().nullable(), destination: writeResultSchema, sourceDeleted: z.literal(false), sourceFailure: z.object({ code: z.enum(FS_ERROR_CODES), message: z.string(), }).strict() }).strict(), diff --git a/scripts/doc-standard.spec.ts b/scripts/doc-standard.spec.ts index a8978e0d85..0c9d552d78 100644 --- a/scripts/doc-standard.spec.ts +++ b/scripts/doc-standard.spec.ts @@ -93,7 +93,7 @@ const PACKAGE_LIBRARIES: Readonly> = { 'packages/util/deque': 'Zero-dependency circular deque utility.', 'packages/util/chunked-list': 'Persistent collection operations and checkpoint validation without a plugin surface.', 'packages/util/code-language': 'Zero-dependency file-extension to syntax-highlighting language table.', - 'packages/fs/fs-patch': 'Pure patch parsing and path collection without plugin registration or filesystem I/O.', + 'packages/fs/fs-patch': 'Pure patch parsing and hunk application without plugin registration or filesystem I/O.', 'packages/util/home-paths': 'Zero-dependency harness-home path resolver.', 'packages/util/launch-environment': 'Zero-dependency environment resolver.', 'packages/util/lazy-require': 'Caller-relative CommonJS-compatible dependency loader.', diff --git a/scripts/gen-tool-catalog.ts b/scripts/gen-tool-catalog.ts index 8eb29fc8e7..ba8c89e428 100644 --- a/scripts/gen-tool-catalog.ts +++ b/scripts/gen-tool-catalog.ts @@ -386,7 +386,7 @@ const TOOL_PACKAGES: ToolPackage[] = [ dir: 'tool-fs', source: 'packages/fs/tool-fs/src/index.ts', requires: ['ctx.workingDirectory', 'ctx.tools', 'ctx.fs', 'ctx.systemPrompt', 'ctx.attachments (image-tool registration)', 'ctx.llm + an image-capable route (image-tool execution)'], - writes: ['tool/call', 'fs/write-intent or fs/edit-intent for mutations', 'fs/observed after read presence/absence or successful file operation', 'durable attachment (read_image)', 'tool/result'], + writes: ['tool/call', 'fs/write-intent, fs/edit-intent, or fs/delete-intent for mutations', 'fs/observed after read presence/absence or successful file operation', 'durable attachment (read_image)', 'tool/result'], async mount(ctx) { // The catalog seam marker opts into // the attachments-conditional image schema without attachment I/O. diff --git a/scripts/verify-package-readme-model-experience.ts b/scripts/verify-package-readme-model-experience.ts index 839023612f..9835c012b8 100644 --- a/scripts/verify-package-readme-model-experience.ts +++ b/scripts/verify-package-readme-model-experience.ts @@ -30,7 +30,7 @@ interface SentenceContract { * so an absent section cannot be mistaken for forgotten documentation. */ const NO_MODEL_EXPERIENCE_SECTION: Readonly> = { - 'packages/fs/fs-patch': 'The pure parser only transforms caller-supplied patch text and collects paths; consumers own tools, execution, capture, and model output.', + 'packages/fs/fs-patch': 'The pure library only parses caller-supplied patch text and applies hunks to text; consumers own tools, execution, capture, and model output.', 'packages/core/scope': 'The package is a model-agnostic registration and lifecycle primitive; model-facing consumers own any context selection.', 'packages/util/brand': 'The package only constructs plain string values and registers nothing model-facing.', 'packages/util/home-paths': 'The package only resolves harness-owned host paths; model-facing consumers own any rendered use.', diff --git a/snapshots/sdk/bash-tool/system-prompt.expected.md b/snapshots/sdk/bash-tool/system-prompt.expected.md index 754c12ec75..359a2727f4 100644 --- a/snapshots/sdk/bash-tool/system-prompt.expected.md +++ b/snapshots/sdk/bash-tool/system-prompt.expected.md @@ -10,7 +10,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/sdk/bash-tool/tool-schemas.expected.json b/snapshots/sdk/bash-tool/tool-schemas.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/sdk/bash-tool/tool-schemas.expected.json +++ b/snapshots/sdk/bash-tool/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/sdk/desktop-context/system-prompt.expected.md b/snapshots/sdk/desktop-context/system-prompt.expected.md index 6f00e61d0c..3ed8e5c22b 100644 --- a/snapshots/sdk/desktop-context/system-prompt.expected.md +++ b/snapshots/sdk/desktop-context/system-prompt.expected.md @@ -12,7 +12,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/sdk/desktop-context/tool-schemas.expected.json b/snapshots/sdk/desktop-context/tool-schemas.expected.json index ec9b541715..475c3d063b 100644 --- a/snapshots/sdk/desktop-context/tool-schemas.expected.json +++ b/snapshots/sdk/desktop-context/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/sdk/desktop-ptc-context/system-prompt.expected.md b/snapshots/sdk/desktop-ptc-context/system-prompt.expected.md index fe622043a0..de7ce5dcb6 100644 --- a/snapshots/sdk/desktop-ptc-context/system-prompt.expected.md +++ b/snapshots/sdk/desktop-ptc-context/system-prompt.expected.md @@ -14,7 +14,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -53,7 +53,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/sdk/subagent-activation-limit/system-prompt.1.expected.md b/snapshots/sdk/subagent-activation-limit/system-prompt.1.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/sdk/subagent-activation-limit/system-prompt.1.expected.md +++ b/snapshots/sdk/subagent-activation-limit/system-prompt.1.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/sdk/subagent-activation-limit/tool-schemas.1.expected.json b/snapshots/sdk/subagent-activation-limit/tool-schemas.1.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/sdk/subagent-activation-limit/tool-schemas.1.expected.json +++ b/snapshots/sdk/subagent-activation-limit/tool-schemas.1.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/sdk/subagent-continuable-inheritance/system-prompt.1.expected.md b/snapshots/sdk/subagent-continuable-inheritance/system-prompt.1.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/sdk/subagent-continuable-inheritance/system-prompt.1.expected.md +++ b/snapshots/sdk/subagent-continuable-inheritance/system-prompt.1.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/sdk/subagent-continuable-inheritance/tool-schemas.1.expected.json b/snapshots/sdk/subagent-continuable-inheritance/tool-schemas.1.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/sdk/subagent-continuable-inheritance/tool-schemas.1.expected.json +++ b/snapshots/sdk/subagent-continuable-inheritance/tool-schemas.1.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/sdk/subagent-continuable/system-prompt.1.expected.md b/snapshots/sdk/subagent-continuable/system-prompt.1.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/sdk/subagent-continuable/system-prompt.1.expected.md +++ b/snapshots/sdk/subagent-continuable/system-prompt.1.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/sdk/subagent-continuable/tool-schemas.1.expected.json b/snapshots/sdk/subagent-continuable/tool-schemas.1.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/sdk/subagent-continuable/tool-schemas.1.expected.json +++ b/snapshots/sdk/subagent-continuable/tool-schemas.1.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/sdk/subagent-dsh-sdk-diagnostic/system-prompt.expected.md b/snapshots/sdk/subagent-dsh-sdk-diagnostic/system-prompt.expected.md index 1229f2033f..28cb774472 100644 --- a/snapshots/sdk/subagent-dsh-sdk-diagnostic/system-prompt.expected.md +++ b/snapshots/sdk/subagent-dsh-sdk-diagnostic/system-prompt.expected.md @@ -10,7 +10,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/sdk/subagent-dsh-sdk-diagnostic/tool-schemas.expected.json b/snapshots/sdk/subagent-dsh-sdk-diagnostic/tool-schemas.expected.json index 21ac7c7217..5f3703f202 100644 --- a/snapshots/sdk/subagent-dsh-sdk-diagnostic/tool-schemas.expected.json +++ b/snapshots/sdk/subagent-dsh-sdk-diagnostic/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/sdk/subagent-dsh-sdk-dynamic-route/system-prompt.1.expected.md b/snapshots/sdk/subagent-dsh-sdk-dynamic-route/system-prompt.1.expected.md index 8b0a24a873..75d195201f 100644 --- a/snapshots/sdk/subagent-dsh-sdk-dynamic-route/system-prompt.1.expected.md +++ b/snapshots/sdk/subagent-dsh-sdk-dynamic-route/system-prompt.1.expected.md @@ -10,7 +10,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/sdk/subagent-dsh-sdk-dynamic-route/system-prompt.expected.md b/snapshots/sdk/subagent-dsh-sdk-dynamic-route/system-prompt.expected.md index 094a032696..27514b1e21 100644 --- a/snapshots/sdk/subagent-dsh-sdk-dynamic-route/system-prompt.expected.md +++ b/snapshots/sdk/subagent-dsh-sdk-dynamic-route/system-prompt.expected.md @@ -10,7 +10,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/sdk/subagent-dsh-sdk-dynamic-route/tool-schemas.1.expected.json b/snapshots/sdk/subagent-dsh-sdk-dynamic-route/tool-schemas.1.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/sdk/subagent-dsh-sdk-dynamic-route/tool-schemas.1.expected.json +++ b/snapshots/sdk/subagent-dsh-sdk-dynamic-route/tool-schemas.1.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/sdk/subagent-dsh-sdk-dynamic-route/tool-schemas.expected.json b/snapshots/sdk/subagent-dsh-sdk-dynamic-route/tool-schemas.expected.json index 80d0e1dd9a..096f11dc78 100644 --- a/snapshots/sdk/subagent-dsh-sdk-dynamic-route/tool-schemas.expected.json +++ b/snapshots/sdk/subagent-dsh-sdk-dynamic-route/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/sdk/subagent-list-agents/system-prompt.1.expected.md b/snapshots/sdk/subagent-list-agents/system-prompt.1.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/sdk/subagent-list-agents/system-prompt.1.expected.md +++ b/snapshots/sdk/subagent-list-agents/system-prompt.1.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/sdk/subagent-list-agents/tool-schemas.1.expected.json b/snapshots/sdk/subagent-list-agents/tool-schemas.1.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/sdk/subagent-list-agents/tool-schemas.1.expected.json +++ b/snapshots/sdk/subagent-list-agents/tool-schemas.1.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/sdk/subagent-send-message/system-prompt.1.expected.md b/snapshots/sdk/subagent-send-message/system-prompt.1.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/sdk/subagent-send-message/system-prompt.1.expected.md +++ b/snapshots/sdk/subagent-send-message/system-prompt.1.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/sdk/subagent-send-message/tool-schemas.1.expected.json b/snapshots/sdk/subagent-send-message/tool-schemas.1.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/sdk/subagent-send-message/tool-schemas.1.expected.json +++ b/snapshots/sdk/subagent-send-message/tool-schemas.1.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/sdk/text-turn/system-prompt.expected.md b/snapshots/sdk/text-turn/system-prompt.expected.md index 754c12ec75..359a2727f4 100644 --- a/snapshots/sdk/text-turn/system-prompt.expected.md +++ b/snapshots/sdk/text-turn/system-prompt.expected.md @@ -10,7 +10,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/sdk/text-turn/tool-schemas.expected.json b/snapshots/sdk/text-turn/tool-schemas.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/sdk/text-turn/tool-schemas.expected.json +++ b/snapshots/sdk/text-turn/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/sdk/tool-error-details/system-prompt.expected.md b/snapshots/sdk/tool-error-details/system-prompt.expected.md index e1edbc7c17..d0c4c07f0d 100644 --- a/snapshots/sdk/tool-error-details/system-prompt.expected.md +++ b/snapshots/sdk/tool-error-details/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -50,7 +50,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -89,7 +89,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/sdk/tool-error-details/tool-schemas.expected.json b/snapshots/sdk/tool-error-details/tool-schemas.expected.json index 1fce9e4aa4..c375bbc27b 100644 --- a/snapshots/sdk/tool-error-details/tool-schemas.expected.json +++ b/snapshots/sdk/tool-error-details/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/advanced-toolchain/system-prompt.1.expected.md b/snapshots/session/advanced-toolchain/system-prompt.1.expected.md index 0c5aa70e56..d0d8b9a38a 100644 --- a/snapshots/session/advanced-toolchain/system-prompt.1.expected.md +++ b/snapshots/session/advanced-toolchain/system-prompt.1.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/advanced-toolchain/system-prompt.2.expected.md b/snapshots/session/advanced-toolchain/system-prompt.2.expected.md index 0c5aa70e56..d0d8b9a38a 100644 --- a/snapshots/session/advanced-toolchain/system-prompt.2.expected.md +++ b/snapshots/session/advanced-toolchain/system-prompt.2.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/advanced-toolchain/system-prompt.expected.md b/snapshots/session/advanced-toolchain/system-prompt.expected.md index fa18fadf15..6e8a761f88 100644 --- a/snapshots/session/advanced-toolchain/system-prompt.expected.md +++ b/snapshots/session/advanced-toolchain/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -50,7 +50,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -89,7 +89,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; @@ -644,7 +644,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/advanced-toolchain/tool-schemas.expected.json b/snapshots/session/advanced-toolchain/tool-schemas.expected.json index 37bba82eef..35c569a48e 100644 --- a/snapshots/session/advanced-toolchain/tool-schemas.expected.json +++ b/snapshots/session/advanced-toolchain/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", @@ -749,7 +749,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/agent-instructions/system-prompt.expected.md b/snapshots/session/agent-instructions/system-prompt.expected.md index 0c5aa70e56..d0d8b9a38a 100644 --- a/snapshots/session/agent-instructions/system-prompt.expected.md +++ b/snapshots/session/agent-instructions/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/agent-instructions/tool-schemas.expected.json b/snapshots/session/agent-instructions/tool-schemas.expected.json index ed175a434b..dce6a0979a 100644 --- a/snapshots/session/agent-instructions/tool-schemas.expected.json +++ b/snapshots/session/agent-instructions/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", @@ -669,7 +669,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/apply-patch-partial/session.v4.jsonl b/snapshots/session/apply-patch-partial/session.v4.jsonl index 93620989ea..f65ca6f81b 100644 --- a/snapshots/session/apply-patch-partial/session.v4.jsonl +++ b/snapshots/session/apply-patch-partial/session.v4.jsonl @@ -14,7 +14,7 @@ {"type":"session/title","data":{"title":"Use exactly one apply_patch call","messageSeqs":[8],"source":{"kind":"fallback"}}} {"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"reasoning","text":"The task: use exactly one apply_patch call with two Add File operations in order: first.txt containing \"published\\n\", then locked/second.txt containing \"blocked\\n\". The locked directory is read-only. Call apply_patch immediately, do not inspect, change permissions, retry, or call other tools. Report partial-failure summary and which file was created, using relative filenames.\n\nI must make one apply_patch call with two Add File hunks in that order."},{"type":"tool-call","id":"call_00_sC9S5I5XvmkaQwHk39P23131","name":"apply_patch","arguments":"{\"patch\": \"*** Begin Patch\\n*** Add File: first.txt\\n+published\\n*** Add File: locked/second.txt\\n+blocked\\n*** End Patch\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-pro","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-pro"},"blocks":[{"type":"reasoning","signature":"83e90500-8c2c-4361-8e9a-8d6dcca151fd"},{"type":"tool-call"}]}},"id":"{{message:4}}"},"usage":{"inputTokens":241,"outputTokens":171,"cacheReadTokens":4992,"cacheWriteTokens":0,"totalTokens":5404},"stream":[{"type":"chunk","time":1792123180936,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":1792123181256,"index":0,"dt":[113,34,26,0,24,0,0,1,0,0,38,1,0,0,0,0,18,0,23,0,23,0,0,0,28,0,0,58,0,0,0,22,1,0,0,0,34,1,0,0,0,0,42,1,0,0,0,0,38,0,1,20,9,0,0,28,1,0,0,0,0,35,0,0,0,37,0,0,0,0,38,0,1,0,0,32,0,0,0,0,60,32,30,23,0,0,1,0,36,15,0,0,23,0,39,40,0],"texts":["The"," task",":"," use"," exactly"," one"," apply","_p","atch"," call"," with"," two"," Add"," File"," operations"," in"," order",":"," first",".txt"," containing"," \"","published","\\n","\","," then"," locked","/second",".txt"," containing"," \"","block","ed","\\n","\"."," The"," locked"," directory"," is"," read","-only","."," Call"," apply","_p","atch"," immediately",","," do"," not"," inspect",","," change"," permissions",","," ret","ry",","," or"," call"," other"," tools","."," Report"," partial","-f","ailure"," summary"," and"," which"," file"," was"," created",","," using"," relative"," fil","en","ames",".\n\n","I"," must"," make"," one"," apply","_p","atch"," call"," with"," two"," Add"," File"," hun","ks"," in"," that"," order","."]},{"type":"chunk","time":1792123182404,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"The task: use exactly one apply_patch call with two Add File operations in order: first.txt containing \"published\\n\", then locked/second.txt containing \"blocked\\n\". The locked directory is read-only. Call apply_patch immediately, do not inspect, change permissions, retry, or call other tools. Report partial-failure summary and which file was created, using relative filenames.\n\nI must make one apply_patch call with two Add File hunks in that order."}}},{"type":"chunk","time":1792123182405,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1792123182405,"index":1,"dt":[],"id":"call_00_sC9S5I5XvmkaQwHk39P23131","name":"apply_patch","args":[""]},{"type":"tool-call-chunks","time0":1792123182422,"index":1,"dt":[0,0,0,0,43,0,0,0,0,0,26,1,0,0,0,0,76,0,0,0,0,0,0,0,0,0,37,1,0,0,0,0,40,0,0,27],"id":"call_00_sC9S5I5XvmkaQwHk39P23131","args":["{","\"","patch","\"",": ","\"","***"," Begin"," Patch","\\n","***"," Add"," File",":"," first",".txt","\\n","+","published","\\n","***"," Add"," File",":"," locked","/second",".txt","\\n","+","block","ed","\\n","***"," End"," Patch","\"","}"]},{"type":"chunk","time":1792123182711,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"call_00_sC9S5I5XvmkaQwHk39P23131","name":"apply_patch","arguments":"{\"patch\": \"*** Begin Patch\\n*** Add File: first.txt\\n+published\\n*** Add File: locked/second.txt\\n+blocked\\n*** End Patch\"}"}}},{"type":"chunk","time":1792123182712,"chunk":{"type":"usage","usage":{"inputTokens":241,"outputTokens":171,"cacheReadTokens":4992,"cacheWriteTokens":0,"totalTokens":5404}}},{"type":"chunk","time":1792123182712,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-pro"},"blocks":[{"type":"reasoning","signature":"83e90500-8c2c-4361-8e9a-8d6dcca151fd"},{"type":"tool-call"}]}}}]},"surfaceOp":"append"} {"type":"tool/call","data":{"turn":1,"step":1,"callId":"call_00_sC9S5I5XvmkaQwHk39P23131","name":"apply_patch","arguments":"{\"patch\": \"*** Begin Patch\\n*** Add File: first.txt\\n+published\\n*** Add File: locked/second.txt\\n+blocked\\n*** End Patch\"}"}} -{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_00_sC9S5I5XvmkaQwHk39P23131"},"toolCallId":"call_00_sC9S5I5XvmkaQwHk39P23131","content":[{"type":"text","text":"Patch stopped after 1 of 2 operations.\nCompleted:\nA {{cwd}}/first.txt\nFailed:\n- operation 2 (add {{cwd}}/locked/second.txt, patch line 4): cannot write \"{{cwd}}/locked/second.txt\": permission denied"}],"isError":false,"id":"{{message:5}}"},"meta":{"diffs":[{"path":"{{cwd}}/first.txt","oldText":null,"newText":"published\n"}],"stopped":true}},"sourceEventSeqs":[14],"surfaceOp":"append"} +{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_00_sC9S5I5XvmkaQwHk39P23131"},"toolCallId":"call_00_sC9S5I5XvmkaQwHk39P23131","content":[{"type":"text","text":"Patch stopped after 1 of 2 operations.\nCompleted:\nA {{cwd}}/first.txt\nFailed:\n- operation 2 (add {{cwd}}/locked/second.txt, patch line 4): cannot write \"{{cwd}}/locked/second.txt\": permission denied"}],"isError":false,"id":"{{message:5}}"},"meta":{"diffs":[],"stopped":true}},"sourceEventSeqs":[14],"surfaceOp":"append"} {"type":"step/end","data":{"turn":1,"step":1}} {"type":"step/start","data":{"turn":1,"step":2}} {"type":"assistant/message","data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"reasoning","text":""},{"type":"text","text":"Partial failure: 1 of 2 operations succeeded.\n\n- Created: `first.txt`\n- Failed: `locked/second.txt` (permission denied — the `locked` directory is read-only)\n\nThe patch stopped after the first operation, so `first.txt` was created and `locked/second.txt` was not."}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-pro","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-pro"},"blocks":[{"type":"reasoning","signature":"c256418a-6332-4f76-8076-fc6d5f673850"},{"type":"text"}]}},"id":"{{message:6}}"},"usage":{"inputTokens":204,"outputTokens":65,"cacheReadTokens":5376,"cacheWriteTokens":0,"totalTokens":5645},"stream":[{"type":"chunk","time":1792123183528,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"chunk","time":1792123184349,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":""}}},{"type":"chunk","time":1792123184349,"chunk":{"type":"block-start","index":1,"blockType":"text"}},{"type":"text-chunks","time0":1792123184349,"index":1,"dt":[40,0,0,86,2,0,0,0,0,0,0,13,0,0,34,0,1,0,0,0,106,0,0,0,0,0,1,0,0,0,0,8,0,0,1,0,22,1,0,0,35,0,0,274,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0],"texts":["Partial"," failure",":"," ","1"," of"," ","2"," operations"," succeeded",".\n\n","-"," Created",":"," `","first",".txt","`\n","-"," Failed",":"," `","locked","/second",".txt","`"," (","per","mission"," denied"," —"," the"," `","locked","`"," directory"," is"," read","-only",")\n\n","The"," patch"," stopped"," after"," the"," first"," operation",","," so"," `","first",".txt","`"," was"," created"," and"," `","locked","/second",".txt","`"," was"," not","."]},{"type":"chunk","time":1792123184975,"chunk":{"type":"block-end","index":1,"block":{"type":"text","text":"Partial failure: 1 of 2 operations succeeded.\n\n- Created: `first.txt`\n- Failed: `locked/second.txt` (permission denied — the `locked` directory is read-only)\n\nThe patch stopped after the first operation, so `first.txt` was created and `locked/second.txt` was not."}}},{"type":"chunk","time":1792123184975,"chunk":{"type":"usage","usage":{"inputTokens":204,"outputTokens":65,"cacheReadTokens":5376,"cacheWriteTokens":0,"totalTokens":5645}}},{"type":"chunk","time":1792123184975,"chunk":{"type":"finish","reason":{"kind":"stop"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-pro"},"blocks":[{"type":"reasoning","signature":"c256418a-6332-4f76-8076-fc6d5f673850"},{"type":"text"}]}}}]},"surfaceOp":"append"} diff --git a/snapshots/session/apply-patch-update/session.v4.jsonl b/snapshots/session/apply-patch-update/session.v4.jsonl index 21d15ecd68..6390a0156e 100644 --- a/snapshots/session/apply-patch-update/session.v4.jsonl +++ b/snapshots/session/apply-patch-update/session.v4.jsonl @@ -21,7 +21,7 @@ {"type":"step/start","data":{"turn":1,"step":2}} {"type":"assistant/message","data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"reasoning","text":""},{"type":"tool-call","id":"call_00_ET_XIC5uzZvjHRwm86VUzFE0668","name":"apply_patch","arguments":"{\"patch\": \"*** Begin Patch\\n*** Update File: src/a.ts\\n@@\\n-export const alpha = 1;\\n+export const ALPHA = 1;\\n*** Update File: src/b.ts\\n@@\\n-export const beta = 2;\\n+export const BETA = 2;\\n*** Add File: src/c.ts\\n+export const c = 3;\\n*** End Patch\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-pro","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-pro"},"blocks":[{"type":"reasoning","signature":"9478688e-dd1d-4246-8ae1-e8951a559a58"},{"type":"tool-call"}]}},"id":"{{message:7}}"},"usage":{"inputTokens":212,"outputTokens":122,"cacheReadTokens":5248,"cacheWriteTokens":0,"totalTokens":5582},"stream":[{"type":"chunk","time":1792123132213,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"chunk","time":1792123133344,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":""}}},{"type":"chunk","time":1792123133345,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1792123133345,"index":1,"dt":[],"id":"call_00_ET_XIC5uzZvjHRwm86VUzFE0668","name":"apply_patch","args":[""]},{"type":"tool-call-chunks","time0":1792123133360,"index":1,"dt":[0,0,0,0,24,0,0,0,41,1,0,0,0,0,36,0,0,0,0,0,30,0,1,4,0,0,322,0,0,0,0,0,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0],"id":"call_00_ET_XIC5uzZvjHRwm86VUzFE0668","args":["{","\"","patch","\"",": ","\"","***"," Begin"," Patch","\\n","***"," Update"," File",":"," src","/a",".ts","\\n","@@","\\n","-","export"," const"," alpha"," ="," ","1",";\\n","+","export"," const"," AL","P","HA"," ="," ","1",";\\n","***"," Update"," File",":"," src","/b",".ts","\\n","@@","\\n","-","export"," const"," beta"," ="," ","2",";\\n","+","export"," const"," B","ETA"," ="," ","2",";\\n","***"," Add"," File",":"," src","/c",".ts","\\n","+","export"," const"," c"," ="," ","3",";\\n","***"," End"," Patch","\"","}"]},{"type":"chunk","time":1792123133965,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"call_00_ET_XIC5uzZvjHRwm86VUzFE0668","name":"apply_patch","arguments":"{\"patch\": \"*** Begin Patch\\n*** Update File: src/a.ts\\n@@\\n-export const alpha = 1;\\n+export const ALPHA = 1;\\n*** Update File: src/b.ts\\n@@\\n-export const beta = 2;\\n+export const BETA = 2;\\n*** Add File: src/c.ts\\n+export const c = 3;\\n*** End Patch\"}"}}},{"type":"chunk","time":1792123133965,"chunk":{"type":"usage","usage":{"inputTokens":212,"outputTokens":122,"cacheReadTokens":5248,"cacheWriteTokens":0,"totalTokens":5582}}},{"type":"chunk","time":1792123133966,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-pro"},"blocks":[{"type":"reasoning","signature":"9478688e-dd1d-4246-8ae1-e8951a559a58"},{"type":"tool-call"}]}}}]},"surfaceOp":"append"} {"type":"tool/call","data":{"turn":1,"step":2,"callId":"call_00_ET_XIC5uzZvjHRwm86VUzFE0668","name":"apply_patch","arguments":"{\"patch\": \"*** Begin Patch\\n*** Update File: src/a.ts\\n@@\\n-export const alpha = 1;\\n+export const ALPHA = 1;\\n*** Update File: src/b.ts\\n@@\\n-export const beta = 2;\\n+export const BETA = 2;\\n*** Add File: src/c.ts\\n+export const c = 3;\\n*** End Patch\"}"}} -{"type":"tool/result","data":{"turn":1,"step":2,"message":{"role":"tool","source":{"kind":"tool","callId":"call_00_ET_XIC5uzZvjHRwm86VUzFE0668"},"toolCallId":"call_00_ET_XIC5uzZvjHRwm86VUzFE0668","content":[{"type":"text","text":"Success. Updated the following files:\nA {{cwd}}/src/c.ts\nM {{cwd}}/src/a.ts\nM {{cwd}}/src/b.ts"}],"isError":false,"id":"{{message:8}}"},"meta":{"diffs":[{"path":"{{cwd}}/src/a.ts","oldText":"export const alpha = 1;","newText":"export const ALPHA = 1;"},{"path":"{{cwd}}/src/b.ts","oldText":"export const beta = 2;","newText":"export const BETA = 2;"},{"path":"{{cwd}}/src/c.ts","oldText":null,"newText":"export const c = 3;\n"}],"stopped":false}},"sourceEventSeqs":[21],"surfaceOp":"append"} +{"type":"tool/result","data":{"turn":1,"step":2,"message":{"role":"tool","source":{"kind":"tool","callId":"call_00_ET_XIC5uzZvjHRwm86VUzFE0668"},"toolCallId":"call_00_ET_XIC5uzZvjHRwm86VUzFE0668","content":[{"type":"text","text":"Success. Updated the following files:\nA {{cwd}}/src/c.ts\nM {{cwd}}/src/a.ts\nM {{cwd}}/src/b.ts"}],"isError":false,"id":"{{message:8}}"},"meta":{"diffs":[{"path":"{{cwd}}/src/a.ts","oldText":"export const alpha = 1;","newText":"export const ALPHA = 1;"},{"path":"{{cwd}}/src/b.ts","oldText":"export const beta = 2;","newText":"export const BETA = 2;"}],"stopped":false}},"sourceEventSeqs":[21],"surfaceOp":"append"} {"type":"step/end","data":{"turn":1,"step":2}} {"type":"step/start","data":{"turn":1,"step":3}} {"type":"assistant/message","data":{"turn":1,"step":3,"message":{"role":"assistant","content":[{"type":"reasoning","text":""},{"type":"text","text":"Done. I made all three changes in a single `apply_patch` call:\n\n- `src/a.ts`: `alpha` → `ALPHA`\n- `src/b.ts`: `beta` → `BETA`\n- `src/c.ts`: created with `export const c = 3;` and a trailing newline"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-pro","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-pro"},"blocks":[{"type":"reasoning","signature":"f80d9b0c-e77d-4c8b-acc3-9b90115d935c"},{"type":"text"}]}},"id":"{{message:9}}"},"usage":{"inputTokens":228,"outputTokens":69,"cacheReadTokens":5504,"cacheWriteTokens":0,"totalTokens":5801},"stream":[{"type":"chunk","time":1792123135067,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"chunk","time":1792123135418,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":""}}},{"type":"chunk","time":1792123135418,"chunk":{"type":"block-start","index":1,"blockType":"text"}},{"type":"text-chunks","time0":1792123135418,"index":1,"dt":[2,0,0,40,2,5,28,0,4,0,30,0,1,0,0,36,0,0,0,0,1,0,35,0,3,0,0,0,36,2,0,0,0,0,31,0,0,0,1,0,37,1,0,0,0,0,44,0,0,0,0,1,24,1,0,0,0,36,0,0,0,0,0,38,0,0,0],"texts":["Done","."," I"," made"," all"," three"," changes"," in"," a"," single"," `","apply","_p","atch","`"," call",":\n\n","-"," `","src","/a",".ts","`:"," `","alpha","`"," →"," `","AL","P","HA","`\n","-"," `","src","/b",".ts","`:"," `","beta","`"," →"," `","B","ETA","`\n","-"," `","src","/c",".ts","`:"," created"," with"," `","export"," const"," c"," ="," ","3",";","`"," and"," a"," trailing"," new","line"]},{"type":"chunk","time":1792123135857,"chunk":{"type":"block-end","index":1,"block":{"type":"text","text":"Done. I made all three changes in a single `apply_patch` call:\n\n- `src/a.ts`: `alpha` → `ALPHA`\n- `src/b.ts`: `beta` → `BETA`\n- `src/c.ts`: created with `export const c = 3;` and a trailing newline"}}},{"type":"chunk","time":1792123135858,"chunk":{"type":"usage","usage":{"inputTokens":228,"outputTokens":69,"cacheReadTokens":5504,"cacheWriteTokens":0,"totalTokens":5801}}},{"type":"chunk","time":1792123135859,"chunk":{"type":"finish","reason":{"kind":"stop"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-pro"},"blocks":[{"type":"reasoning","signature":"f80d9b0c-e77d-4c8b-acc3-9b90115d935c"},{"type":"text"}]}}}]},"surfaceOp":"append"} diff --git a/snapshots/session/apply-patch-update/system-prompt.expected.md b/snapshots/session/apply-patch-update/system-prompt.expected.md index 17278f83f3..6c59e8d319 100644 --- a/snapshots/session/apply-patch-update/system-prompt.expected.md +++ b/snapshots/session/apply-patch-update/system-prompt.expected.md @@ -10,7 +10,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/apply-patch-update/tool-schemas.expected.json b/snapshots/session/apply-patch-update/tool-schemas.expected.json index 466de1c72d..42eef8dc17 100644 --- a/snapshots/session/apply-patch-update/tool-schemas.expected.json +++ b/snapshots/session/apply-patch-update/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/background-confinement-failure/system-prompt.expected.md b/snapshots/session/background-confinement-failure/system-prompt.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/session/background-confinement-failure/system-prompt.expected.md +++ b/snapshots/session/background-confinement-failure/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/background-confinement-failure/tool-schemas.expected.json b/snapshots/session/background-confinement-failure/tool-schemas.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/session/background-confinement-failure/tool-schemas.expected.json +++ b/snapshots/session/background-confinement-failure/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/both-mode-turn/system-prompt.expected.md b/snapshots/session/both-mode-turn/system-prompt.expected.md index 0a0d5c6b5c..e64386f2fa 100644 --- a/snapshots/session/both-mode-turn/system-prompt.expected.md +++ b/snapshots/session/both-mode-turn/system-prompt.expected.md @@ -15,7 +15,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -54,7 +54,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/session/browser-use-chrome-devtools-mcp/system-prompt.expected.md b/snapshots/session/browser-use-chrome-devtools-mcp/system-prompt.expected.md index 461f5a8f26..3612eecd64 100644 --- a/snapshots/session/browser-use-chrome-devtools-mcp/system-prompt.expected.md +++ b/snapshots/session/browser-use-chrome-devtools-mcp/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/browser-use-chrome-devtools-mcp/tool-schemas.expected.json b/snapshots/session/browser-use-chrome-devtools-mcp/tool-schemas.expected.json index 03542ca384..48d249393f 100644 --- a/snapshots/session/browser-use-chrome-devtools-mcp/tool-schemas.expected.json +++ b/snapshots/session/browser-use-chrome-devtools-mcp/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/browser-use-playwright-mcp/system-prompt.expected.md b/snapshots/session/browser-use-playwright-mcp/system-prompt.expected.md index 6cefcc7375..2262c04391 100644 --- a/snapshots/session/browser-use-playwright-mcp/system-prompt.expected.md +++ b/snapshots/session/browser-use-playwright-mcp/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/browser-use-playwright-mcp/tool-schemas.expected.json b/snapshots/session/browser-use-playwright-mcp/tool-schemas.expected.json index 2e6d7afb8f..1fa7223be6 100644 --- a/snapshots/session/browser-use-playwright-mcp/tool-schemas.expected.json +++ b/snapshots/session/browser-use-playwright-mcp/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/browser-use-stagehand-native/system-prompt.expected.md b/snapshots/session/browser-use-stagehand-native/system-prompt.expected.md index 64d53337dd..7fff0d7683 100644 --- a/snapshots/session/browser-use-stagehand-native/system-prompt.expected.md +++ b/snapshots/session/browser-use-stagehand-native/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/browser-use-stagehand-native/tool-schemas.expected.json b/snapshots/session/browser-use-stagehand-native/tool-schemas.expected.json index 3874394792..a51c01c4a2 100644 --- a/snapshots/session/browser-use-stagehand-native/tool-schemas.expected.json +++ b/snapshots/session/browser-use-stagehand-native/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/claude-code-mods/system-prompt.expected.md b/snapshots/session/claude-code-mods/system-prompt.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/session/claude-code-mods/system-prompt.expected.md +++ b/snapshots/session/claude-code-mods/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/claude-code-mods/tool-schemas.expected.json b/snapshots/session/claude-code-mods/tool-schemas.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/session/claude-code-mods/tool-schemas.expected.json +++ b/snapshots/session/claude-code-mods/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/computer-use-cua-driver-mcp/system-prompt.expected.md b/snapshots/session/computer-use-cua-driver-mcp/system-prompt.expected.md index 791a8dfbbe..5a471ad070 100644 --- a/snapshots/session/computer-use-cua-driver-mcp/system-prompt.expected.md +++ b/snapshots/session/computer-use-cua-driver-mcp/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/computer-use-cua-driver-mcp/tool-schemas.expected.json b/snapshots/session/computer-use-cua-driver-mcp/tool-schemas.expected.json index 2aaf74cb96..52eb0a5a73 100644 --- a/snapshots/session/computer-use-cua-driver-mcp/tool-schemas.expected.json +++ b/snapshots/session/computer-use-cua-driver-mcp/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/computer-use-cua-driver-native/system-prompt.expected.md b/snapshots/session/computer-use-cua-driver-native/system-prompt.expected.md index 39d880defe..2f15f7f7b5 100644 --- a/snapshots/session/computer-use-cua-driver-native/system-prompt.expected.md +++ b/snapshots/session/computer-use-cua-driver-native/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/computer-use-cua-driver-native/tool-schemas.expected.json b/snapshots/session/computer-use-cua-driver-native/tool-schemas.expected.json index 34f7d0b443..d6c1fe1290 100644 --- a/snapshots/session/computer-use-cua-driver-native/tool-schemas.expected.json +++ b/snapshots/session/computer-use-cua-driver-native/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/cordis-inspect-jsdoc/system-prompt.expected.md b/snapshots/session/cordis-inspect-jsdoc/system-prompt.expected.md index 0c5aa70e56..d0d8b9a38a 100644 --- a/snapshots/session/cordis-inspect-jsdoc/system-prompt.expected.md +++ b/snapshots/session/cordis-inspect-jsdoc/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/cordis-inspect-jsdoc/tool-schemas.expected.json b/snapshots/session/cordis-inspect-jsdoc/tool-schemas.expected.json index 3c1ca84649..4c434848cd 100644 --- a/snapshots/session/cordis-inspect-jsdoc/tool-schemas.expected.json +++ b/snapshots/session/cordis-inspect-jsdoc/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/cua-native/system-prompt.expected.md b/snapshots/session/cua-native/system-prompt.expected.md index d6571ec61f..a1a4fae10d 100644 --- a/snapshots/session/cua-native/system-prompt.expected.md +++ b/snapshots/session/cua-native/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/cua-native/tool-schemas.expected.json b/snapshots/session/cua-native/tool-schemas.expected.json index 3c6a9c78ab..4fc620e1a1 100644 --- a/snapshots/session/cua-native/tool-schemas.expected.json +++ b/snapshots/session/cua-native/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/cua-ptc/system-prompt.expected.md b/snapshots/session/cua-ptc/system-prompt.expected.md index c820b65790..8dd5962793 100644 --- a/snapshots/session/cua-ptc/system-prompt.expected.md +++ b/snapshots/session/cua-ptc/system-prompt.expected.md @@ -15,7 +15,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -99,7 +99,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/session/deepseek-messages-system-prompt/system-prompt.expected.md b/snapshots/session/deepseek-messages-system-prompt/system-prompt.expected.md index 7ab0cd1efc..c16bf22c75 100644 --- a/snapshots/session/deepseek-messages-system-prompt/system-prompt.expected.md +++ b/snapshots/session/deepseek-messages-system-prompt/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -50,7 +50,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/deepseek-messages-system-prompt/tool-schemas.expected.json b/snapshots/session/deepseek-messages-system-prompt/tool-schemas.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/session/deepseek-messages-system-prompt/tool-schemas.expected.json +++ b/snapshots/session/deepseek-messages-system-prompt/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/deepseek-protocol-system-prompt/system-prompt.expected.md b/snapshots/session/deepseek-protocol-system-prompt/system-prompt.expected.md index 7ab0cd1efc..c16bf22c75 100644 --- a/snapshots/session/deepseek-protocol-system-prompt/system-prompt.expected.md +++ b/snapshots/session/deepseek-protocol-system-prompt/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -50,7 +50,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/deepseek-protocol-system-prompt/tool-schemas.expected.json b/snapshots/session/deepseek-protocol-system-prompt/tool-schemas.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/session/deepseek-protocol-system-prompt/tool-schemas.expected.json +++ b/snapshots/session/deepseek-protocol-system-prompt/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/dynamic-tool-prompt-updates/system-prompt.expected.md b/snapshots/session/dynamic-tool-prompt-updates/system-prompt.expected.md index 2430259c5b..0f987ecf92 100644 --- a/snapshots/session/dynamic-tool-prompt-updates/system-prompt.expected.md +++ b/snapshots/session/dynamic-tool-prompt-updates/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -50,7 +50,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/dynamic-tool-updates/system-prompt.expected.md b/snapshots/session/dynamic-tool-updates/system-prompt.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/session/dynamic-tool-updates/system-prompt.expected.md +++ b/snapshots/session/dynamic-tool-updates/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/dynamic-tool-updates/tool-schemas.expected.json b/snapshots/session/dynamic-tool-updates/tool-schemas.expected.json index fd426fbb8a..3463da2a69 100644 --- a/snapshots/session/dynamic-tool-updates/tool-schemas.expected.json +++ b/snapshots/session/dynamic-tool-updates/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", @@ -669,7 +669,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", @@ -1337,7 +1337,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/foreground-confinement-timeout/system-prompt.expected.md b/snapshots/session/foreground-confinement-timeout/system-prompt.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/session/foreground-confinement-timeout/system-prompt.expected.md +++ b/snapshots/session/foreground-confinement-timeout/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/foreground-confinement-timeout/tool-schemas.expected.json b/snapshots/session/foreground-confinement-timeout/tool-schemas.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/session/foreground-confinement-timeout/tool-schemas.expected.json +++ b/snapshots/session/foreground-confinement-timeout/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/fs-glob-sampling/system-prompt.expected.md b/snapshots/session/fs-glob-sampling/system-prompt.expected.md index 17278f83f3..6c59e8d319 100644 --- a/snapshots/session/fs-glob-sampling/system-prompt.expected.md +++ b/snapshots/session/fs-glob-sampling/system-prompt.expected.md @@ -10,7 +10,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/fs-glob-sampling/tool-schemas.expected.json b/snapshots/session/fs-glob-sampling/tool-schemas.expected.json index afbd885384..fd9be9dbff 100644 --- a/snapshots/session/fs-glob-sampling/tool-schemas.expected.json +++ b/snapshots/session/fs-glob-sampling/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/headless.snapshot.ts b/snapshots/session/headless.snapshot.ts index 2ba56b6e28..329f575c44 100644 --- a/snapshots/session/headless.snapshot.ts +++ b/snapshots/session/headless.snapshot.ts @@ -1257,6 +1257,8 @@ describe('headless recorded-session snapshots', () => { for (const { scenario, retainedToolInput } of runs) { const skipped = scenario.manifest.platform === 'posix' && process.platform === 'win32' || scenario.manifest.platform === 'pwsh' && !hasPwsh + // A read-only directory does not deny root, so the recorded refusal cannot replay. + || scenario.manifest.workspace?.setup === 'readonly-patch-directory' && process.getuid?.() === 0 || mode === 'record' && scenario.manifest.recording === 'authored' || mode === 'record' && scenario.manifest.sessionFormat !== undefined const scenarioTest = skipped ? it.skip : mode === 'replay' ? it.concurrent : it diff --git a/snapshots/session/lsp-definition/system-prompt.expected.md b/snapshots/session/lsp-definition/system-prompt.expected.md index e684b9770a..c2baf00963 100644 --- a/snapshots/session/lsp-definition/system-prompt.expected.md +++ b/snapshots/session/lsp-definition/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/lsp-definition/tool-schemas.expected.json b/snapshots/session/lsp-definition/tool-schemas.expected.json index 46bc5912e3..249b464ec7 100644 --- a/snapshots/session/lsp-definition/tool-schemas.expected.json +++ b/snapshots/session/lsp-definition/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/mcp-resources-ptc/system-prompt.expected.md b/snapshots/session/mcp-resources-ptc/system-prompt.expected.md index a4904211d2..feb6fb80d4 100644 --- a/snapshots/session/mcp-resources-ptc/system-prompt.expected.md +++ b/snapshots/session/mcp-resources-ptc/system-prompt.expected.md @@ -15,7 +15,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -62,7 +62,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/session/mcp-resources/system-prompt.expected.md b/snapshots/session/mcp-resources/system-prompt.expected.md index 1b83449149..07602432ed 100644 --- a/snapshots/session/mcp-resources/system-prompt.expected.md +++ b/snapshots/session/mcp-resources/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/mcp-resources/tool-schemas.expected.json b/snapshots/session/mcp-resources/tool-schemas.expected.json index 1de4eba571..dba280389e 100644 --- a/snapshots/session/mcp-resources/tool-schemas.expected.json +++ b/snapshots/session/mcp-resources/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/model-switch-notice/system-prompt.expected.md b/snapshots/session/model-switch-notice/system-prompt.expected.md index 0575177265..32adbaa748 100644 --- a/snapshots/session/model-switch-notice/system-prompt.expected.md +++ b/snapshots/session/model-switch-notice/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -48,7 +48,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/model-switch-notice/tool-schemas.expected.json b/snapshots/session/model-switch-notice/tool-schemas.expected.json index ed175a434b..dce6a0979a 100644 --- a/snapshots/session/model-switch-notice/tool-schemas.expected.json +++ b/snapshots/session/model-switch-notice/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", @@ -669,7 +669,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/multimodal-spill-ends/system-prompt.expected.md b/snapshots/session/multimodal-spill-ends/system-prompt.expected.md index dd2f1f813e..8d8334c0fe 100644 --- a/snapshots/session/multimodal-spill-ends/system-prompt.expected.md +++ b/snapshots/session/multimodal-spill-ends/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/multimodal-spill-ends/tool-schemas.expected.json b/snapshots/session/multimodal-spill-ends/tool-schemas.expected.json index 58968175a7..3abd6ac256 100644 --- a/snapshots/session/multimodal-spill-ends/tool-schemas.expected.json +++ b/snapshots/session/multimodal-spill-ends/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/office-authoring-checker/system-prompt.expected.md b/snapshots/session/office-authoring-checker/system-prompt.expected.md index 55ecce0dab..a206590149 100644 --- a/snapshots/session/office-authoring-checker/system-prompt.expected.md +++ b/snapshots/session/office-authoring-checker/system-prompt.expected.md @@ -11,7 +11,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/office-progressive-native/system-prompt.expected.md b/snapshots/session/office-progressive-native/system-prompt.expected.md index 55ecce0dab..a206590149 100644 --- a/snapshots/session/office-progressive-native/system-prompt.expected.md +++ b/snapshots/session/office-progressive-native/system-prompt.expected.md @@ -11,7 +11,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/office-progressive-native/tool-schemas.expected.json b/snapshots/session/office-progressive-native/tool-schemas.expected.json index 8460ef7761..7f0b8612d4 100644 --- a/snapshots/session/office-progressive-native/tool-schemas.expected.json +++ b/snapshots/session/office-progressive-native/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/office-progressive-ptc/system-prompt.expected.md b/snapshots/session/office-progressive-ptc/system-prompt.expected.md index 1c06a17a31..98d9f82922 100644 --- a/snapshots/session/office-progressive-ptc/system-prompt.expected.md +++ b/snapshots/session/office-progressive-ptc/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -50,7 +50,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/session/office-sidecar-instructions/system-prompt.expected.md b/snapshots/session/office-sidecar-instructions/system-prompt.expected.md index 55ecce0dab..a206590149 100644 --- a/snapshots/session/office-sidecar-instructions/system-prompt.expected.md +++ b/snapshots/session/office-sidecar-instructions/system-prompt.expected.md @@ -11,7 +11,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/office-skills/system-prompt.expected.md b/snapshots/session/office-skills/system-prompt.expected.md index 55ecce0dab..a206590149 100644 --- a/snapshots/session/office-skills/system-prompt.expected.md +++ b/snapshots/session/office-skills/system-prompt.expected.md @@ -11,7 +11,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/office-skills/tool-schemas.expected.json b/snapshots/session/office-skills/tool-schemas.expected.json index 8460ef7761..7f0b8612d4 100644 --- a/snapshots/session/office-skills/tool-schemas.expected.json +++ b/snapshots/session/office-skills/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/persistent-pwsh-tool-turn/system-prompt.expected.md b/snapshots/session/persistent-pwsh-tool-turn/system-prompt.expected.md index 54e7b5e9ff..7efb45fc86 100644 --- a/snapshots/session/persistent-pwsh-tool-turn/system-prompt.expected.md +++ b/snapshots/session/persistent-pwsh-tool-turn/system-prompt.expected.md @@ -8,7 +8,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/persistent-pwsh-tool-turn/tool-schemas.expected.json b/snapshots/session/persistent-pwsh-tool-turn/tool-schemas.expected.json index 632aa2d503..9ea5ed6126 100644 --- a/snapshots/session/persistent-pwsh-tool-turn/tool-schemas.expected.json +++ b/snapshots/session/persistent-pwsh-tool-turn/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/pi-ai-conversation-updates/system-prompt.expected.md b/snapshots/session/pi-ai-conversation-updates/system-prompt.expected.md index 4df899010c..698840980a 100644 --- a/snapshots/session/pi-ai-conversation-updates/system-prompt.expected.md +++ b/snapshots/session/pi-ai-conversation-updates/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -50,7 +50,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/plugin-manager-mcp/system-prompt.expected.md b/snapshots/session/plugin-manager-mcp/system-prompt.expected.md index 1184ac9350..c21e3a9c14 100644 --- a/snapshots/session/plugin-manager-mcp/system-prompt.expected.md +++ b/snapshots/session/plugin-manager-mcp/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -48,7 +48,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/plugin-manager-mcp/tool-schemas.expected.json b/snapshots/session/plugin-manager-mcp/tool-schemas.expected.json index a8d1188ea9..38dfa9e5c4 100644 --- a/snapshots/session/plugin-manager-mcp/tool-schemas.expected.json +++ b/snapshots/session/plugin-manager-mcp/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", @@ -730,7 +730,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/plugin-manager/system-prompt.expected.md b/snapshots/session/plugin-manager/system-prompt.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/session/plugin-manager/system-prompt.expected.md +++ b/snapshots/session/plugin-manager/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/plugin-manager/tool-schemas.expected.json b/snapshots/session/plugin-manager/tool-schemas.expected.json index c3f837f984..09173323fe 100644 --- a/snapshots/session/plugin-manager/tool-schemas.expected.json +++ b/snapshots/session/plugin-manager/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/product-subagent-both/system-prompt.expected.md b/snapshots/session/product-subagent-both/system-prompt.expected.md index 2c0ac481e1..9df0eda842 100644 --- a/snapshots/session/product-subagent-both/system-prompt.expected.md +++ b/snapshots/session/product-subagent-both/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/product-subagent-both/tool-schemas.expected.json b/snapshots/session/product-subagent-both/tool-schemas.expected.json index a923c358f3..0ef5b21dc9 100644 --- a/snapshots/session/product-subagent-both/tool-schemas.expected.json +++ b/snapshots/session/product-subagent-both/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/product-subagent-codex/system-prompt.expected.md b/snapshots/session/product-subagent-codex/system-prompt.expected.md index 060757b43c..8b1719fea4 100644 --- a/snapshots/session/product-subagent-codex/system-prompt.expected.md +++ b/snapshots/session/product-subagent-codex/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/product-subagent-codex/tool-schemas.expected.json b/snapshots/session/product-subagent-codex/tool-schemas.expected.json index 4e05eb3460..77343d1332 100644 --- a/snapshots/session/product-subagent-codex/tool-schemas.expected.json +++ b/snapshots/session/product-subagent-codex/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/product-subagent-oar/system-prompt.expected.md b/snapshots/session/product-subagent-oar/system-prompt.expected.md index c266602df6..bf55478c03 100644 --- a/snapshots/session/product-subagent-oar/system-prompt.expected.md +++ b/snapshots/session/product-subagent-oar/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/product-subagent-oar/tool-schemas.expected.json b/snapshots/session/product-subagent-oar/tool-schemas.expected.json index fac28b57ac..7afa213906 100644 --- a/snapshots/session/product-subagent-oar/tool-schemas.expected.json +++ b/snapshots/session/product-subagent-oar/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/product-subagent-result-diagnostic/system-prompt.expected.md b/snapshots/session/product-subagent-result-diagnostic/system-prompt.expected.md index badb1ce693..d16f1ee1b7 100644 --- a/snapshots/session/product-subagent-result-diagnostic/system-prompt.expected.md +++ b/snapshots/session/product-subagent-result-diagnostic/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/product-subagent-result-diagnostic/tool-schemas.expected.json b/snapshots/session/product-subagent-result-diagnostic/tool-schemas.expected.json index 2527030f15..f6e61f0022 100644 --- a/snapshots/session/product-subagent-result-diagnostic/tool-schemas.expected.json +++ b/snapshots/session/product-subagent-result-diagnostic/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/provider-cwd/system-prompt.expected.md b/snapshots/session/provider-cwd/system-prompt.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/session/provider-cwd/system-prompt.expected.md +++ b/snapshots/session/provider-cwd/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/provider-cwd/tool-schemas.expected.json b/snapshots/session/provider-cwd/tool-schemas.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/session/provider-cwd/tool-schemas.expected.json +++ b/snapshots/session/provider-cwd/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/ptc-node-read-only/system-prompt.expected.md b/snapshots/session/ptc-node-read-only/system-prompt.expected.md index beee05dbb9..8b88880a36 100644 --- a/snapshots/session/ptc-node-read-only/system-prompt.expected.md +++ b/snapshots/session/ptc-node-read-only/system-prompt.expected.md @@ -15,7 +15,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -54,7 +54,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/session/ptc-node-workspace/system-prompt.expected.md b/snapshots/session/ptc-node-workspace/system-prompt.expected.md index beee05dbb9..8b88880a36 100644 --- a/snapshots/session/ptc-node-workspace/system-prompt.expected.md +++ b/snapshots/session/ptc-node-workspace/system-prompt.expected.md @@ -15,7 +15,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -54,7 +54,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/session/ptc-persistent/system-prompt.expected.md b/snapshots/session/ptc-persistent/system-prompt.expected.md index 7dc9b86205..214b4cf6f1 100644 --- a/snapshots/session/ptc-persistent/system-prompt.expected.md +++ b/snapshots/session/ptc-persistent/system-prompt.expected.md @@ -15,7 +15,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -54,7 +54,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/session/ptc-policy-change/system-prompt.expected.md b/snapshots/session/ptc-policy-change/system-prompt.expected.md index 77586b8b33..f67e2240a0 100644 --- a/snapshots/session/ptc-policy-change/system-prompt.expected.md +++ b/snapshots/session/ptc-policy-change/system-prompt.expected.md @@ -15,7 +15,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -54,7 +54,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/session/ptc-python-turn/system-prompt.expected.md b/snapshots/session/ptc-python-turn/system-prompt.expected.md index a04f50e035..b5a484c4b7 100644 --- a/snapshots/session/ptc-python-turn/system-prompt.expected.md +++ b/snapshots/session/ptc-python-turn/system-prompt.expected.md @@ -15,7 +15,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -49,7 +49,7 @@ class ToolCallError(Exception): toolName: str class ApplyPatchArgs(TypedDict): - # Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. + # Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. patch: str # The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. sandbox_permissions: NotRequired[Literal["workspace-write", "danger-full-access"]] diff --git a/snapshots/session/ptc-read-image/system-prompt.expected.md b/snapshots/session/ptc-read-image/system-prompt.expected.md index 39c39945d0..a5e431df10 100644 --- a/snapshots/session/ptc-read-image/system-prompt.expected.md +++ b/snapshots/session/ptc-read-image/system-prompt.expected.md @@ -15,7 +15,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -54,7 +54,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/session/ptc-turn/system-prompt.expected.md b/snapshots/session/ptc-turn/system-prompt.expected.md index beee05dbb9..8b88880a36 100644 --- a/snapshots/session/ptc-turn/system-prompt.expected.md +++ b/snapshots/session/ptc-turn/system-prompt.expected.md @@ -15,7 +15,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -54,7 +54,7 @@ type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string interface ToolArgsMap { /** Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions. */ apply_patch: { - /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them. */ + /** Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them. */ patch: string; /** The narrowest wider sandbox mode for a one-shot retry of the exact operation the sandbox just denied; the retry asks the user for approval. */ sandbox_permissions?: "workspace-write" | "danger-full-access"; diff --git a/snapshots/session/pty-tools-sandbox-backend/system-prompt.expected.md b/snapshots/session/pty-tools-sandbox-backend/system-prompt.expected.md index 4ce5b1f74d..b829d4a77f 100644 --- a/snapshots/session/pty-tools-sandbox-backend/system-prompt.expected.md +++ b/snapshots/session/pty-tools-sandbox-backend/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/pty-tools-sandbox-backend/tool-schemas.expected.json b/snapshots/session/pty-tools-sandbox-backend/tool-schemas.expected.json index 60e69fba9c..9cdf3def3a 100644 --- a/snapshots/session/pty-tools-sandbox-backend/tool-schemas.expected.json +++ b/snapshots/session/pty-tools-sandbox-backend/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/pwsh-tool-turn/system-prompt.expected.md b/snapshots/session/pwsh-tool-turn/system-prompt.expected.md index 111664fec7..6202559e38 100644 --- a/snapshots/session/pwsh-tool-turn/system-prompt.expected.md +++ b/snapshots/session/pwsh-tool-turn/system-prompt.expected.md @@ -10,7 +10,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/pwsh-tool-turn/tool-schemas.expected.json b/snapshots/session/pwsh-tool-turn/tool-schemas.expected.json index df9708c56d..4b2c314991 100644 --- a/snapshots/session/pwsh-tool-turn/tool-schemas.expected.json +++ b/snapshots/session/pwsh-tool-turn/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/ralph-loop/system-prompt.1.expected.md b/snapshots/session/ralph-loop/system-prompt.1.expected.md index 7621c93df6..3fc83de3db 100644 --- a/snapshots/session/ralph-loop/system-prompt.1.expected.md +++ b/snapshots/session/ralph-loop/system-prompt.1.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/ralph-loop/system-prompt.2.expected.md b/snapshots/session/ralph-loop/system-prompt.2.expected.md index 7621c93df6..3fc83de3db 100644 --- a/snapshots/session/ralph-loop/system-prompt.2.expected.md +++ b/snapshots/session/ralph-loop/system-prompt.2.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/ralph-loop/system-prompt.expected.md b/snapshots/session/ralph-loop/system-prompt.expected.md index 2395375191..10896bfbce 100644 --- a/snapshots/session/ralph-loop/system-prompt.expected.md +++ b/snapshots/session/ralph-loop/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/ralph-loop/tool-schemas.1.expected.json b/snapshots/session/ralph-loop/tool-schemas.1.expected.json index 9048949d8b..0320eb4872 100644 --- a/snapshots/session/ralph-loop/tool-schemas.1.expected.json +++ b/snapshots/session/ralph-loop/tool-schemas.1.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/ralph-loop/tool-schemas.2.expected.json b/snapshots/session/ralph-loop/tool-schemas.2.expected.json index 9048949d8b..0320eb4872 100644 --- a/snapshots/session/ralph-loop/tool-schemas.2.expected.json +++ b/snapshots/session/ralph-loop/tool-schemas.2.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/ralph-loop/tool-schemas.expected.json b/snapshots/session/ralph-loop/tool-schemas.expected.json index 89f0afc034..e9cc047ac6 100644 --- a/snapshots/session/ralph-loop/tool-schemas.expected.json +++ b/snapshots/session/ralph-loop/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/read-image/system-prompt.expected.md b/snapshots/session/read-image/system-prompt.expected.md index dd2f1f813e..8d8334c0fe 100644 --- a/snapshots/session/read-image/system-prompt.expected.md +++ b/snapshots/session/read-image/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/session-query-spill/system-prompt.expected.md b/snapshots/session/session-query-spill/system-prompt.expected.md index fb88ec4290..79dc3f9737 100644 --- a/snapshots/session/session-query-spill/system-prompt.expected.md +++ b/snapshots/session/session-query-spill/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/session-query-spill/tool-schemas.expected.json b/snapshots/session/session-query-spill/tool-schemas.expected.json index 6614d2015a..77cf8d7bc1 100644 --- a/snapshots/session/session-query-spill/tool-schemas.expected.json +++ b/snapshots/session/session-query-spill/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/subagent-acp-diagnostic/system-prompt.expected.md b/snapshots/session/subagent-acp-diagnostic/system-prompt.expected.md index dce0413196..966760ec0d 100644 --- a/snapshots/session/subagent-acp-diagnostic/system-prompt.expected.md +++ b/snapshots/session/subagent-acp-diagnostic/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/subagent-acp-diagnostic/tool-schemas.expected.json b/snapshots/session/subagent-acp-diagnostic/tool-schemas.expected.json index 44c8620d8f..aecb6910d8 100644 --- a/snapshots/session/subagent-acp-diagnostic/tool-schemas.expected.json +++ b/snapshots/session/subagent-acp-diagnostic/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/subagent-agent-preset/system-prompt.1.expected.md b/snapshots/session/subagent-agent-preset/system-prompt.1.expected.md index 05a10e58fe..fbb48a4af6 100644 --- a/snapshots/session/subagent-agent-preset/system-prompt.1.expected.md +++ b/snapshots/session/subagent-agent-preset/system-prompt.1.expected.md @@ -10,7 +10,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/subagent-agent-preset/tool-schemas.1.expected.json b/snapshots/session/subagent-agent-preset/tool-schemas.1.expected.json index 5a62363ea0..4a6d097144 100644 --- a/snapshots/session/subagent-agent-preset/tool-schemas.1.expected.json +++ b/snapshots/session/subagent-agent-preset/tool-schemas.1.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/subagent-agent-preset/tool-schemas.expected.json b/snapshots/session/subagent-agent-preset/tool-schemas.expected.json index 684567e964..d4ea3735a1 100644 --- a/snapshots/session/subagent-agent-preset/tool-schemas.expected.json +++ b/snapshots/session/subagent-agent-preset/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/subagent-child-question-rejection/tool-schemas.expected.json b/snapshots/session/subagent-child-question-rejection/tool-schemas.expected.json index 5ab4862508..0a70d89758 100644 --- a/snapshots/session/subagent-child-question-rejection/tool-schemas.expected.json +++ b/snapshots/session/subagent-child-question-rejection/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/subagent-structured-parent/system-prompt.1.expected.md b/snapshots/session/subagent-structured-parent/system-prompt.1.expected.md index 0d98e0d50e..576083d3ee 100644 --- a/snapshots/session/subagent-structured-parent/system-prompt.1.expected.md +++ b/snapshots/session/subagent-structured-parent/system-prompt.1.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/subagent-structured-parent/tool-schemas.1.expected.json b/snapshots/session/subagent-structured-parent/tool-schemas.1.expected.json index fe6864a509..e3e69419e3 100644 --- a/snapshots/session/subagent-structured-parent/tool-schemas.1.expected.json +++ b/snapshots/session/subagent-structured-parent/tool-schemas.1.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/subagent-structured-parent/tool-schemas.expected.json b/snapshots/session/subagent-structured-parent/tool-schemas.expected.json index 6d114f4138..36023b5659 100644 --- a/snapshots/session/subagent-structured-parent/tool-schemas.expected.json +++ b/snapshots/session/subagent-structured-parent/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/system-prompt-in-history/system-prompt.expected.md b/snapshots/session/system-prompt-in-history/system-prompt.expected.md index 08845487ed..67d17ad39d 100644 --- a/snapshots/session/system-prompt-in-history/system-prompt.expected.md +++ b/snapshots/session/system-prompt-in-history/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. @@ -50,7 +50,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/system-prompt-in-history/tool-schemas.expected.json b/snapshots/session/system-prompt-in-history/tool-schemas.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/session/system-prompt-in-history/tool-schemas.expected.json +++ b/snapshots/session/system-prompt-in-history/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/team-targets/system-prompt.expected.md b/snapshots/session/team-targets/system-prompt.expected.md index f9f2135c4b..9c2a8f2a97 100644 --- a/snapshots/session/team-targets/system-prompt.expected.md +++ b/snapshots/session/team-targets/system-prompt.expected.md @@ -21,7 +21,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/team-targets/tool-schemas.expected.json b/snapshots/session/team-targets/tool-schemas.expected.json index a807f6612a..6c61deca5f 100644 --- a/snapshots/session/team-targets/tool-schemas.expected.json +++ b/snapshots/session/team-targets/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/text-turn/system-prompt.expected.md b/snapshots/session/text-turn/system-prompt.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/session/text-turn/system-prompt.expected.md +++ b/snapshots/session/text-turn/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/text-turn/tool-schemas.expected.json b/snapshots/session/text-turn/tool-schemas.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/session/text-turn/tool-schemas.expected.json +++ b/snapshots/session/text-turn/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/web-fetch/system-prompt.expected.md b/snapshots/session/web-fetch/system-prompt.expected.md index cbf024f74c..51b6f7b030 100644 --- a/snapshots/session/web-fetch/system-prompt.expected.md +++ b/snapshots/session/web-fetch/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/web-fetch/tool-schemas.expected.json b/snapshots/session/web-fetch/tool-schemas.expected.json index a5f7546556..7600ff68c5 100644 --- a/snapshots/session/web-fetch/tool-schemas.expected.json +++ b/snapshots/session/web-fetch/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/workflow-confinement/system-prompt.expected.md b/snapshots/session/workflow-confinement/system-prompt.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/session/workflow-confinement/system-prompt.expected.md +++ b/snapshots/session/workflow-confinement/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/workflow-confinement/tool-schemas.expected.json b/snapshots/session/workflow-confinement/tool-schemas.expected.json index 463073bcdc..72187f26c3 100644 --- a/snapshots/session/workflow-confinement/tool-schemas.expected.json +++ b/snapshots/session/workflow-confinement/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/workspace-dependencies/system-prompt.expected.md b/snapshots/session/workspace-dependencies/system-prompt.expected.md index 55ecce0dab..a206590149 100644 --- a/snapshots/session/workspace-dependencies/system-prompt.expected.md +++ b/snapshots/session/workspace-dependencies/system-prompt.expected.md @@ -11,7 +11,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/workspace-dependencies/tool-schemas.expected.json b/snapshots/session/workspace-dependencies/tool-schemas.expected.json index 778a222ebd..eb2071a991 100644 --- a/snapshots/session/workspace-dependencies/tool-schemas.expected.json +++ b/snapshots/session/workspace-dependencies/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string", diff --git a/snapshots/session/worktree/system-prompt.expected.md b/snapshots/session/worktree/system-prompt.expected.md index 370ae77d8a..56ae2cad8d 100644 --- a/snapshots/session/worktree/system-prompt.expected.md +++ b/snapshots/session/worktree/system-prompt.expected.md @@ -13,7 +13,7 @@ Read an existing file before overwriting it with write (the default fs-observati Read a file before editing it (the default fs-observation-policy requires it), unless you just created or edited it in this session. -Prefer apply_patch over separate edit calls for changes across files or separated regions. Read files before updating or deleting them when the observation policy is enabled. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. +Prefer apply_patch over separate edit calls for changes across files or separated regions. Read a file before updating, deleting, or moving it (the default fs-observation-policy requires it), unless you just created or edited it in this session. Operations run in order, stop at the first failure, and are not rolled back; re-read affected files before retrying when needed. Use the glob tool — not shell find — to discover files by path pattern. diff --git a/snapshots/session/worktree/tool-schemas.expected.json b/snapshots/session/worktree/tool-schemas.expected.json index 5165964b25..c7e7782743 100644 --- a/snapshots/session/worktree/tool-schemas.expected.json +++ b/snapshots/session/worktree/tool-schemas.expected.json @@ -8,7 +8,7 @@ "properties": { "patch": { "type": "string", - "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating them." + "description": "Codex patch: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory. Read existing files before updating, deleting, or moving them." }, "sandbox_permissions": { "type": "string",