Skip to content

fix: add per-model structured output opt-out - #1424

Draft
Ingwannu wants to merge 1 commit into
devfrom
agent/fix-chat-structured-output-optout
Draft

fix: add per-model structured output opt-out#1424
Ingwannu wants to merge 1 commit into
devfrom
agent/fix-chat-structured-output-optout

Conversation

@Ingwannu

Copy link
Copy Markdown
Owner

Summary

  • Preserve response_format translation as the default for routed openai-chat models.
  • Add an explicit provider/model compatibility escape hatch, noStructuredOutputModels, so only exact listed model ids omit the field.
  • Validate, normalize, persist, and expose the setting through the management configuration surfaces.
  • Cover both Responses and Chat Completions ingress and document the compatibility boundary and decision.

Closes #1415

Verification

  • nice -n 10 taskset -c 0-1 bun test tests/openai-chat-hardening.test.ts tests/chat-completions-endpoint.test.ts tests/management-provider-validation.test.ts — 138 pass, 0 fail.
  • nice -n 10 taskset -c 0-1 bun run typecheck — passed.
  • nice -n 10 taskset -c 0-1 bun run privacy:scan — passed.
  • cd docs-site && bun install --frozen-lockfile && bun run build — passed, 221 pages built.
  • nice -n 10 taskset -c 0-1 bun run test — 10,680 pass, 10 skip, 1 unrelated baseline failure in Codex autostart shim > Unix shim exports persisted service API token before running Codex.
  • The same shim failure reproduces unchanged on exact base 9c051342d7ff7ad81b71911e359ad5935eaaf235 (34 pass, 1 fail in tests/codex-shim.test.ts); this patch does not modify that subsystem.
  • Exact tested head: 9c88233a37a99e0eb93dc1555dc2d522761f3184.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1522c672-5c7b-41fc-af55-1e895ade5071

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug Something isn't working label Aug 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@Wibias Wibias left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes based on a full review of the current head.

Merge blockers / required fixes:

  1. noStructuredOutputModels is documented and implemented as an exact per-model escape hatch, but the adapter uses modelInList(). That helper intentionally family-matches colon-tagged variants (foo also matches foo:variant). This can disable response_format for sibling/variant models that were not explicitly listed, which breaks the mixed-capability-gateway contract this PR is introducing. Use exact equality for this field (for example list.includes(parsed.modelId)) or a dedicated exact-match helper, and add a negative regression proving foo does not match foo:structured.

  2. Persisted config.json and Management API PATCH normalize this field differently. PATCH trims and deduplicates entries, but schema/config loading only verifies that entry.trim() is nonblank and preserves the original string. A manually persisted value such as " deepseek-v4-flash " is accepted but will not match the runtime model id. Normalize trim/dedupe at the config boundary so every management surface has identical semantics.

I did not find a security vulnerability in this PR, but the first issue is a direct contract violation and should be fixed before merge. After fixes, refresh onto current dev and rerun exact-head CI.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants