fix: normalize literal \n escape sequences in todo list parsing#11978
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: normalize literal \n escape sequences in todo list parsing#11978roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
Some models/providers send the todos parameter with literal escape sequences (the two-character string \n) rather than actual newline characters. This causes all checklist items to end up on a single line, resulting in only one todo item being parsed. Normalize literal \n and \r\n sequences into actual newlines before splitting. Adds test coverage for this scenario. Closes #11977
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.
Related GitHub Issue
Closes: #11977
Description
This PR attempts to address Issue #11977. Some models/providers (e.g. LiteLLM with qwen3-coder-next) send the
todosparameter with literal escape sequences -- the two-character string\n(backslash + n) rather than actual newline characters. This causes all checklist items to end up on a single line, so only one todo item gets parsed.The fix normalizes literal
\nand\r\nescape sequences into actual newline characters inparseMarkdownChecklist()before the existing.split(/\r?\n/)call. This is a minimal, targeted change that handles the mismatch without affecting any other behavior.Files changed:
src/core/tools/UpdateTodoListTool.ts- Added normalization of literal escape sequencessrc/core/tools/__tests__/updateTodoListTool.spec.ts- Added 3 test cases covering literal\n, literal\r\n, and mixed literal/actual newlinesTest Procedure
updateTodoListTool.spec.tscovering:\nescape sequences\r\nescape sequencescd src && npx vitest run core/tools/__tests__/updateTodoListTool.spec.tsPre-Submission Checklist
Documentation Updates
Additional Notes
Feedback and guidance are welcome.
Interactively review PR in Roo Code Cloud