Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(graph): prime relation semantics inside the derived-link transaction (RLS lane inventory)

garrytan030e00ca23df
diff --git a/src/core/derived-links.ts b/src/core/derived-links.ts
index f2422135c6..a470bd7f99 100644
--- a/src/core/derived-links.ts
+++ b/src/core/derived-links.ts
@@ -54,7 +54,6 @@ export async function replaceDerivedLinks(
links: LinkBatchInput[],
opts: DerivedLinkReplacementOptions = {},
): Promise<{ created: number; removed: number }> {
- await primeRelationSemantics(engine as Partial<Pick<BrainEngine, 'getConfig' | 'listConfigKeys'>>);
const producers = ['markdown', 'wikilink-resolved', ...(opts.includeFrontmatter === false ? [] : ['frontmatter'])];
const unique = new Map<string, LinkBatchInput>();
for (const link of links) {
@@ -81,6 +80,7 @@ export async function replaceDerivedLinks(
}
const rows = [...unique.values()];
return engine.transaction(async tx => {
+ await primeRelationSemantics(tx);
await tx.lockPageKeys([{ sourceId: origin.sourceId, slug: origin.slug }, ...rows.flatMap(row => [
{ sourceId: row.from_source_id!, slug: row.from_slug }, { sourceId: row.to_source_id!, slug: row.to_slug },
])]);