Skip to content

Sync session read/unread state with server (session.viewed) #655

Closed

Description

@ivanfenenko

Context

Upstream OpenCode now keeps session read/unread state on the server (anomalyco/opencode#54780).

  • A session is unread when Session.time.idle is newer than Session.time.viewed.
  • Opening a session calls POST /api/session/{id}/view with body { "idle": <time.idle> }.
  • Other clients receive a session.viewed event.

Proposal

Use this as the source of truth for unread badges in the iOS and Android apps, so reading a session on one device clears it everywhere.

Tasks

  • Decode time.viewed / time.idle on sessions (iOS + Android)
  • Compute unread from idle > viewed for Home and session list badges
  • Call POST /api/session/{id}/view {idle} when a session is opened
  • Handle the session.viewed event in EventDomainAdapter and update local state
  • Fall back to the current local unread logic on servers without the endpoint (v1 / older 2.x)

Activity

  1. added 4 commits that reference this issue on Oct 14, 2026
  2. ivanfenenko commented on Oct 20, 2026

    @ivanfenenko
    CollaboratorAuthor

    Closing as completed. Both apps already decode time.viewed / time.idle, mark a session unread when idle is newer than viewed, call the v2 view endpoint when Session Chat opens, and apply session.viewed. Servers without that capability (v1) keep the local unread logic. Reopen if a device still shows a stale badge.

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