fix(agent): harden workbook patches against whole-file rewrites

Reject large whole-file FIND spans, narrow soft=True to miss-only, check
decompose CONTINUE patch counts, and unit-test workbook_solidify.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-28 16:22:39 +08:00
1 parent c36383bf28
commit d0b184939f
6 files changed
+146 -6

No files matched your search

+1 -1
View File
@@ -56,6 +56,6 @@ Exact FIND→REPLACE once in a UTF-8 text file. `find` must match exactly once.
Apply plan-style triple-angle FIND/REPLACE blocks from `text` to `path`.
Also accepts fenced find/replace pairs and minimal Begin Patch hunks.
When `soft=True`, FIND failures return `0` instead of aborting the run.
When `soft=True`, **only** “FIND not found” returns `0` (run continues). Empty FIND, multi-match, parse errors, and whole-file FIND still abort — whole-file rewrite is forbidden.
**> host_apply_patch_blocks path=`path` text=`text` soft=`soft`**
+1 -1
View File
@@ -54,6 +54,6 @@ description: 中文文件系统包装
+ `文本`
+ `软失败`=False
解析规划回复中的 FIND/REPLACE 块并应用到 `路径`。`软失败=真` 时找不到 FIND 返回 0 而不中断。
解析规划回复中的 FIND/REPLACE 块并应用到 `路径`。`软失败=真` 时仅「找不到 FIND」返回 0;空 FIND、多匹配、整文件重写仍报错。
**> host_apply_patch_blocks path=`路径` text=`文本` soft=`软失败`**