Skip to content

fix(app): keep deleted conversations out of the offline cache - #24774

Merged
aryanorastar merged 14 commits into
mainfrom
codex/24719-conversation-delete-cache
Nov 6, 2026
Merged

aryanorastar merged 14 commits into
mainfrom
codex/24719-conversation-delete-cache

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

Mobile could restore a confirmed deletion from cached conversation history after reopening. It also restored failed deletes without telling the user why the conversation returned. Clear only the confirmed row from the current and legacy caches, and show a failure when the delete is refused. Queue the failure message behind any active Undo prompt.

Confirmed deletions also remove the row and its processing cards from other open lists and fence stale writes from separate providers. Persist the confirmed ID for its account before rewriting either cache. A restart during eviction or after a failed write leaves the marker in place. Successful eviction clears the marker after both snapshots have been saved.

The Java 21 pin from #24785 cleared both Android failures in the combined run. Main then landed the equivalent pin in 5503c2d. This branch takes the workflow from main, with no workflow changes in the final diff. The workflow passed actionlint and the four local mobile CI infrastructure tests. The final revision passed 194 focused Flutter tests, including the latest Home row and linked-task filters and a regression for late live updates during Undo and an in-flight delete. A refused request still reports failure after navigation. Late merge completion retires the sources without publishing a deleted target. A stale full page excludes confirmed deletions from its storage cursor, and an in-flight next-page request retries at the corrected offset. A simulated interruption before the cache rewrite completes verifies that the durable marker hides only the deleted row after restart. A completed request from an earlier sign-in session cannot alter the replacement session cache, even when the UID matches.

Refs #24719. This covers the reproduced mobile conversation paths. The reported account traces and the separate desktop, memory, task and recording-storage paths still need investigation.

Product invariants affected

none

How it was verified

  • The two new provider and widget regressions failed on main at 579400fdf6: two confirmed rows returned from cache, and a refused delete restored its row without an error.

  • 101 focused Flutter tests passed, including concurrent deletes, offline cache restoration, legacy snapshots, Undo, and account-switch isolation. Flutter analysis and local preflight passed.

  • An iPhone 16 Pro simulator on iOS 26.5 exercised the shared delete UI and real mobile HTTP client against a local fixture. A 409 restored the selected row and showed the error. A manual retry received 204. Reopening the provider with the fixture stopped kept the unrelated conversation and omitted the deleted one.

  • Two additional cache regressions cover false-returning and throwing storage writes. Both cache formats stay filtered on restart, unrelated rows remain, and the fallback does not apply to a different account. A second-provider regression verifies that an older Home response cannot restore a row deleted by the day view. An additional processing regression covers real and optimistic cards, unrelated work and late updates. Two route-lifetime cases verify that a confirmed response still evicts after navigation and cannot affect a replacement session. The expanded focused run passed all 123 tests.

  • On the updated iPhone 16 Pro simulator build, an older response from a second provider and a forced preference write failure both followed the successful retry. Both live lists excluded the deleted row and a fresh offline reopen kept only the unrelated row. Both simulator cases passed again on the updated revision, including removal of matching processing cards, late processing events, and a delayed confirmation after the owning route was disposed. The final simulator run also injected a stale live update during Undo and confirmed the selected row stayed hidden until the server response. The latest simulator run passed three scenarios, including both confirmation and refusal after leaving the route.

Tests

conversation_pending_delete_test.dart exercises two confirmed deletes and a fresh provider reopening from disk. conversation_hub_actions_test.dart verifies the error after the initiating control has unmounted. conversation_cache_background_decode_test.dart verifies both cache formats are cleaned off the UI isolate.

UI evidence

iPhone 16 Pro simulator with two synthetic rows. The shared delete flow restores the selected row and shows its error after a 409 refusal.

Refused mobile conversation delete

Failure class (fixes)

Failure-Class: none

Line-Count-Exception: app/lib/backend/preferences.dart | 1661 -> 1757 | Eviction shares the existing preference cache generation and account guards so older or legacy cache writes cannot restore the deleted row.
Line-Count-Exception: app/lib/providers/conversation_provider.dart | 2279 -> 2349 | The shared delete lifecycle owns Undo, failure feedback and serialization with existing cache and merge writes.

@aryanorastar
aryanorastar marked this pull request as ready for review November 6, 2026 10:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T14:23:04.913380Z 8ff2c88 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 10 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@aryanorastar
aryanorastar marked this pull request as draft November 6, 2026 10:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c048f3938e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@aryanorastar
aryanorastar marked this pull request as ready for review November 6, 2026 11:29

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 10 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@aryanorastar
aryanorastar marked this pull request as draft November 6, 2026 11:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3fa7aabcd8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

kodjima33 and others added 3 commits November 6, 2026 06:41
ubuntu-latest is rolling to ubuntu-26.04, whose default JDK 25 makes Gradle
fail with "Unsupported class file major version 69" (#24737 run
42207263552, twice). The emulator job already pins temurin 21; the compile
smoke and JVM unit test jobs relied on the runner default.
@aryanorastar
aryanorastar marked this pull request as ready for review November 6, 2026 12:42
@aryanorastar
aryanorastar marked this pull request as draft November 6, 2026 12:43

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed against the latest diff

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a8fe31135a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@aryanorastar
aryanorastar marked this pull request as ready for review November 6, 2026 13:23
@aryanorastar
aryanorastar marked this pull request as draft November 6, 2026 13:23

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 13 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b9c87f021

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@aryanorastar
aryanorastar marked this pull request as ready for review November 6, 2026 14:18
@aryanorastar
aryanorastar merged commit fb70be7 into main Nov 6, 2026
44 checks passed
@aryanorastar
aryanorastar deleted the codex/24719-conversation-delete-cache branch November 6, 2026 14:18
aryanorastar added a commit that referenced this pull request Nov 9, 2026
…24980)

Deleting a second memory could expose the first again during refresh,
and a refused request could restore an old account's private row after
sign-out. A draft deleted during upload could also leave its newly
created server record behind.

The shared memory delete flow now owns one operation per ID, joins
repeated commits, stops Undo at submission, reports refusals, and guards
publication by owner and session. Uploading drafts hand off their
canonical IDs before deletion. Create/delete authorization is rechecked
after authentication waits and before every HTTP retry. Confirmed
owner-scoped deletion markers protect cached and pending projections
through failed writes and restart; HTTP 404 is treated as already
absent.

Refs #24719. This is a separate reproducible mobile memory boundary.
#24774 already merged the conversation-cache fix. This PR does not close
the umbrella account/desktop/recording-storage trace investigation or
claim that either fix is in a store release.

## Verification

- Five new regressions failed on unchanged main before implementation.
Two additional paused-authentication regressions failed when transport
ownership fences were removed and passed with them restored.
- Full local Flutter suite passed: 8,542 tests, 10 skipped (bash test.sh
--concurrency=4). The 119 focused
deletion/provider/cache/edit-sheet/Spotlight tests also passed.
- iPhone 16 Pro / iOS 26.5: build and all five loopback integration
scenarios passed.
- Simulator uses the real MemoryItem swipe/Undo, HTTP adapter and
provider with synthetic records. No production data or recording was
touched.
- Agent-flutter also exercised the shared deletion helper in a synthetic
component harness and captured visible refusal feedback. Full analyzer
ratchet passed. Targeted analysis reports only the pre-existing
avoid_print info in memories_provider.dart.
- 130 existing backend memory/identity compatibility tests passed;
backend request/response schemas are unchanged.
- Final diff reviewed at a17b424. The previous CI run found eight
signed-out fixtures in deletion_consistency_test.dart; they now
initialize the same authenticated owner as their rows, without relaxing
production guards. Draft until current-commit required CI passes; no
merge or release performed.

Implementation and verification checklist:
app/docs/memory-deletion-lifecycle.md.

## Product invariants affected

- INV-MEM-1: retains the existing memory tiers, canonical authority and
access policy.

## Failure class

Failure-Class: FC-continuation-resumed-after-unmount

## UI evidence

Synthetic component harness using the production MemoryItem and shared
deletion helper; loopback HTTP 409 restores the row and shows failure.
The separate simulator integration also exercised actual swipe, Undo,
5xx retries and offline reopen.

![Memory delete
refusal](https://raw.githubusercontent.com/BasedHardware/omi/518d9b0d16f241e9c4ed414146811da946f000d6/.agent-artifacts/ui-evidence/24719-memory-delete/001-mobile-ios-memory-delete-refusal.png)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants