Skip to content

Session Chat memory: tighten transcript release races #1073

Open

Description

@ivanfenenko

Follow-up to #1060 (part of #1057). Review findings on the transcript release work. Each needs a narrow race, so none blocked the merge.

Remaining:

  • Android: an older release can wipe a live transcript. releasesInFlight keeps only the latest release job per session, and dropSession does not check that the slot still belongs to the released observation. If open, close and reopen happen faster than the first observation's loop can cancel, a reopened observation waits only for the second release, and the first release's dropSession then clears the live transcript. Fix: have each release join the observation's own afterRelease before dropping, or check ownership in dropSession.
  • Late older-page load after a release (Android and iOS). loadOlderMessages does not check that the observation it started under is still current. If a fetch returns after its session is released, it can refill the released store or prepend a page from the old cursor into a reopened transcript. Today the caller's ViewModel or view task is cancelled when the screen closes, so this is mostly theoretical. Guard the commit the same way as the coordinator loader and split-turn backfill. On iOS, also clear olderLoadInFlight on release.
  • Android: the skip-snapshot flag outlives the release. Observation.afterRelease stays non-null for the observation's whole life, so once a reopen has raced a release, later reopens within the grace period skip the warm paint and reload like a first open. Only skip while the release job is still active.
  • iOS: release finishes outside the lock. releaseTranscript drops the MessageSync state under the lock, but calls store.release, the cache-handle close and the prepared-history handlers after unlocking. A reopen in that window can have its store or prepared history cleared under it. Do the store release before a new observation can start, or tag it with the released run.

Activity

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions