fix: address all Cubic P2 review issues
- session-utils: log SDK errors instead of silent swallow - opencode-message-dir: fix indentation, improve error log format - storage: use session.list for sessionExists (handles empty sessions) - storage.test: use resetStorageClient for proper SDK client cleanup - todo-sync: add content-based fallback for id-less todo removal
This commit is contained in:
@@ -168,10 +168,15 @@ export async function syncAllTasksToTodos(
|
||||
|
||||
const finalTodos: TodoInfo[] = [];
|
||||
|
||||
const removedTaskSubjects = new Set(
|
||||
tasks.filter((t) => t.status === "deleted").map((t) => t.subject),
|
||||
);
|
||||
|
||||
for (const existing of currentTodos) {
|
||||
const isInNewTodos = newTodos.some((newTodo) => todosMatch(existing, newTodo));
|
||||
const isRemoved = existing.id && tasksToRemove.has(existing.id);
|
||||
if (!isInNewTodos && !isRemoved) {
|
||||
const isRemovedById = existing.id ? tasksToRemove.has(existing.id) : false;
|
||||
const isRemovedByContent = !existing.id && removedTaskSubjects.has(existing.content);
|
||||
if (!isInNewTodos && !isRemovedById && !isRemovedByContent) {
|
||||
finalTodos.push(existing);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user