Skip to content

fix: accept complete fenced JSON from assistant providers - #22

Merged
PureSaber merged 1 commit into
masterfrom
codex/structured-json-output
Oct 13, 2026
Merged

PureSaber merged 1 commit into
masterfrom
codex/structured-json-output

Conversation

@PureSaber

Copy link
Copy Markdown
Owner

Workbench and Notebook assistants rejected otherwise valid model answers wrapped in a single Markdown JSON fence. Both entry points now share a bounded parser that accepts a complete JSON object or one whole JSON/unlabeled fence, then applies the existing answer, citation, quote, and cell-source hash checks.

Requests explicitly use Chat Completions response_format: json_object. Compatible providers may only prompt for this format, so client validation remains mandatory. Prose around a result, multiple fences/objects, malformed JSON, non-object content, and oversized raw responses remain failures. The 60KB/120KB limits, zero automatic retries, redacted CLI errors, and review-only Notebook behavior are preserved. No dependency declarations or lock pins change.

Validation:

  • Reproduced the original failure in both entry points before the fix: 6 targeted failures, including the actual locked SDK with a local mock transport.
  • 182 tests pass; total coverage 85.54% (required 80%); standard artifact branches 14/14 (required 90%); Ruff and pip check pass.
  • Actual public CLI subprocesses against a synthetic local HTTP provider pass four cases: Workbench and Notebook complete fenced results accepted; surrounding prose rejected without output, response disclosure, or a second request.
  • Provider tests inspect the real locked ChatOpenAI/OpenAI request for JSON mode and preserve the explicit model, timeout, temperature, and zero retries. These automated checks do not call a real model or establish model quality.

@PureSaber
PureSaber merged commit 1967912 into master Oct 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant