Skip to content

fix(grammar): preserve JSON escapes in schema literals - #2443

Open
remote-controlled-man wants to merge 1 commit into
abetlen:mainfrom
remote-controlled-man:codex/prflow-190bb7150d3d
Open

remote-controlled-man wants to merge 1 commit into
abetlen:mainfrom
remote-controlled-man:codex/prflow-190bb7150d3d

Conversation

@remote-controlled-man

Copy link
Copy Markdown
Contributor

JSON Schema string literals are JSON-encoded before being embedded in GBNF. The GBNF literal formatter does not escape backslashes, so JSON escapes are interpreted by the grammar instead of being emitted. A newline constant generates a raw newline inside a quoted JSON string; a path such as C:\temp\file is silently changed to control characters.

Escape backslashes alongside quotes and line breaks in the shared literal formatter. This covers const values, enum values and object property names. Add real-model generation regressions that parse the output and compare its value, including normal text controls.

Validation on macOS arm64, Python 3.12.14, using the existing native build and stories15M CPU inference:

  • Original converter loaded from main at 77fbb5d: 12 failures and 6 passing controls.
  • Fixed converter: all 27 new cases pass.
  • Full make test: 53 passed, including all 27 new cases and the existing real-model tests.
  • Full make lint: Ruff check and formatting checks pass (29 files).

Prepared with AI assistance.

Copilot AI balanced review requested due to automatic review settings November 23, 2026 14:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
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.

2 participants