refactor(tool-todo): store the trimmed content, matching the dedupe key

toTodoList dedupes and length-checks on the trimmed content but stored the raw
item.content, so a todo with leading/trailing whitespace was deduped by its
trimmed form yet persisted untrimmed — the stored value and the uniqueness key
could differ. Store the trimmed content so the persisted list matches what was
validated.
This commit is contained in:
Tianyi Cui
2026-06-29 10:50:31 +08:00
parent 46e31d8481
commit e17c4b748d
1 file changed
+1 -1
+1 -1
View File
@@ -70,7 +70,7 @@ function toTodoList(raw: { content: string; status: string }[]): TodoItem[] {
throw new Error(`invalid todo status ${JSON.stringify(status)}: expected one of ${STATUSES.join(', ')}`)
}
if (status === 'in_progress') inProgress++
todos.push({ content: item.content, status })
todos.push({ content, status })
}
if (inProgress > 1) {
throw new Error(`invalid todos: at most one task may be in_progress, got ${inProgress}`)