js_repl: remove codex.state helper references#12275
Merged
Conversation
This was referenced Feb 19, 2026
9719a16 to
f230faa
Compare
aaronl-openai
approved these changes
Feb 19, 2026
09f02d7 to
aa9752f
Compare
aa9752f to
6a126ca
Compare
6a126ca to
ce9b946
Compare
ce9b946 to
9fea5de
Compare
fjord-oai
added a commit
that referenced
this pull request
Feb 20, 2026
## Summary
Tighten the `js_repl` freeform Lark grammar to block the most common
malformed payload wrappers before they reach runtime validation.
## What Changed
- Replaced the overly permissive `js_repl` freeform grammar (`start:
/[\s\S]*/`) with a structured grammar that still supports:
- plain JS source
- optional first-line `// codex-js-repl:` pragma followed by JS source
- Added grammar-level filtering for common bad payload shapes by
rejecting inputs whose first significant token starts with:
- `{` (JSON object wrapper like `{"code":"..."}`)
- `"` (quoted code string)
- `` ``` `` (markdown code fences)
- Implemented the grammar without regex lookahead/lookbehind because the
API-side Lark regex engine does not support look-around.
- Added a unit test to validate the grammar shape and guard against
reintroducing unsupported lookaround.
## Why
`js_repl` is 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_prefixes`
- `cargo test -p codex-core parse_freeform_args_rejects_`
## Notes
- This intentionally over-blocks a few uncommon valid JS starts (for
example top-level `{ ... }` blocks or top-level quoted directives like
`"use strict";`) in exchange for preventing the common wrapped-payload
mistakes.
#### [git stack](https://github.com/magus/git-stack-cli)
- 👉 `1` #12300
- ⏳ `2` #12275
- ⏳ `3` #12205
- ⏳ `4` #12185
- ⏳ `5` #10673
git-stack-id: fjord/js_repl_seq---4ht5fx8yw23p4e git-stack-title: js_repl: remove codex.state helper references
9fea5de to
71bdc9d
Compare
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
This PR removes
codex.statefrom thejs_replhelper surface and removes all corresponding documentation/instruction references.Motivation
Top-level bindings in
js_replnow persist across cells, so the extracodex.statehelper is redundant and adds unnecessary API/docs surface.Changes
stateobject from the Node kernel helper wiring.codex.state(andcontext.state) duringjs_replexecution.js_repldocs to removecodex.state.codex.tmpDircodex.tool(name, args?)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