js_repl: block wrapped payload prefixes in grammar#12300
Merged
Conversation
60a4c20 to
1a3e393
Compare
This was referenced Feb 20, 2026
1a3e393 to
4de6129
Compare
git-stack-id: fjord/js_repl_seq---4ht_g82psfv2f9 git-stack-title: js_repl: block wrapped payload prefixes in grammar
4de6129 to
121f96e
Compare
hanson-openai
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tighten the
js_replfreeform Lark grammar to block the most common malformed payload wrappers before they reach runtime validation.What Changed
js_replfreeform grammar (start: /[\s\S]*/) with a structured grammar that still supports:// codex-js-repl:pragma followed by JS source{(JSON object wrapper like{"code":"..."})"(quoted code string)```(markdown code fences)Why
js_replis a freeform tool, but the model sometimes emits wrapped payloads (JSON, quoted strings, markdown fences) instead of raw JavaScript. We already reject those at runtime, but this change moves the constraint into the tool grammar so the model is less likely to generate invalid tool-call payloads in the first place.Testing
cargo test -p codex-core js_repl_freeform_grammar_blocks_common_non_js_prefixescargo test -p codex-core parse_freeform_args_rejects_Notes
{ ... }blocks or top-level quoted directives like"use strict";) in exchange for preventing the common wrapped-payload mistakes.git stack
1js_repl: block wrapped payload prefixes in grammar #123002js_repl: remove codex.state helper references #122753ci(bazel): install Node from node-version.txt in remote image #122054tests(js_repl): remove node-related skip paths from js_repl tests #121855Add feature-gated js_repl polling flow #10673