You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(user-input-fold): nested code fences and tildes cause premature fold truncation and unclosed block leakage #334
import{foldUserMessage}from"./extensions/user-input-fold/index.ts";constnested=["Please review this prompt template:","````markdown","Here is an example snippet:","```javascript","function hello() {"," console.log(\"Hello world\");","}","```","Follow the instructions above carefully.",
...Array.from({length: 15},(_,i)=>`${i+1}. Step ${i+1}`),"````","End of message."].join("\n");console.log(foldUserMessage(nested));
实际输出:
Please review this prompt template:
````markdown
Here is an example snippet:
```javascriptfunctionhello() {
console.log("Hello world");
}
Follow the instructions above carefully.
Step 1
Step 2
Step 3
… folded 14 lines · full content was sent to the model
Closes #334. The user-input fold parser treated any three-or-more backticks as a closing fence, so nested four-backtick blocks could close early; tilde fences were not recognized.
Fix
Match closing fences to the opening fence character and minimum length.
Support both backtick and tilde fenced blocks.
Add regression coverage for nested and tilde fences.
Activity
wswsadadbaba123 commentedon Sep 1, 2026
我可以承接这一部分吗?
hasak21 commentedon Sep 1, 2026
可以的,欢迎承接!提交 PR 时关联此 Issue(如
Closes #334)即可,期待你的 PR!testikun commentedon Sep 5, 2026
Problem
Closes #334. The user-input fold parser treated any three-or-more backticks as a closing fence, so nested four-backtick blocks could close early; tilde fences were not recognized.
Fix
Validation
node --experimental-strip-types --test extensions/user-input-fold/index.test.tsgit diff --checktt-a1i commentedon Sep 7, 2026
已核对 #336 已合并且修复位于 main:按围栏字符和长度匹配关闭符,支持嵌套反引号与波浪号围栏,并有回归测试。按已完成关闭,感谢原作者的修复贡献。