Repository navigation
Description
Reproduced on current main 91f7a56 (v0.14.13), Windows/Bun 1.3.10.
A normal memory_update that changes a row's prose silently discards the target's tags, issue, and kw when those fields are omitted. UpdateArgs does not even expose tags or issue, so the caller cannot preserve them through this tool.
Probe:
- Target: a repo-private open row with
tags:["import"],issue:"import-provenance-marker",kw:["queue retention"]. - Call
memory_updatewith its exact id, changed content, andstatus:"open". - Tool reports success, retires the old row, and the replacement has no tags, issue, or keywords.
This strips the [via import] signal used by formatMemory to identify unverified source material and loses the aliases needed to find the row. It is the update-tool counterpart of the viewer-edit preservation fixed in #129, rather than a new failure of that viewer fix.
Cause: replacement candidate construction builds a fresh candidate from args alone. It never carries target.tags / target.issue, and passes args.kw even when omitted.
Suggested fix / acceptance: preserve the target's source/provenance tags and issue; use target.kw when the caller omits kw, while honoring explicit keyword replacement/clearing. Keep this distinct from any deliberately requested status transition or a separately designed trust-promotion operation. Pin a small prose edit of imported and auto-captured rows and verify the provenance marker survives recall/injection.
Runnable regression test (expected red on v0.14.13)
Save as review-update-metadata.test.ts at the repository root, then run bun test ./review-update-metadata.test.ts. Uses the repository's existing inert host harness and temporary stores; no live memory or model calls.
import { afterEach, beforeEach, expect, spyOn, test } from "bun:test";
import { mkdirSync, mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { basename, dirname, join, resolve } from "node:path";
import { loadPlugin, type LoadedPlugin } from "./test/harness.ts";
import { appendMemory, loadAll, snapshotFiles } from "./src/memory.ts";
import { rememberSessionDir, resetSessionScopes, resolveRepo, setRepoScope } from "./src/repokey.ts";
import { resetState } from "./src/state.ts";
import * as evidence from "./src/evidence.ts";
let root: string, a: string, b: string;
let plugins: LoadedPlugin[];
beforeEach(() => {
root = mkdtempSync(join(tmpdir(), "osi-review-v01413-"));
a = join(root, "repo-a"); b = join(root, "repo-b");
mkdirSync(a); mkdirSync(b);
process.env.OPENCODE_MEMORY_DIR = join(root, "memory");
process.env.OPENCODE_COMMANDS_DIR = join(root, "commands");
resetState(); resetSessionScopes(); setRepoScope(null); plugins = [];
});
afterEach(async () => {
for (const p of plugins) await p.cleanup();
resetState(); resetSessionScopes(); setRepoScope(null);
delete process.env.OPENCODE_MEMORY_DIR; delete process.env.OPENCODE_COMMANDS_DIR;
if (dirname(resolve(root)) !== resolve(tmpdir()) || !basename(root).startsWith("osi-review-v01413-")) {
throw new Error("Unexpected fixture cleanup path");
}
rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 20 });
});
async function plugin(dir: string | null) {
const p = await loadPlugin(dir); plugins.push(p); return p;
}
async function seed(dir: string, content: string) {
const scope = resolveRepo(dir);
return appendMemory({ type: "context", scope: "planning", content, status: "open", repo: scope.key, repoPath: scope.path });
}
const ctx = (sessionID: string) => ({ sessionID, id: "review-proof" });
const candidate = { type: "context", scope: "planning", status: "open", content: "UNRESOLVED_A_PRIVATE_RELEASE_PLAN" };
test("updating prose must retain import provenance and omitted metadata", async () => {
const pa = await plugin(a);
const repo = resolveRepo(a);
const original = await appendMemory({ type: "context", scope: "planning", content: "Plan to prune aged queue entries every evening", status: "open", tags: ["import"], issue: "import-provenance-marker", kw: ["queue retention"], repo: repo.key, repoPath: repo.path });
const result = await pa.tools.memory_update.execute({ type: "context", scope: "planning", query: original, content: "Plan to prune aged queue entries every morning", status: "open" }, ctx("ses-a"));
expect(result.content).toContain("Updated");
const replacement = (await loadAll()).find(m => m.content.includes("every morning"))!;
console.log("update-provenance", JSON.stringify({result: result.content, tags: replacement.tags ?? [], issue: replacement.issue ?? null, kw: replacement.kw ?? []}));
expect(replacement.tags ?? []).toContain("import");
expect(replacement.issue).toBe("import-provenance-marker");
expect(replacement.kw).toContain("queue retention");
});
Activity
WhollyMindless commentedon Oct 28, 2026
Taking this one — branch
fix/security-154-155off 0.14.13, paired with #155 (both are thememory_updateentry's fidelity/honesty, both small, each with its own red probe). Plan per the acceptance: the replacement candidate carries the target'stagsandissue(currently dropped —UpdateArgsdoesn't even expose them), andkwfalls back totarget.kwwhen omitted while an explicitkwstill replaces or clears. Provenance-marker survival pinned through recall/injection, not just the row. The runnable probe in this issue body is verified red on91f7a56and rides intotest/as the regression. Deliberately no trust-promotion semantics here — a prose edit never upgrades an[via import]row's standing; it just stops destroying the marker.test(security): the update's success claims must be true at every exit (
test(security): probes for update metadata fidelity and post-append p…
fix(update): metadata fidelity and truthful partial results (#154 #155)
Merge pull request #158 from WhollyMindless/fix/security-154-155
chore(release): 0.14.18 [skip ci]
abogartz-opencode-self-improvement commentedon Oct 29, 2026
🎉 This issue has been resolved in version 0.14.18 🎉
The release is available on:
Your semantic-release bot 📦🚀