Skip to content

Per-cycle mutable state (PR watermarks) is appended as durable memory and never superseded #326

Closed as not planned

Description

@abogartz

Problem

Per-cycle mutable state is being appended as durable memory, and nothing supersedes it. The store accumulates stale cursors that compete with real lessons in recall and injection.

Live store (~/.config/opencode/memory), rows written by the dispatch automation:

2026-11-03:  92 of 131 rows are pr-watch/pr-claim watermarks
2026-11-04: 162 of 215 rows are pr-watch/pr-claim watermarks
2026-11-05:  66 of  94 rows are pr-watch/pr-claim watermarks
356 such rows in total; 854 rows in the store

Representative content:

ts=2026-11-04T00:04:37.667Z type=context scope=review content="pr-watch conversation cursor: #277 2026-11-04T00:02:58Z ..."
ts=2026-11-04T00:09:30.104Z type=context scope=review content="pr-claim: #277 head c9193f92... diff f193e240... 2026-1..."

Why GATE-3 does not collapse them: src/gate/gate.ts:159 sets OVERLAP_FLOOR = 0.9 for reworded near-duplicates. A new watermark differs from the previous one only in a SHA and a timestamp, so token-level jaccard lands well below 0.9 and the row stores clean as "novel". Every dispatch cycle therefore adds a row. The floor is correctly high to avoid false merges of prose; it simply cannot see that these are versions of one value.

Net effect: the store's largest single contributor is state that has exactly one valid value at a time, and the older values are actively wrong. This degrades the retrieval quality the plugin exists to provide.

Work

  1. Decide the representation for mutable state. Options, in rough order of preference: a keyed/versioned row type where a write with the same key supersedes the previous row; a dedicated watermark API outside the memory store; or documentation that instructs memory_update with a stable selector for cursors.
  2. Whatever is chosen, the recall path must never surface a superseded cursor.
  3. Add a store-hygiene report (memory_status or the viewer) that flags a scope where the same prefix recurs N times without supersession, so this is visible before it reaches 356 rows.

Found while investigating why this repository's store grew so fast during the #315 work. Related: #316.

Activity

  1. added
    bug
    on Nov 6, 2026
  2. abogartz commented on Nov 8, 2026

    @abogartz
    OwnerAuthor

    Decision (maintainer, 2026-11-08): fix in the dispatch automation, not the plugin. The watermark rows are per-cycle cursors, not durable memories — the automation should stop writing them to the store (or write them to its own state file). The plugin will not guess supersession keys for context rows: an automatic supersede rule on scope+type would silently retire legitimate rows, which is the worse failure. Cleanup of the existing 356 watermark rows is part of the automation fix.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions