fix:记忆更新出错 - #567
Open
Orsted290 wants to merge 1 commit into
Open
fix:记忆更新出错#567Orsted290 wants to merge 1 commit into
Orsted290 wants to merge 1 commit into
Conversation
A trailing newline was shown as an extra blank line, so patches against one-line memory files failed to match. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
更新只有一行的工作记忆时,apply_patch 报 hunk at line 3 was not found。文件实际只有 1 行,read_file 却把末尾换行多显示成空白的第 2 行。模型按这个结果写补丁,上下文对不上。报错里的 line 3 是补丁文本中 @@ 所在行,不是文件第 3 行。
apply_patch 会丢掉末尾换行带来的空行,read_file 以前不会。这次让 read_file 使用同样的切行规则:末尾换行不再多出一行,文件里真实的空行仍然保留。
样例是合成的 memory.md,不是原始那份 .workbuddy/memory/2026-09-22.md。内容为 only one memory line 加换行时,只显示第 1 行,没有第 2 行。内容为 first 后面接一个真实空行时,第 2 行空行仍在,不会再出现第 3 行。