Skip to content

[Bug] kobo-sync: bogus "Sync to last page read?" popup after device auto-sleep #3596

@leahjessie

Description

@leahjessie

Description
After reading on a Kobo device, it occasionally shows a "Return to last page read?" popup. Accepting it jumps to a previous reading position that is not actually behind where the user left off, no reading progress was lost.

A previous fix #3585 addressed related popup triggers (float/int mismatch and dropped fields in bookmark responses). This issue identifies behavior that persists after that fix.

To Reproduce

  1. Open a book on a Kobo device synced to Calibre-Web and read to any position
  2. Set the device down with the book open and let it auto-sleep from inactivity (do not press the sleep button - manual sleep appears to trigger a sync/update first)
  3. Wait a few minutes
  4. Wake the device with the book open - the popup may take a few seconds and does not appear on every attempt, but reproduces more reliably with auto-sleep

Hypothesis

  • The /v1/library/<uuid>/state PUT handler saves the new reading position and advances priority_timestamp server-side, but the PUT response does not include the updated timestamp
  • The device sends a PUT when saving position (turning pages, manually going to sleep), but sends a GET passively on wake or WiFi reconnect - without necessarily sending a PUT first
  • The device's cached priority_timestamp is only updated from GET responses, not PUT responses - leaving it stale between the two events
  • When the device wakes and sends a GET, the server returns a priority_timestamp the device has never been told about → popup

Proposed Fix
Include PriorityTimestamp in the PUT response UpdateResults so the device can update its cached value immediately, closing the window between PUT and the next GET.

I am testing this locally and will follow up with a PR if it holds up.

Environment

  • OS: macOS (server-side issue, not OS-specific)
  • Python version: 3.13
  • Calibre-Web version: nightly
  • Docker: None
  • Kobo firmware: recent testing on 4.44.23552, but observed on earlier firmware before

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions