Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(entities): B-9 enrichment and extract_entities follow a retired page's superseded_by chain, skip when unfollowable
garrytanec28392678db
diff --git a/src/core/enrichment-service.ts b/src/core/enrichment-service.tsindex 6bb76eac01..cdae2c39b6 100644--- a/src/core/enrichment-service.ts+++ b/src/core/enrichment-service.ts@@ -29,6 +29,7 @@ import { isAvailable } from './ai/gateway.ts';// #4222: shared generic-token reject list — same list gates the by-mention// gazetteer and drives the junk_entity_hubs doctor check.import { isJunkEntityName } from './entity-name-quality.ts';+import { followRetirement } from './entities/resolve.ts';import { maintenanceTransaction } from './persistence/attribution.ts';import { managedPersistenceEnabled } from './persistence/ownership.ts';import { deriveTrust, derivedMaintenanceTransaction, lowerDerivedPage, lowerDerivedPageIn } from './trust/taint.ts';@@ -75,6 +76,8 @@ export interface EnrichmentResult {action: 'created' | 'updated' | 'skipped';/** True when the created stub landed in the quarantine lane (issue #160). */quarantined?: boolean;+ /** Why nothing was written: the page is retired and its superseded_by / merged_into chain has no live target (B-9). */+ skipped_reason?: 'retired_page_unfollowable';tier: 1 | 2 | 3;backlinkCreated: boolean;timelineAdded: boolean;@@ -190,6 +193,15 @@ export async function enrichEntity(if (legacyPage && same(legacyPage.title ?? '') === same(request.entityName)) { slug = legacySlug; existingPage = legacyPage; }}}+ // B-9: a retired page (canonical: false, superseded_by) answers through its canonical page, as fact resolution does (#6898).+ if (existingPage) {+ const live = await followRetirement(engine, sourceId, slug);+ if (!live) {+ return { slug, action: 'skipped', skipped_reason: 'retired_page_unfollowable', tier, backlinkCreated: false, timelineAdded: false,+ mentionCount, mentionSources, suggestedTier, tierEscalated };+ }+ if (live.slug !== slug) { slug = live.slug; existingPage = await engine.getPage(slug, { sourceId }); }+ }let action: 'created' | 'updated' | 'skipped';if (existingPage) {