Include todo list in system prompt to survive condensation#11434
Include todo list in system prompt to survive condensation#114340xMink wants to merge 2 commits intoRooCodeInc:mainfrom
Conversation
The todo list was only visible via ephemeral message content in environment_details. After context condensation, the model could lose awareness of outstanding work. Render the current todo list as a dedicated system-prompt section when present, with sanitization for table integrity (pipe escaping, newline normalization, whitespace collapse). Wire todoList through both the task execution path and the webview prompt generator.
Reviewed changes since last review. Previous issue resolved, no new issues found.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| const normalizedContent = item.content | ||
| .replace(/\r?\n/g, " ") | ||
| .replace(/\|/g, "\\|") | ||
| .replace(/\s+/g, " ") | ||
| .trim() |
There was a problem hiding this comment.
The sanitization chain escapes pipes but not pre-existing backslashes. The existing formatReminderSection in reminder.ts does .replace(/\\/g, "\\\\" ).replace(/\|/g, "\\|") -- backslashes first, then pipes. Without that first step here, content like foo\|bar produces foo\\|bar after pipe escaping, where \\ is an escaped backslash and | is a raw pipe that breaks the table structure.
| const normalizedContent = item.content | |
| .replace(/\r?\n/g, " ") | |
| .replace(/\|/g, "\\|") | |
| .replace(/\s+/g, " ") | |
| .trim() | |
| const normalizedContent = item.content | |
| .replace(/\r?\n/g, " ") | |
| .replace(/\\/g, "\\\\") | |
| .replace(/\|/g, "\\|") | |
| .replace(/\s+/g, " ") | |
| .trim() |
Fix it with Roo Code or mention @roomote and request a fix.
Without backslash-first escaping, content containing \| resolves into a raw table pipe after pipe-escaping, breaking the markdown table. Matches the escaping order already used by formatReminderSection in reminder.ts. Includes regression test.
|
Addressed roomote/CodeQL feedback: |
Summary
Fixes #11433
CURRENT TODO LISTsection in the system prompt when todo items existtodoListthrough both the task execution path (Task.ts) and webview prompt generator (generateSystemPrompt.ts)Test Plan
formatTodoListSection(13 tests): empty/undefined handling, status mapping, pipe escaping, newline normalization, whitespace collapse, table structureSYSTEM_PROMPT(3 tests): section present with todos, absent when empty, absent when undefined