Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(plugins): refresh pending replay claim timestamps (#5689)

LIf8d36722ab4c
diff --git a/examples/agent-hook-plugin/hosts/cursor/openviking.integration.json b/examples/agent-hook-plugin/hosts/cursor/openviking.integration.json
index 1c0e7fd90..0920ce723 100644
--- a/examples/agent-hook-plugin/hosts/cursor/openviking.integration.json
+++ b/examples/agent-hook-plugin/hosts/cursor/openviking.integration.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
- "version": "0.5.22",
+ "version": "0.5.23",
"clients": [
"cursor"
],
diff --git a/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json b/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json
index bf972471f..341344eea 100644
--- a/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json
+++ b/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json
@@ -1,6 +1,6 @@
{
"name": "openviking-memory",
- "version": "0.5.22",
+ "version": "0.5.23",
"description": "Long-term semantic memory for Kimi Code CLI, powered by OpenViking.",
"author": {
"name": "OpenViking",
diff --git a/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.json b/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.json
index 3f064589b..86d611685 100644
--- a/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.json
+++ b/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
- "version": "0.5.22",
+ "version": "0.5.23",
"clients": [
"kimicode"
],
diff --git a/examples/agent-hook-plugin/hosts/trae/openviking.integration.json b/examples/agent-hook-plugin/hosts/trae/openviking.integration.json
index 7d658d58a..857670d07 100644
--- a/examples/agent-hook-plugin/hosts/trae/openviking.integration.json
+++ b/examples/agent-hook-plugin/hosts/trae/openviking.integration.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
- "version": "0.5.22",
+ "version": "0.5.23",
"clients": [
"trae",
"trae-cn"
diff --git a/examples/agent-hook-plugin/hosts/zcode/openviking.integration.json b/examples/agent-hook-plugin/hosts/zcode/openviking.integration.json
index 6aa60ae14..1fb90ebeb 100644
--- a/examples/agent-hook-plugin/hosts/zcode/openviking.integration.json
+++ b/examples/agent-hook-plugin/hosts/zcode/openviking.integration.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
- "version": "0.5.22",
+ "version": "0.5.23",
"clients": [
"zcode"
],
diff --git a/examples/agent-hook-plugin/plugin.json b/examples/agent-hook-plugin/plugin.json
index 46e0a7a4e..06a976206 100644
--- a/examples/agent-hook-plugin/plugin.json
+++ b/examples/agent-hook-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "agent-hook-plugin",
- "version": "0.5.22",
+ "version": "0.5.23",
"description": "Long-term semantic memory for Cursor, TRAE, TRAE CN, ZCode and Kimi Code — powered by OpenViking. Auto-recall relevant memories and capture the conversation as it happens.",
"author": {
"name": "OpenViking",
diff --git a/examples/claude-code-memory-plugin/.claude-plugin/plugin.json b/examples/claude-code-memory-plugin/.claude-plugin/plugin.json
index 8de36eaa6..9a61bfd81 100644
--- a/examples/claude-code-memory-plugin/.claude-plugin/plugin.json
+++ b/examples/claude-code-memory-plugin/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "openviking-memory",
- "version": "0.7.14",
+ "version": "0.7.15",
"description": "Long-term semantic memory for Claude Code, powered by OpenViking. Auto-recall relevant memories at session start and capture important information during conversations.",
"author": {
"name": "OpenViking",
diff --git a/examples/claude-code-memory-plugin/package.json b/examples/claude-code-memory-plugin/package.json
index 56f30ec0f..7b47e54ae 100644
--- a/examples/claude-code-memory-plugin/package.json
+++ b/examples/claude-code-memory-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "claude-code-openviking-memory",
- "version": "0.7.14",
+ "version": "0.7.15",
"description": "OpenViking memory plugin for Claude Code — semantic long-term memory",
"type": "module",
"scripts": {
diff --git a/examples/claude-code-memory-plugin/scripts/shared/pending-queue.mjs b/examples/claude-code-memory-plugin/scripts/shared/pending-queue.mjs
index 38dccb1c8..e86f59b00 100644
--- a/examples/claude-code-memory-plugin/scripts/shared/pending-queue.mjs
+++ b/examples/claude-code-memory-plugin/scripts/shared/pending-queue.mjs
@@ -21,7 +21,7 @@
* (default: 50)
*/
-import { mkdir, readdir, readFile, rename, writeFile, unlink, stat, chmod } from "node:fs/promises";
+import { mkdir, readdir, readFile, rename, writeFile, unlink, stat, chmod, utimes } from "node:fs/promises";
import { createHash } from "node:crypto";
import { join } from "node:path";
import { homedir } from "node:os";
@@ -268,6 +268,10 @@ export async function claimForReplay(filename) {
const dir = getPendingDir();
const claimed = processingFilename(filename);
try {
+ // Recovery measures claim age, not how long the item waited offline.
+ // Refresh before publishing .processing so recovery cannot see an old mtime.
+ const now = new Date();
+ await utimes(join(dir, filename), now, now);
await rename(join(dir, filename), join(dir, claimed));
return claimed;
} catch {
diff --git a/examples/codex-memory-plugin/.codex-plugin/plugin.json b/examples/codex-memory-plugin/.codex-plugin/plugin.json
index 979ba3be5..64569b05f 100644
--- a/examples/codex-memory-plugin/.codex-plugin/plugin.json
+++ b/examples/codex-memory-plugin/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "openviking-memory",
- "version": "0.11.12",
+ "version": "0.11.13",
"description": "Long-term semantic memory for Codex, powered by OpenViking. Recall on UserPromptSubmit, incremental add_message on Stop (per turn), commit on SessionEnd (Codex >= 0.145) and on PreCompact, with an idle/ended sweep on SessionStart as the fallback for signals, crashes and older Codex builds. Includes a local stdio MCP proxy that reads OpenViking credentials from env/ovcli.conf.",
"author": {
"name": "OpenViking",
diff --git a/examples/codex-memory-plugin/scripts/shared/pending-queue.mjs b/examples/codex-memory-plugin/scripts/shared/pending-queue.mjs
index 38dccb1c8..e86f59b00 100644
--- a/examples/codex-memory-plugin/scripts/shared/pending-queue.mjs
+++ b/examples/codex-memory-plugin/scripts/shared/pending-queue.mjs
@@ -21,7 +21,7 @@
* (default: 50)
*/
-import { mkdir, readdir, readFile, rename, writeFile, unlink, stat, chmod } from "node:fs/promises";
+import { mkdir, readdir, readFile, rename, writeFile, unlink, stat, chmod, utimes } from "node:fs/promises";
import { createHash } from "node:crypto";
import { join } from "node:path";
import { homedir } from "node:os";
@@ -268,6 +268,10 @@ export async function claimForReplay(filename) {
const dir = getPendingDir();
const claimed = processingFilename(filename);
try {
+ // Recovery measures claim age, not how long the item waited offline.
+ // Refresh before publishing .processing so recovery cannot see an old mtime.
+ const now = new Date();
+ await utimes(join(dir, filename), now, now);
await rename(join(dir, filename), join(dir, claimed));
return claimed;
} catch {
diff --git a/examples/dsh-memory-plugin/package-lock.json b/examples/dsh-memory-plugin/package-lock.json
index 37272624e..513cf5b81 100644
--- a/examples/dsh-memory-plugin/package-lock.json
+++ b/examples/dsh-memory-plugin/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@openviking/dsh-memory-plugin",
- "version": "0.5.27",
+ "version": "0.5.28",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@openviking/dsh-memory-plugin",
- "version": "0.5.27",
+ "version": "0.5.28",
"license": "Apache-2.0",
"devDependencies": {
"@deepseek-ai/dsh-llm": "0.1.0-rc.6",
diff --git a/examples/dsh-memory-plugin/package.json b/examples/dsh-memory-plugin/package.json
index c95a02c8a..69a56e3ec 100644
--- a/examples/dsh-memory-plugin/package.json
+++ b/examples/dsh-memory-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@openviking/dsh-memory-plugin",
- "version": "0.5.27",
+ "version": "0.5.28",
"description": "OpenViking memory and context bundle for DeepSeek Harness",
"icon": "./icon.svg",
"type": "module",
diff --git a/examples/memory-plugin-shared/lib/pending-queue.mjs b/examples/memory-plugin-shared/lib/pending-queue.mjs
index 0666620bc..83ec54d71 100644
--- a/examples/memory-plugin-shared/lib/pending-queue.mjs
+++ b/examples/memory-plugin-shared/lib/pending-queue.mjs
@@ -20,7 +20,7 @@
* (default: 50)
*/
-import { mkdir, readdir, readFile, rename, writeFile, unlink, stat, chmod } from "node:fs/promises";
+import { mkdir, readdir, readFile, rename, writeFile, unlink, stat, chmod, utimes } from "node:fs/promises";
import { createHash } from "node:crypto";
import { join } from "node:path";
import { homedir } from "node:os";
@@ -267,6 +267,10 @@ export async function claimForReplay(filename) {
const dir = getPendingDir();
const claimed = processingFilename(filename);
try {
+ // Recovery measures claim age, not how long the item waited offline.
+ // Refresh before publishing .processing so recovery cannot see an old mtime.
+ const now = new Date();
+ await utimes(join(dir, filename), now, now);
await rename(join(dir, filename), join(dir, claimed));
return claimed;
} catch {
diff --git a/examples/memory-plugin-shared/pending-queue.test.mjs b/examples/memory-plugin-shared/pending-queue.test.mjs
index 10f922bfb..29f65b2c1 100644
--- a/examples/memory-plugin-shared/pending-queue.test.mjs
+++ b/examples/memory-plugin-shared/pending-queue.test.mjs
@@ -1,5 +1,6 @@
import assert from "node:assert/strict";
-import { readdir } from "node:fs/promises";
+import { readdir, utimes } from "node:fs/promises";
+import { join } from "node:path";
import test from "node:test";
import {
@@ -8,7 +9,8 @@ import {
listPending,
replayPending,
} from "./lib/pending-queue.mjs";
-import { withPendingDir } from "./testing/support.mjs";
+import { createOvHttp } from "./lib/ov-http.mjs";
+import { withMockOpenViking, withPendingDir, writeJson } from "./testing/support.mjs";
test("replayPending sends queued entries and removes them after success", async () => {
await withPendingDir(async () => {
@@ -74,3 +76,53 @@ test("claimForReplay atomically claims a file only once", async () => {
assert.deepEqual(await readdir(dir), [firstClaim]);
});
});
+
+for (const type of ["addMessage", "commitSession"]) {
+ test(`replayPending keeps an old ${type} backlog claimed during its HTTP request`, { timeout: 20_000 }, async () => {
+ await withPendingDir(async (dir) => {
+ const payload = type === "addMessage" ? { role: "user", content: "backlog" } : { keep_recent_count: 0 };
+ const queued = await enqueue(type, "queue-old-backlog", payload);
+ const old = new Date(Date.now() - 11 * 60_000);
+ await utimes(join(dir, queued.path), old, old);
+
+ let arrived;
+ let release;
+ const firstArrived = new Promise((resolve) => { arrived = resolve; });
+ const held = new Promise((resolve) => { release = resolve; });
+ let count = 0;
+ await withMockOpenViking(async (req, res) => {
+ for await (const chunk of req) {} // Drain the real HTTP request body.
+ if (++count === 1) {
+ arrived();
+ await held;
+ }
+ writeJson(res, { status: "ok", result: {} });
+ }, async (baseUrl, requests) => {
+ const fetchJSON = createOvHttp({ baseUrl }, { defaultTimeoutMs: 10_000 });
+ const first = replayPending(fetchJSON, () => {});
+ let waitTimer;
+ const deadline = new Promise((resolve, reject) => {
+ waitTimer = setTimeout(() => reject(new Error("timed out waiting for the replay request")), 5_000);
+ });
+ let second;
+ try {
+ await Promise.race([
+ firstArrived,
+ first.then(() => { throw new Error("replay completed without sending the queued operation"); }),
+ deadline,
+ ]);
+ second = await replayPending(fetchJSON, () => {});
+ } finally {
+ clearTimeout(waitTimer);
+ release();
+ }
+ const firstResult = await first;
+
+ assert.equal(requests.length, 1);
+ assert.equal(firstResult.replayed, 1);
+ assert.equal(second.replayed, 0);
+ assert.deepEqual(await listPending(), []);
+ });
+ });
+ });
+}
diff --git a/examples/opencode-plugin/package.json b/examples/opencode-plugin/package.json
index f18a47ca3..c5ef35299 100644
--- a/examples/opencode-plugin/package.json
+++ b/examples/opencode-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@openviking/opencode-plugin",
- "version": "0.5.18",
+ "version": "0.5.19",
"author": "@openviking",
"description": "Unified OpenCode plugin for OpenViking repository retrieval and long-term memory",
"type": "module",
diff --git a/examples/pi-coding-agent-extension/package-lock.json b/examples/pi-coding-agent-extension/package-lock.json
index 25af49a13..c9cafa7db 100644
--- a/examples/pi-coding-agent-extension/package-lock.json
+++ b/examples/pi-coding-agent-extension/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "openviking-pi-extension",
- "version": "0.4.21",
+ "version": "0.4.22",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "openviking-pi-extension",
- "version": "0.4.21",
+ "version": "0.4.22",
"dependencies": {
"@modelcontextprotocol/client": "2.0.0"
},
diff --git a/examples/pi-coding-agent-extension/package.json b/examples/pi-coding-agent-extension/package.json
index c187ea515..2f77d4c6e 100644
--- a/examples/pi-coding-agent-extension/package.json
+++ b/examples/pi-coding-agent-extension/package.json
@@ -1,6 +1,6 @@
{
"name": "openviking-pi-extension",
- "version": "0.4.21",
+ "version": "0.4.22",
"description": "OpenViking memory and context extension for the pi coding agent",
"private": true,
"type": "module",