Skip to content

fix(questionnaire): add additionalProperties false for OpenAI strict mode#2792

Merged
Marfuen merged 1 commit intomainfrom
mariano/questionnaire-autofill-empty
May 7, 2026
Merged

fix(questionnaire): add additionalProperties false for OpenAI strict mode#2792
Marfuen merged 1 commit intomainfrom
mariano/questionnaire-autofill-empty

Conversation

@Marfuen
Copy link
Copy Markdown
Contributor

@Marfuen Marfuen commented May 7, 2026

Summary

  • The questionnaire auto-fill was silently extracting 0 questions because every chunk parse threw Invalid schema for response_format 'response': 'additionalProperties' is required to be supplied and to be false. The try/catch in parseChunkQuestionsAndAnswers swallowed the error and returned [] for every chunk.
  • Root cause: PARSING_MODEL = 'gpt-5-mini' routes through OpenAI's Responses API, which enforces strict structured outputs. Strict mode requires additionalProperties: false on every object schema (root + nested) and every property listed in required.
  • Fix: add additionalProperties: false to the root and nested objects, and add 'answer' to required (it was already nullable via anyOf: [string, null]).
  • Also fixed the same latent anti-pattern in content-extractor.ts's shared questionExtractionSchema. Today it's only used with Anthropic / Groq / gpt-4o-mini, but a model swap would silently break it.

Audit

Checked every generateObject / jsonSchema call across apps/api and apps/app — 13 files. Only the two patched files were affected. All other callers either use Anthropic, gateway-routed Gemini, output: 'no-schema', or zod schemas with no .optional() (Vercel AI SDK auto-emits additionalProperties: false for those).

Test plan

  • Re-upload q-section2.pdf to questionnaire auto-fill — questions should populate
  • Re-upload an Excel questionnaire (exercises content-extractor path) — still works
  • Verify Trigger.dev parse-questionnaire task completes without "Error parsing chunk" logs

Summary by cubic

Fixes questionnaire auto‑fill returning zero questions by making our JSON schemas compatible with OpenAI strict mode. Adds additionalProperties: false and requires answer, so gpt-5-mini parses chunks correctly instead of failing silently.

  • Bug Fixes
    • Added additionalProperties: false to root and nested objects in question-parser.ts and content-extractor.ts.
    • Added answer to required (still nullable).
    • Prevents swallowed parse errors; questions now populate and the shared extractor is future‑proof for strict‑mode models.

Written for commit 9f8d33e. Summary will update on new commits.

…mode

The gpt-5-mini parser was failing with "additionalProperties is required
to be supplied and to be false" because OpenAI's Responses API enforces
strict structured outputs, which requires additionalProperties: false on
every object schema and every property listed in required.

Also fix the same latent bug in content-extractor's shared schema, which
would break if any of its callers swapped to a strict-mode OpenAI model.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comp-framework-editor Ready Ready Preview, Comment May 7, 2026 3:29pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
app Skipped Skipped May 7, 2026 3:29pm
portal Skipped Skipped May 7, 2026 3:29pm

Request Review

@Marfuen Marfuen merged commit ea226b0 into main May 7, 2026
10 checks passed
@Marfuen Marfuen deleted the mariano/questionnaire-autofill-empty branch May 7, 2026 15:31
claudfuen pushed a commit that referenced this pull request May 7, 2026
# [3.46.0](v3.45.1...v3.46.0) (2026-05-07)

### Bug Fixes

* **questionnaire:** add additionalProperties false for OpenAI strict mode ([#2792](#2792)) ([ea226b0](ea226b0))

### Features

* allow adding custom requirements to existing frameworks ([6b96503](6b96503))
* **frameworks:** add framework updates banner to overview page ([#2790](#2790)) ([47bd6d8](47bd6d8))
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.46.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants