Skip to content

OPE-198 Move catch-up into watched stores - #219

Merged
ivanfenenko merged 4 commits into
mainfrom
feature/ope-198-reactive-data-layer
Aug 21, 2026
Merged

ivanfenenko merged 4 commits into
mainfrom
feature/ope-198-reactive-data-layer

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Aug 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Screens only subscribe and mutate. Pull-to-refresh marks the store dirty.
  • Process-level world signals (foreground, background, path, profile) start/stop SSE and mark stores stale. The store that is being watched REST-catches up.
  • Deletes ForegroundRestore and the home catch-up registry so resume is not split across restore, MessageSync, and Screen Models.
  • Catch-up REST now publishes even when v1 dual SSE reconnect bumps ConnectionEpoch mid-GET. Without that, fullReload merged the finished turn into the store and Session Chat kept the partial frame.

Docs

  • docs/features/reactive-data-layer/plan.md
  • docs/features/reactive-data-layer/decisions.md

Checks

  • Android ProcessWorldSignalsTest, LiveStoreTest / MessageSyncTest, MainScreenViewModelTest, SessionChatViewModelTest passed locally
  • iOS MessageSyncTests (including background-return epoch-bump emit), SceneWorldSignalsTests, live-store and home ViewModel tests passed on simulator locally
  • Pixel 9: background mid-stream, return after the turn finished → observeMessages emit … reason=background-return count=7

Linear

  • OPE-198

Risks / Follow-ups

  • Path roam debounce is still out of scope if Wi-Fi roam flashes offline
  • Session Context and Changes stay snapshot-plus-manual-refresh
  • Home pull-to-refresh no longer re-probes; it only invalidates live stores
  • Catch-up GET still waits the full HTTP timeout when the Tailscale path is dead; reconnect fetch recovers after that
  • Live / connecting / offline chrome still means SSE occupancy × path, not store freshness

Note

High Risk
Rewires Android and iOS resume, SSE occupancy, and REST catch-up for home lists and chat timelines. A stale-bit or epoch-gating bug can leave screens on stale data after background or path restore.

Overview
Moves gap catch-up out of a UI restore registry and into the stores that already have observe interest. Process adapters (ProcessWorldSignals / SceneWorldSignals) publish foreground, background, path, and profile edges, start/stop SSE after the 5s grace, and never call feature REST.

Deletes ForegroundRestore, home catch-up registry, setOpenSession / setHomeVisible, and ForegroundEventLifecycleCoordinator. Screen Models only collect; home pull-to-refresh invalidates live stores instead of clearCache + re-probe.

Each Live Store and MessageSync keeps a stale bit: Background / PathLost mark dirty; Foreground / PathReady REST only if dirty. SSE reconnect still force-refreshes and shares one ConnectionEpoch fetch with world-signal REST. Catch-up now emits even if dual v1 reconnect bumps epoch mid-GET, so a turn that finished in the background is not stuck on a partial frame.

Reviewed by Cursor Bugbot for commit df2387e. Bugbot is set up for automated code reviews on this repo. Configure here.

ForegroundRestore split REST across restore, MessageSync, and Screen
Models. World signals now mark stores stale; the observing store fetches.

Co-authored-by: Cursor <[email protected]>
@linear-code

linear-code Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
OPE-198 Reactive data layer

Returning to the app, recovering a network path, or pulling to refresh updates the visible screen from its store. Screens subscribe and mutate. Process-level signals mark stores stale. The store that is being watched fetches.

Replaces ForegroundRestore so catch-up is not split across restore, MessageSync, and Screen Models.

Remaining:

  • ☐ Path roam debounce if Wi-Fi roam flashes offline
  • ☐ Session Context and Changes stay snapshot-plus-manual-refresh until a later slice

Docs: docs/features/reactive-data-layer/

Review in Linear

v1 dual SSE reconnect was dropping the REST snapshot: fullReload ran
but observeMessages never emitted, so Session Chat stayed on the
partial turn.

Co-authored-by: Cursor <[email protected]>
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit df2387e. Configure here.

Catch-up GET that collides with an SSE epoch bump now adopts the new
epoch before publishing, so Session Chat is not stuck on a partial
frame. Todo stores clear the stale bit only after REST succeeds.
Home pull-to-refresh waits for watched live-store catch-up so the
spinner lasts until the list returns.
OPE-199 Pin Session Running accessory above the composer.

Keep Working/Retrying/Compacting visible for the whole turn from session status only, so the lamp no longer remounts when thought or tool rows settle.

Co-authored-by: Cursor <[email protected]>
@ivanfenenko
ivanfenenko merged commit 9d611c1 into main Aug 21, 2026
3 checks passed
@ivanfenenko
ivanfenenko deleted the feature/ope-198-reactive-data-layer branch August 21, 2026 10:33
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.

1 participant