Skip to content

Commit c97e1b0

Browse files
MaxLinCodeclaude
andcommitted
fix: remove confidence from rawWriteInterpretationSchema to fix OpenAI structured output 400
z.record() produces additionalProperties in JSON Schema, which OpenAI's structured outputs rejects — it requires every key in required to appear in properties. Confidence was never populated by the LLM in practice; unresolvedFields handles ambiguity instead. Remove confidence from the raw schema, default it to {} in the normalizer, and default the ?? lookup to 1 (fully trusted) so existing commit-policy thresholds are unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9ede728 commit c97e1b0

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

packages/core/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,6 @@ export const rawWriteInterpretationSchema = z.object({
10661066
scheduleFields: rawScheduleFieldsSchema.nullable(),
10671067
taskFields: rawTaskFieldsSchema.nullable(),
10681068
}),
1069-
confidence: z.record(z.string(), z.number().min(0).max(1)),
10701069
unresolvedFields: z.array(z.string().min(1)),
10711070
});
10721071

packages/core/src/write-commit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function commitScheduleFields(input: {
161161
continue;
162162
}
163163

164-
const fieldConfidence = interpretation.confidence[fieldPath] ?? 0;
164+
const fieldConfidence = interpretation.confidence[fieldPath] ?? 1;
165165
if (fieldConfidence < CONFIDENCE_THRESHOLD) {
166166
needsClarification.push(fieldPath);
167167
continue;
@@ -217,7 +217,7 @@ function commitTaskFields(input: {
217217
continue;
218218
}
219219

220-
const fieldConfidence = interpretation.confidence[fieldPath] ?? 0;
220+
const fieldConfidence = interpretation.confidence[fieldPath] ?? 1;
221221
if (fieldConfidence < CONFIDENCE_THRESHOLD) {
222222
needsClarification.push(fieldPath);
223223
continue;

packages/core/src/write-interpretation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function normalizeRawWriteInterpretation(
7474
taskName: raw.taskName,
7575
fields: resolvedFields,
7676
sourceText,
77-
confidence: raw.confidence,
77+
confidence: {},
7878
unresolvedFields: raw.unresolvedFields,
7979
};
8080
}

0 commit comments

Comments
 (0)