Sync: tracked time never reaches other devices when a concurrent edit of the task wins on another device

Author: johannesjoCreated Sep 30, 2026Updated Oct 1, 2026

What the user sees

  • Device B tracks time on a task and changes something else on it, e.g. marks it done. B has not synced yet.
  • Device A changes the same task later, e.g. also marks it done, and syncs first.
  • After both sync, B still shows its tracked time, but A and every other device never get it.
  • The totals stay different for good. Nothing is pending and nothing is retried.

Reproduction

E2E, SuperSync, two browsers: e2e/tests/sync/supersync-commuting-edit-beside-local-win.spec.ts in #10398, test "a notes edit that commutes with a pending time delta survives a same-batch remote win". The test excludes time from its assertion and says why; with time asserted it fails. The steps:

  1. A and B have task T synced. It is scheduled for today, so tracking emits no planTasksForToday. Background sync is blocked.
  2. B records 1 min on T (syncTimeSpent, pending) and marks T done.
  3. A edits T's notes and marks T done, later than B, then syncs.
  4. Sync B, then A, then B.

Observed vs expected

  • Observed (run 2026-09-30, identical on master 17b4ff0 and on #10398): B has timeSpent: 60000, A has 0. Notes and done status agree.
  • Expected: both devices show 60000. A delta is additive and commutes with an edit that writes no time field, so nothing needs to be dropped.

Why

  • A's done toggle conflicts with B's pending ops on T. A's is later, so the remote side wins.
  • partitionLwwResolutions (packages/sync-core/src/conflict-resolution.ts) rejects every local op of the conflict, whoever wins. That includes B's syncTimeSpent delta, which the winner never touches.
  • B's state keeps the time, because the delta was already applied locally, but the rejected delta never uploads. This is #10260's shape, for an additive delta.

Released?

  • Yes, by code reading: v19.1.0 rejects all local ops of a conflict the same way (packages/sync-core/src/conflict-resolution.ts:544 at that tag).
  • It is not a regression from the unreleased #10252 crossing rule. The reproduction's tracking op conflicts through the done toggle, not through the crossing.
  • Not reproduced on a release build.

Proposed direction (for review)

  • Rule: on a remote win, keep a local syncTimeSpent delta pending instead of rejecting it, when the winning ops write no time field of that task.
  • How: move the kept delta past the winning ops' clock in place with rebasePendingLocalOps (operation-log-store.service.ts), as SupersededOperationResolverService already does. Its id, seq and payload stay, so it uploads once and replays once. No new op and no new wire key.
  • Why it's safe: the delta commutes with such a winner. It stays on a generic path (rule 12).
  • Residual: a winner that writes time, e.g. a released client's whole-entity replace snapshot, still wins over the delta, as today.
  • Proof needed: the E2E above, asserting time, in both conflict directions.

Related

  • #10260: the general "a losing op never uploads" shape.
  • #10378: two devices tracking an unscheduled task, where the auto-add-to-Today op blocks the merge. That is a different mechanism.
  • #10393: decision 7 on the LWW design note, "time on a remote win: local-win direction only", assumed the losing device's time was a no-worse residual. This reproduction shows it is permanent divergence, raised in the review of #10398.

Source: super-productivity/super-productivity