Pulse convergence across replicas (issue #129)
Recent activity drops writes that land during a pod's watch gap, and each replica keeps its own list. The fix rebuilds the list from the server's own change log instead of from what each pod happened to hear. Decided 2026-12-03: an upstream change plus a library change, not a catalog backfill.
Cause
Confirmed against the 2026-12-03 sighting.
FollowChangesrecords onlyActivity(), which excludesResync. A gap's writes reach the caches as a resync, but never reach the pulse.- Gap 1: an MCP subscription's acknowledgement carries no cursor. A quiet world's stream reopens cursorless, and mcpwatch owes a resync.
- Gap 2: a pod with no lendable bearer for a world has no watch on it until a reader's read lands on that pod (
WorldSource→ErrNoReader). - Restart: the log starts empty.
- Order:
Pulse.Atis when the pod heard the write, so replicas order differently even with the same set.
Why not the catalog backfill
- It needs a borrowed bearer, and a lookup as that reader can list identity-scoped documents to other readers. The watch sees public paths only (ADR 0047 decision 10).
- The lookup carries no time, version, agent or user, so it needs one
versionsread per hit. It also misses archives.
Upstream (demarkus)
- Event write time. Add
at(RFC 3339 UTC, OPTIONAL) to the WATCH event block, anddemarkus.io/aton the MCP binding.changefeed.Event.At.- bucketstore takes it from
slotEntry.Modified, so every knowledge replica reports the same time. - filestore takes it from the commit, and the journal persists it.
- The fanout and the gateway forward it.
- Backlog on a cursorless subscribe. Add
backlog: <n>on WATCH, ordemarkus.io/backlog(URI → n) on MCP.- It is valid only without
since; withsinceit isbad-request. - Delivery starts up to n events before the head, as far as the server retains.
coalesceapplies.
- It is valid only without
- MCP position. A subscription that asked for a backlog gets one control notification after it,
demarkus.io/status: okplusdemarkus.io/cursor, so the stream holds a cursor even in a quiet world.- It is opt-in through the backlog key, because old mcpwatch clients treat an unknown status as an end.
- mcpwatch takes it as the stream cursor and passes nothing to the consumer.
- Client:
fetch.WatchRequest.Backlogandmcpwatch.Request.Backlog. Both decodeat.
Library
domain.Change.Atcomes from the event.Pulse.Atuses the write time, or the time heard when the event has none.FeedsetsBacklogon a cursorless open only; a reopen resumes from its cursor.pulseLog.recordkeeps the log ordered byAtand dedups by path, keeping the newest. An older replayed event never replaces a newer one.- Result: every replica holds the newest
pulseCapwrites from the same server log, in the same order, after a restart too.
Remaining loss
- A gap older than the server's retention (bucketstore checkpoint, or the 4096-event ring) still resyncs. Those writes are not activity anyone sees as recent.
Status
- 2026-12-03: plan only. Library branch
fix/pulse-backfillis created, with no code yet.