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:
1 file changed
+1
-1
@@ -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}`)
|
||||
|
||||
Reference in New Issue
Block a user