Skip to content

Restore synced Home positions beyond the local timeline cache#6

Merged
masonasons merged 2 commits into
masonasons:mainfrom
johanntan:agent/home-marker-backfill
Jul 25, 2026
Merged

Restore synced Home positions beyond the local timeline cache#6
masonasons merged 2 commits into
masonasons:mainfrom
johanntan:agent/home-marker-backfill

Conversation

@johanntan

@johanntan johanntan commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Page backward through the Home timeline when the Mastodon marker is older than the local cache.
  • Refresh the synced Home position when the app returns from the background or becomes active again.
  • Merge the recovered history without duplicate rows or new-post notifications.
  • Preserve normal scrollback after restoration.
  • Prevent iOS’s automatic initial focus from canceling the pending restore.
  • Avoid repeatedly scanning for the same deleted or unreachable marker.

Root cause

Home-position sync only searched rows already loaded by the normal cache and refresh paths. If another client saved a position older than the local device’s cached timeline, the marker could not be resolved and the UI fell back to the newest post.

On iOS, automatic focus on that first post could also be interpreted as user navigation, canceling the asynchronous marker restore.

After an app had been backgrounded, its first refresh still carried the previous “user moved” state and therefore skipped pulling the other client’s marker. macOS also did not request a refresh when it became active again. This made a full relaunch appear necessary before either Apple client would adopt the new position.

Behavior

The existing fast path remains unchanged when the marker is already loaded.

When it is missing, the shared timeline core loads up to 25 pages—roughly 1,000 posts—until it finds the marker. Genuine user navigation still cancels the restore, so an active reader is not moved unexpectedly.

When a frontend resumes, the shared core starts a fresh sync window and refreshes the current timeline. Movement made after resuming still cancels an in-flight restore. Native activation hooks provide the same behavior on iOS, macOS, Windows, and Android.

Validation

  • 493 core checks, 0 failures
  • Shared-core C ABI smoke test
  • macOS Debug build
  • iOS Simulator Debug build
  • Live-tested background/foreground position handoff on macOS and iOS
  • git diff --check

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@johanntan
johanntan marked this pull request as ready for review July 25, 2026 04:08
Co-Authored-By: OpenAI Codex <noreply@openai.com>
@masonasons
masonasons merged commit 65a7a9a into masonasons:main Jul 25, 2026
4 checks passed
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