fix(confidence-engine): supply overview-specific output schema to generateReconstruction
synthesizeInvestigationOverview() called provider.generateReconstruction(prompt, modelName)
without an output contract. Without a structured-output schema the provider defaults to its
initial-reconstruction format which lacks { understanding, plausibleInterpretations }, causing
'Missing or invalid required fields' validation failure.
Add overviewOutputSchema (JSON-schema matching validateOverviewResponse contract) and pass as
third argument, matching the proven pattern in synthesizeCurrentUnderstanding().
53/53 tests PASS. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -391,6 +391,7 @@ RAW USER EVIDENCE
|
|||||||
|
|
||||||
- `synthesizeInvestigationOverview()` previously passed the full provider envelope (`{ response: { understanding, plausibleInterpretations }, providerApiPath, providerExecution }`) directly into `validateOverviewResponse()`, which expected only `{ understanding, plausibleInterpretations }`. This caused "Missing or invalid required fields" on real providers.
|
- `synthesizeInvestigationOverview()` previously passed the full provider envelope (`{ response: { understanding, plausibleInterpretations }, providerApiPath, providerExecution }`) directly into `validateOverviewResponse()`, which expected only `{ understanding, plausibleInterpretations }`. This caused "Missing or invalid required fields" on real providers.
|
||||||
- Fix now unwraps `.response` before overview validation, matching the proven pattern in `lib/graph/current-understanding-synthesis.js` (line 296: `validateSynthesisResponse(providerResult.response)`).
|
- Fix now unwraps `.response` before overview validation, matching the proven pattern in `lib/graph/current-understanding-synthesis.js` (line 296: `validateSynthesisResponse(providerResult.response)`).
|
||||||
|
- **Additional fix:** `synthesizeInvestigationOverview()` previously called `provider.generateReconstruction(prompt, modelName)` without an output schema, while `synthesizeCurrentUnderstanding()` passes `synthesisOutputSchema`. Without a structured-output contract the provider defaults to initial-reconstruction format, which lacks `{ understanding, plausibleInterpretations }`, causing validation failure. Fix adds `overviewOutputSchema` (JSON-schema: `{ understanding: string, plausibleInterpretations: string }`) and passes it as third argument.
|
||||||
- Owning regression (`tests/graph/investigation-overview-synthesis.test.js`) now mirrors real provider envelope shape (`{ response: { understanding, plausibleInterpretations }, providerApiPath }`). Regression fails against pre-fix seam and passes after fix.
|
- Owning regression (`tests/graph/investigation-overview-synthesis.test.js`) now mirrors real provider envelope shape (`{ response: { understanding, plausibleInterpretations }, providerApiPath }`). Regression fails against pre-fix seam and passes after fix.
|
||||||
- Canonical overview live helper `scripts/overview-experiment-helper.cjs` established with deterministic no-network self-test (zero live calls). Product-launch zero-Findings fixture reaches successful overview synthesis in deterministic mode. 53/53 overview tests pass.
|
- Canonical overview live helper `scripts/overview-experiment-helper.cjs` established with deterministic no-network self-test (zero live calls). Product-launch zero-Findings fixture reaches successful overview synthesis in deterministic mode. 53/53 overview tests pass.
|
||||||
- **Zero live proof yet.** Zero live calls made in this handoff.
|
- **Zero live proof yet.** Zero live calls made in this handoff.
|
||||||
|
|||||||
@@ -31,6 +31,16 @@ const overviewResponseSchema = z.object({
|
|||||||
plausibleInterpretations: z.string().min(1),
|
plausibleInterpretations: z.string().min(1),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const overviewOutputSchema = {
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
understanding: { type: "string" },
|
||||||
|
plausibleInterpretations: { type: "string" },
|
||||||
|
},
|
||||||
|
required: ["understanding", "plausibleInterpretations"],
|
||||||
|
additionalProperties: false,
|
||||||
|
};
|
||||||
|
|
||||||
const FORBIDDEN_FIELD_NAMES = new Set([
|
const FORBIDDEN_FIELD_NAMES = new Set([
|
||||||
"recommendation",
|
"recommendation",
|
||||||
"decision",
|
"decision",
|
||||||
@@ -245,6 +255,7 @@ export async function synthesizeInvestigationOverview(params, deps) {
|
|||||||
providerResult = await provider.generateReconstruction(
|
providerResult = await provider.generateReconstruction(
|
||||||
prompt,
|
prompt,
|
||||||
modelName,
|
modelName,
|
||||||
|
overviewOutputSchema,
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Error(`Overview synthesis provider call failed: ${err.message}`);
|
throw new Error(`Overview synthesis provider call failed: ${err.message}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user