Skip to content

Desktop: 'Removed by me' is structurally empty — deleteActionItemByBackendId ignores its deletedBy argument and hard-deletes #11517

Closed

Description

@formed2forge

The desktop "Removed by me" filter can never contain anything, and the task-extraction model is never told which tasks the user deleted, because the only code that would record user provenance passes it to a function that ignores it.

ActionItemStorage.deleteActionItemByBackendId accepts a deletedBy argument and never reads it — it hard-deletes the row (desktop/macos/Desktop/Sources/Rewind/Core/ActionItemStorage.swift:1186-1207):

/// Hard-delete an action item by backend ID
func deleteActionItemByBackendId(
  _ backendId: String,
  deletedBy: String? = nil,           // never referenced in the body
  authorization: LocalMutationAuthorization
) async throws {
  ...
      if let record = try Self.fetchRecord(database, surfacedId: backendId) {
        try record.delete(database)   // hard delete, no soft-delete write
      }

Its caller believes the opposite (desktop/macos/Desktop/Sources/Stores/TasksStore.swift:3179-3186):

// Local-first: soft-delete in SQLite immediately for instant UI update
try await ActionItemStorage.shared.deleteActionItemByBackendId(
  task.id,
  deletedBy: "user",

Both halves of that comment are wrong: the row is hard-deleted, not soft-deleted, and the provenance is discarded.

Two user-visible consequences:

  1. "Removed by me" is structurally empty. TasksPage partitions the Removed lane on that column (desktop/macos/Desktop/Sources/MainWindow/Pages/TasksPage.swift:200-201):

    case .removedByAI: return task.deleted == true && task.deletedBy != "user"
    case .removedByMe: return task.deleted == true && task.deletedBy == "user"

    Since nothing ever writes "user", every retired row has deletedBy NULL, and nil != "user" is true — so everything lands in "Removed by AI".

  2. Task extraction never learns user deletions. TaskAssistant feeds the extraction model a "don't re-extract what the user deleted" list (desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/TaskExtraction/TaskAssistant.swift:1588):

    deletedTasks = try await ActionItemStorage.shared.getRecentDeletedTasks(limit: 10, deletedBy: "user")

    which filters AND deletedBy = ? (ActionItemStorage.swift:1420-1432). SQL = ? never matches NULL, so this returns [] always, and the model can keep re-suggesting tasks the user explicitly removed.

Grep evidence that no writer exists: the only occurrence of "user" in a deletedBy write position across the macOS target is the ignored argument above. Every other write is sourced from item.deletedBy (i.e. whatever the server sent), plus one explicit record.deletedBy = nil at TasksStore.swift:3363.

Found while reviewing #11460 (deleted-lane retirement), which is unrelated: that PR fixes whether retired rows reach the Removed lane at all. This is about which bucket they land in once there, and predates it.

Activity

  1. kodjima33 commented on Aug 14, 2026

    @kodjima33
    Collaborator

    PR #11559 fixes the single-delete path (ack keeps the tombstone + provenance; hydration stops clobbering deletedBy with the server's absent deleted_by).

    Remaining gap in the same failure class, deliberately left out of that fix: bulk delete still hard-deletes. TasksStore+BulkSelection.commitLocalBulkDelete calls ActionItemStorage.deleteActionItemsByBackendIds, which record.delete(database)s every row, so Select All → Delete stays unattributed and those tasks keep landing in "Removed by AI". Fixing it needs per-id handling (local-only rows still want a hard delete, and the partial-failure path .localFailure(remoteDeletedIDs:) has to stay correct), which is why it is not folded into a verified single-path fix.

  2. added a commit that references this issue on Aug 15, 2026
    c3e8282
  3. moved this from Someday to In review in omi TODO / bountieson Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions