Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(memory): add test for idempotency conflict across different scopes

Steven Enamakel036d609efb3c
diff --git a/scripts/mock-api/routes/__tests__/memory.test.mjs b/scripts/mock-api/routes/__tests__/memory.test.mjs
index 5491f4e3ee..6d8bf33218 100644
--- a/scripts/mock-api/routes/__tests__/memory.test.mjs
+++ b/scripts/mock-api/routes/__tests__/memory.test.mjs
@@ -88,6 +88,13 @@ test("a reused body key with different text is IDEMPOTENCY_CONFLICT", async () =
assert.equal(r.json.errorCode, "IDEMPOTENCY_CONFLICT");
});
+test("a reused body key with a different scope is IDEMPOTENCY_CONFLICT", async () => {
+ await write("scope-a", "k1", "same text");
+ const r = await write("scope-b", "k1", "same text");
+ assert.equal(r.status, 409);
+ assert.equal(r.json.errorCode, "IDEMPOTENCY_CONFLICT");
+});
+
test("scopes honours limit and caps at 50 without it", async () => {
for (let i = 0; i < 60; i += 1) await write(`scope/${String(i).padStart(2, "0")}`, `k${i}`, "x");
const all = await call("GET", "/memory/scopes?limit=100");