feat(core): improve edit tool guidance (#39198)

This commit is contained in:
Aiden Cline 2026-07-27 17:03:00 -05:00 committed by GitHub
commit 9200e353bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 28 deletions

View file

@ -455,7 +455,7 @@ describe("EditTool", () => {
),
)
it.live("rejects an in-place content change after matching but before conditional commit", () =>
it.live("applies the edit when content changes after matching", () =>
Effect.acquireUseRelease(
Effect.promise(() => tmpdir()),
(tmp) => {
@ -470,17 +470,9 @@ describe("EditTool", () => {
),
Effect.andThen((result) =>
Effect.gen(function* () {
// The message-less StaleContentError cause must not erase the tool's
// curated failure message; the canonical error is the sole authority.
expect(result).toEqual({
status: "error",
error: {
type: "tool.execution",
message: "File changed after permission approval. Read it again before editing.",
},
})
expect(yield* Effect.promise(() => fs.readFile(target, "utf8"))).toBe("newer\n")
expect(writes).toEqual([])
expect(result).toMatchObject({ status: "completed", output: { replacements: 1 } })
expect(yield* Effect.promise(() => fs.readFile(target, "utf8"))).toBe("after\n")
expect(writes).toEqual([target])
}),
),
)