respire-memory 0.3.15: every --parent must be shown first, --clear-parent is refused (#633)

Sync of risense-ai/respire-magpie v0.3.15 (2c5a237c). memory-tools.mjs is byte-identical to upstream at that commit.

- `--clear-parent` joins the forbidden memory options.
- Every `--parent` (both `--parent ID` and `--parent=ID`) must be a full id that was shown first, on remember and update alike; a non-trivial remember still needs one.

Run at 79b99037 on mote (Bun 1.4.2, Node 22): `node scripts/check.mjs` in the package (isolated temp HOME, detached worker, archive checks) passed; `bun test packages/respire-memory` 1 pass; `bun scripts/check.mjs respire-memory` passed.
Broken by hand: with 0.3.14's memory-tools.mjs the new placement checks fail ("Missing expected rejection").
Not tried: a real Respire install against a live model.

PR #633 by @luodaoyi.
This commit is contained in:
luodaoyi
2026-11-02 19:42:50 +08:00
committed by GitHub
parent b820704803
commit 32d58dd511
3 changed files with 19 additions and 6 deletions
+15
View File
@@ -277,6 +277,21 @@ try {
await assert.rejects(() => guarded.run({ command: 'remember', args: ['text', '--importance', 'important', '--title', 'title', '--parent', id] }));
await assert.rejects(() => guarded.run({ command: 'agent-config', args: ['--set', 'readonly=false'] }));
await assert.rejects(() => guarded.run({ command: 'show', args: [diaryId.slice(0,8)] }), /full-id-required/);
const placementCalls = [];
const placement = memoryTools(async args => {
placementCalls.push(args);
return { status: 'ok', summary: args[0] === 'prompt' ? { instructions: 'policy' } : { id } };
});
for (const command of ['recall', 'prompt', 'show']) await placement.run({ command, args: command === 'show' ? [id] : [] });
const placementBaseline = placementCalls.length;
const unshownParent = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';
for (const suffix of [['--clear-parent'], ['--clear-parent=true'], ['--parent', unshownParent], ['--parent=' + unshownParent], ['--parent', ''], ['--parent='], ['--force=true'], ['--merge-ids=' + id]]) {
await assert.rejects(() => placement.run({ command: 'update', args: [id, '--title', 'kept title', ...suffix] }), /forbidden-memory-option|shown-parent-required/);
}
assert.equal(placementCalls.length, placementBaseline);
await placement.run({ command: 'update', args: [id, '--title', 'kept title', '--parent=' + id] });
await placement.run({ command: 'show', args: [id] });
await placement.run({ command: 'update', args: [id, '--title', 'ordinary update'] });
const diaryGuard = memoryTools(call, { source: digest('strict-diary-readback') });
await diaryGuard.run({ command: 'recall', args: ['project'] }); await diaryGuard.run({ command: 'prompt', args: [] });
const diaryWrite = await diaryGuard.run({ command: 'remember', args: ['Current turn complete diary.', '--importance', 'trivial'] });