Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(repair): failed-writes replay test selects the classified guard refusal (#5982 stores writer_coordinator_required, not P0001 storage_error)

garrytan0150ef86d28c
diff --git a/test/repair-failed-writes-5983.test.ts b/test/repair-failed-writes-5983.test.ts
index d601488bec..ad7f202847 100644
--- a/test/repair-failed-writes-5983.test.ts
+++ b/test/repair-failed-writes-5983.test.ts
@@ -85,7 +85,7 @@ test('refused caller writes replay once from their failed receipts; later writes
await attempt(engine, sourceId, 'put_page', { slug: 'people/dana-example', content: page('Dana Example', ['v2'], 'Dana v2.'), force: true });
await attempt(engine, sourceId, 'add_timeline_entry', { slug: 'people/dana-example', date: '2026-10-01', summary: 'Remote note' }, true);
const refused = await engine.executeRaw<{ operation: string; n: number }>(
- `SELECT operation, count(*)::int AS n FROM persistence_requests WHERE source_id=$1 AND state='failed' AND error_message LIKE 'Publication failed (P0001)%' GROUP BY 1 ORDER BY 1`, [sourceId]);
+ `SELECT operation, count(*)::int AS n FROM persistence_requests WHERE source_id=$1 AND state='failed' AND error_code='writer_coordinator_required' AND error_detail->>'origin'='database_guard' GROUP BY 1 ORDER BY 1`, [sourceId]);
expect(refused).toEqual([{ operation: 'add_timeline_entry', n: 3 }, { operation: 'put_page', n: 4 }]);
await engine.executeRaw(MANAGED_WRITER_GUARD_FUNCTION_SQL);