js_repl: remove codex.state helper references (#12275)

## Summary

This PR removes `codex.state` from the `js_repl` helper surface and
removes all corresponding documentation/instruction references.

## Motivation

Top-level bindings in `js_repl` now persist across cells, so the extra
`codex.state` helper is redundant and adds unnecessary API/docs surface.

## Changes

- Removed the long-lived `state` object from the Node kernel helper
wiring.
- Stopped exposing `codex.state` (and `context.state`) during `js_repl`
execution.
- Updated user-facing `js_repl` docs to remove `codex.state`.
- Updated generated instruction text and related test expectations to
list only:
  - `codex.tmpDir`
  - `codex.tool(name, args?)`


#### [git stack](https://github.com/magus/git-stack-cli)
-  `1` https://github.com/openai/codex/pull/12300
- 👉 `2` https://github.com/openai/codex/pull/12275
-  `3` https://github.com/openai/codex/pull/12205
-  `4` https://github.com/openai/codex/pull/12185
-  `5` https://github.com/openai/codex/pull/10673
This commit is contained in:
Curtis 'Fjord' Hawthorne
2026-02-20 11:20:45 -08:00
committed by GitHub
parent 28c0089060
commit 097620218d
3 changed files with 7 additions and 10 deletions

View File

@@ -115,9 +115,6 @@ function isDeniedBuiltin(specifier) {
const pendingTool = new Map();
let toolCounter = 0;
const tmpDir = process.env.CODEX_JS_TMP_DIR || process.cwd();
// Explicit long-lived mutable store exposed as `codex.state`. This is useful
// when callers want shared state without relying on lexical binding carry-over.
const state = {};
const nodeModuleDirEnv = process.env.CODEX_JS_REPL_NODE_MODULE_DIRS ?? "";
const moduleSearchBases = (() => {
const bases = [];
@@ -470,8 +467,7 @@ async function handleExec(message) {
const { source, nextBindings } = await buildModuleSource(code);
let output = "";
context.state = state;
context.codex = { state, tmpDir, tool };
context.codex = { tmpDir, tool };
context.tmpDir = tmpDir;
await withCapturedConsole(context, async (logs) => {