[Bug]: auto-recall with peer_scope=actor adds the same memories twice

Aperta Adatta ai principianti
#7,485 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, node.js
Ambito
ai, backend

Direzione di ricerca

Inizia da buildRecallBlockDetailed in examples/memory-plugin-shared/lib/recall-core.mjs e segui come il risultato del peer legacy viene combinato con il risultato dell’actor. Controlla che le quattro copie del plugin sotto examples/ seguano la stessa logica. Usa i passaggi forniti in repro.mjs per verificare che l’output contenga un blocco di contesto e che ogni memoria compaia una sola volta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Issue Origin

Observed or reproduced in a real environment

Bug Description

With OPENVIKING_RECALL_PEER_SCOPE=actor, every prompt in Claude Code gets two <openviking-context> blocks instead of one. I looked at one prompt: 10 memories in each block, 7 of them the same.

It comes from buildRecallBlockDetailed in recall-core.mjs. When there is a legacy peer id it runs a second recallForPeer and just joins the two blocks. User-scope memories match both queries, so they show up twice. The same code is in all four plugin copies under examples/.

Not the same as #5433: that one is about other peers leaking into recall, this one is about the plugin repeating what both requests return.

Steps to Reproduce

Save as repro.mjs in the repo root and run node repro.mjs:

import { mkdtemp } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { buildRecallBlock } from "./examples/memory-plugin-shared/lib/recall-core.mjs";

// Both peers return the same user-scope memory, as the server does for user memories.
const fetchJSON = async () => ({
  ok: true,
  result: {
    rendered: '<memory uri="viking://user/default/memories/preferences/style.md">prefers short answers</memory>',
    entries: [{ uri: "viking://user/default/memories/preferences/style.md" }],
    stats: {},
  },
});

const block = await buildRecallBlock(fetchJSON, { recallPeerScope: "actor" }, "hello", {
  actorPeerId: "github.com-o-r",
  legacyPeerId: "-Users-x-src-r",
  legacyCachePath: join(await mkdtemp(join(tmpdir(), "ov-")), "context-face.json"),
});
console.log((block.match(/<openviking-context/g) || []).length, "blocks,",
  (block.match(/style\.md/g) || []).length, "copies of style.md");
Expected Behavior

1 blocks, 1 copies of style.md: one block, each memory once.

Actual Behavior

2 blocks, 2 copies of style.md on main (c64e578). In real use it's about 1.4 KB of extra context on every prompt.

OpenViking Version

0.5.0 server, claude-code-memory-plugin 0.7.12; repro on main

Python Version

3.13.12 (the bug is in the Node plugin, Node v26.13.0)

Operating System

macOS

Lingua principale
Python
Stelle
41.8k
Fork
3.4k
Merge medio
19h 29m
PR unite (30g)
500

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di volcengine/OpenViking

Tutte le issue di volcengine/OpenViking

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.