Skip to content

Desktop: raw TaskActionItem.deleted reads disagree with isRetired, so status-only-retired tasks read as live #11518

Closed

Description

@formed2forge

TaskActionItem has two ways to ask "is this task retired?", and they disagree. Roughly 32 call sites read the raw deleted field while ~20 read the isRetired projection, so a task retired only through canonical lifecycle status reads as live in the former.

The type documents why the projection exists (desktop/macos/Desktop/Sources/TaskActionItem.swift:82-87):

/// Server list/detail responses project soft retirement through canonical
/// lifecycle status and may omit the legacy `deleted` field. Keep that
/// projection here so every local cache and surface applies the same rule.
var isRetired: Bool {
  deleted == true || taskStatus == "cancelled" || taskStatus == "superseded"
}

So a server row with status: "cancelled" and no deleted field is retired — but task.deleted != true evaluates to "live" for it. Verified examples that read the raw field on objects that have not been through the local cache (where the column is written from isRetired, masking the difference):

  • desktop/macos/Desktop/Sources/MainWindow/ChatFirst/ChatFirstShell.swift:569 — a fresh detail fetch:
    if let task = try? await APIClient.shared.getActionItem(id: id), task.deleted != true {
      return task
    }
    A cancelled/superseded task is returned here as though live.
  • desktop/macos/Desktop/Sources/Stores/TasksStore.swift:2761, :2766 — remoteTask.deleted != true, hydratedTask.deleted != true on freshly fetched rows.
  • desktop/macos/Desktop/Sources/MainWindow/Pages/TasksPage.swift:200-201, :2546-2549, :5525 — filter predicates and isDeleted.
  • Live-lane filters over tasksStore.tasks: MainWindow/DesktopTopBar.swift:58, MainWindow/ChatFirst/ChatFirstTasksPage.swift:153, :413, :417, :547, MainWindow/ChatFirst/ChatFirstShell.swift:544, :566, :573, :604, :610, MainWindow/Pages/DashboardPage.swift:1006.

Why it is mostly invisible today: every writer that persists a task derives the stored column from the projection, not the raw field — Rewind/Core/ActionItemModels.swift:323 (deleted: item.isRetired), :376, :750, and Rewind/Core/ActionItemStorage.swift:744. So once a row round-trips through SQLite both readings agree. The divergence is only observable on objects read straight from an API response, which is exactly what the sites above do.

This is the same failure class as #11460 — retirement re-derived by each reader instead of stated once by an authority — but on paths the deleted lane never touches, so that PR neither causes nor fixes it. Filing separately rather than widening a verified bug fix.

Note when scoping: deleted is also a field on unrelated types (Conversation, the conversation-embedded ActionItem, memory/goal records), so the raw-read count above needs per-site type checking rather than a blind sweep.

Activity

  1. moved this from Someday to In progress in omi TODO / bountieson Aug 25, 2026
  2. aryanorastar commented on Aug 25, 2026

    @aryanorastar
    Collaborator

    Fixed in #12187.

    Root cause: TaskActionItem.isRetired correctly treats status: cancelled and status: superseded as retired, but several desktop readers bypassed it and checked only the optional legacy deleted flag. When the backend returned a status-only retirement (deleted omitted), those readers could still count, render, focus, filter, or mutate the task as live.

    The PR makes the legacy wire marker private while preserving the exact deleted JSON key, then migrates every TaskActionItem lifecycle read to the canonical isRetired predicate across:

    • legacy and chat-first task lists
    • Today/Tomorrow/Later and No Deadline surfaces
    • Removed by AI / Removed by me filters
    • dashboard and top-bar task projections
    • automation task selection
    • task chat complete/delete tools
    • canonical task cache placement

    Proof:

    • New TaskActionItemRetirementAuthorityTests builds cancelled and superseded tasks with deleted: nil and proves they are retired, land in the correct Removed filter, and cannot enter the active dated surface.
    • The same tests prove user-deletion provenance remains intact and encoding still emits "deleted": true (never the new private Swift property name), then decodes back as retired.
    • Related lifecycle/storage/navigation suite: 44 tests, 0 failures.
    • Debug Swift build: passed.
    • PR preflight: 22/22 checks passed, including all mapped desktop E2E flow coverage, SwiftFormat, SwiftLint (1,359 files), changelog, invariant, and test-quality gates.
    • A uniquely named app (omi-11518-retirement, bundle id com.omi.omi-11518-retirement) was built, signed, installed, launched, and confirmed through its automation bridge. Authenticated task CRUD could not be exercised on this machine because no desktop auth seed exists and the synthetic local stack requires unavailable Docker/Typesense; the PR does not claim that missing UI run.

    Full-suite disclosure: 5,766 tests ran with one skip and two failures in unrelated global-owner tests. One passed immediately in isolation; the other reproduces independently in isolation with the owner resolving to anonymous. Neither test touches a changed file. All task-retirement coverage is green.

  3. moved this from In progress to In review in omi TODO / bountieson Aug 25, 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