From 66109caa1d9c56bc885e58d2f9be46ba91448339 Mon Sep 17 00:00:00 2001 From: Luca Martial Date: Mon, 11 May 2026 20:39:05 -0700 Subject: [PATCH] Count reconciliation actions in reports --- packages/context/src/ingest/report-snapshot.ts | 1 + packages/context/src/ingest/reports.ts | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/context/src/ingest/report-snapshot.ts b/packages/context/src/ingest/report-snapshot.ts index 891c6fa7..cef85de7 100644 --- a/packages/context/src/ingest/report-snapshot.ts +++ b/packages/context/src/ingest/report-snapshot.ts @@ -153,6 +153,7 @@ export const ingestReportSnapshotSchema = z ), failedWorkUnits: z.array(z.string()), reconciliationSkipped: z.boolean(), + reconciliationActions: z.array(ingestActionSchema).default([]), conflictsResolved: z.array(conflictResolvedSchema).default([]), evictionsApplied: z.array(evictionAppliedSchema).default([]), unmappedFallbacks: z.array(unmappedFallbackSchema).default([]), diff --git a/packages/context/src/ingest/reports.ts b/packages/context/src/ingest/reports.ts index 6f60f149..2c3020b4 100644 --- a/packages/context/src/ingest/reports.ts +++ b/packages/context/src/ingest/reports.ts @@ -55,6 +55,10 @@ export interface IngestReportBody { workUnits: IngestReportWorkUnit[]; failedWorkUnits: string[]; reconciliationSkipped: boolean; + // Actions emitted by the reconciliation stage (wiki/sl writes from + // cross-WU reconciliation). Counted alongside workUnit.actions in + // savedMemoryCountsForReport so progress reports reflect all writes. + reconciliationActions?: MemoryAction[]; conflictsResolved: ConflictResolvedRecord[]; evictionsApplied: EvictionAppliedRecord[]; unmappedFallbacks: UnmappedFallbackRecord[]; @@ -111,7 +115,9 @@ export function postProcessorSavedMemoryCounts( } export function savedMemoryCountsForReport(report: IngestReportSnapshot): IngestSavedMemoryCounts { - const actions = report.body.workUnits.flatMap((workUnit) => workUnit.actions); + const workUnitActions = report.body.workUnits.flatMap((workUnit) => workUnit.actions); + const reconciliationActions = report.body.reconciliationActions ?? []; + const actions = [...workUnitActions, ...reconciliationActions]; const directCounts = { wikiCount: actions.filter((action) => action.target === 'wiki').length, slCount: actions.filter((action) => action.target === 'sl').length,