test(confidence-engine): expose CU synthesis failure shape
This commit is contained in:
@@ -432,16 +432,26 @@ async function composeDeepInvestigationCheckpoint({ situationGraph, previousQues
|
||||
const postEpisodeFindings = [...priorFindings, ...newFindingsFromContributions, ...accumulatedEpisodes];
|
||||
|
||||
let currentUnderstanding = null;
|
||||
let synthesisErrorDiagnostic = null;
|
||||
|
||||
if (episodeResult.success && updatedGraph) {
|
||||
// Reuse the same provider/model plumbing — no re-creation, just reuse
|
||||
const { synthesizeCurrentUnderstanding } = await import("../../lib/graph/current-understanding-synthesis.js");
|
||||
|
||||
const synthesized = await synthesizeCurrentUnderstanding(
|
||||
{ situationGraph: updatedGraph, findings: postEpisodeFindings },
|
||||
{ provider: timedProvider, modelName: model },
|
||||
);
|
||||
try {
|
||||
const synthesized = await synthesizeCurrentUnderstanding(
|
||||
{ situationGraph: updatedGraph, findings: postEpisodeFindings },
|
||||
{ provider: timedProvider, modelName: model },
|
||||
);
|
||||
|
||||
currentUnderstanding = synthesized?.currentUnderstanding ?? null;
|
||||
currentUnderstanding = synthesized?.currentUnderstanding ?? null;
|
||||
} catch (synthErr) {
|
||||
// Expose the safe structural diagnostic from synthesis validation failure
|
||||
if (synthErr?.sanitizedDiagnostic) {
|
||||
synthesisErrorDiagnostic = synthErr.sanitizedDiagnostic;
|
||||
}
|
||||
currentUnderstanding = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Consistent graphCheckpoint for both success and failure paths
|
||||
@@ -487,6 +497,9 @@ async function composeDeepInvestigationCheckpoint({ situationGraph, previousQues
|
||||
providerGenerateCalls,
|
||||
modelName: episodeResult.modelName ?? null,
|
||||
|
||||
/* ── CU synthesis error diagnostic (NEW — safe structural shape on validation failure) ─── */
|
||||
synthesisErrorDiagnostic,
|
||||
|
||||
/* ── Answer meaning (from production result) ─── */
|
||||
userSupportedMeaning: episodeResult?.proposal?.answerMeaning?.userSupportedMeaning ?? null,
|
||||
possibleInference: episodeResult?.proposal?.answerMeaning?.possibleInference ?? null,
|
||||
|
||||
Reference in New Issue
Block a user