Skip to content

remember.delivered is per-machine state but is committed by the git backup: a first delivery on a second machine reports as already-seen, and every concurrent run conflicts #285

Closed

Description

@jqit-ricky

remember.delivered is per-machine state, but nothing excludes it from the git backup — so on a second machine a first delivery reports as already-seen, and every concurrent run conflicts.

The semantic bug first, because it is the one that misleads

scripts/session-start-hook.sh:539 writes the delivery record beside the handoff slot:

fingerprint=2325240425-2162
first_delivered=2026-07-31 23:40
deliveries=7

The comment above it (:492-495) states the purpose exactly:

The cost of keeping it is that the same note can be delivered more than once, and a stale handoff that reads as fresh is the same silent lie in new clothes. So a delivery record (fingerprint + first delivery + count) sits beside the slot, and any re-delivery of already-delivered content says so out loud.

That reasoning is per-machine, but the file is shared by the git backup. The fingerprint is a cksum of the handoff content, so it matches across machines — which means on machine B's first session with that handoff:

[already delivered 8 times since 2026-07-31 23:40 — no new handoff has been written since,
 so this is pending replacement, not news. You may already have acted on it.]

Machine B has never seen it. first_delivered is machine A's timestamp. The record designed to stop a stale handoff reading as fresh instead makes a fresh handoff read as stale — the same silent lie, inverted.

And it conflicts on every concurrent run

Two machines, same store, measured 2026-08-01:

ours:   fingerprint=2325240425-2162 / first_delivered=2026-07-31 23:40 / deliveries=7
theirs: fingerprint=208893538-2192  / first_delivered=2026-08-01 18:40 / deliveries=1

Every line differs, so every concurrent session-start produces a conflict. Worse, it is not fixable by a union merge driver: union would emit both sets of keys and yield a malformed record. It is the one file in the store where "keep both sides" is wrong.

It also actively jammed a recovery. Mid-merge, the plugin's hooks rewrote it, leaving it AM, and git merge --abort then refused:

error: Entry 'c--Users-…-project-b/remember.delivered' not uptodate. Cannot merge.
fatal: Could not reset index file to revision 'HEAD'.

That store stayed stuck mid-merge until it was resolved by hand.

Why nothing excludes it today

Every other piece of machine-local state is excluded — .git-backup.lock, .last-git-backup-ts, .git-backup-remote, */logs/, */tmp/, config.json. This one is the same class and is missed, and the reason looks structural rather than an oversight:

  • scripts/bootstrap-dirs.sh:128 writes a per-slug .gitignore containing * — the protective all-ignore for in-repo mode.
  • hooks.d/after_save/50-git-backup.sh:414-416 deletes that file in external-store mode, commenting: "In external git-backup mode it blocks all staging; the root-level .gitignore covers logs/tmp exclusions."

So in external mode the plugin relies on a root-level .gitignore it never creates. On this store that file is user-authored. There is therefore no plugin-owned place where remember.delivered could be excluded, which is presumably why it never was.

Suggested fix

Treat it as the machine-local state it is:

  1. Have the backup hook exclude */remember.delivered — either via a pathspec exclusion at staging (:(exclude)*/remember.delivered), or by writing/maintaining the root-level .gitignore the hook's own comment already assumes exists.
  2. git rm --cached any copy already tracked — an ignore alone does nothing to a tracked file, and this one is tracked in every store that has run the backup.
  3. Keep the file on disk. It is genuinely useful; it is only sharing it that breaks.

Alternatively, if the delivery record is considered worth sharing, it would need to be keyed per machine (e.g. deliveries.<host>), so a first delivery on a new machine still reads as first. That seems like more machinery than the feature needs.

A note on the workaround, in case it is useful

Locally I added */remember.delivered to the store's root .gitignore and untracked it, plus *.md merge=union in .gitattributes so two machines appending to the same today-YYYY-MM-DD.md merge instead of conflicting. Union is safe for the memory files specifically — it can only duplicate a line, never drop one — and it is exactly the resolution a human picks every time. It is precisely the wrong answer for remember.delivered, which is what made the distinction clear.

Environment

remember 0.12.3, Windows 11, Git Bash, external data_dir with {slug}, private backup repo, two machines writing the same store concurrently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions