Skip to content

Add js_repl host helpers and exec end events#10672

Merged
fjord-oai merged 1 commit intomainfrom
fjord/js_repl_seq---4hn_dcnepr036e
Feb 12, 2026
Merged

Add js_repl host helpers and exec end events#10672
fjord-oai merged 1 commit intomainfrom
fjord/js_repl_seq---4hn_dcnepr036e

Conversation

@fjord-oai
Copy link
Contributor

@fjord-oai fjord-oai commented Feb 4, 2026

Summary

This PR adds host-integrated helper APIs for js_repl and updates model guidance so the agent can use them reliably.

What’s included

  • Add codex.tool(name, args?) in the JS kernel so js_repl can call normal Codex tools.
  • Keep persistent JS state and scratch-path helpers available:
    • codex.state
    • codex.tmpDir
  • Wire js_repl tool calls through the standard tool router path.
  • Add/align js_repl execution completion/end event behavior with existing tool logging patterns.
  • Update dynamic prompt injection (project_doc) to document:
    • how to call codex.tool(...)
    • raw output behavior
    • image flow via view_image (codex.tmpDir + codex.tool("view_image", ...))
    • stdio safety guidance (console.log / codex.tool, avoid direct process.std*)

Why

  • Standardize JS-side tool usage on codex.tool(...)
  • Make js_repl behavior more consistent with existing tool execution and event/logging patterns.
  • Give the model enough runtime guidance to use js_repl safely and effectively.

Testing

  • Added/updated unit and runtime tests for:
    • codex.tool calls from js_repl (including shell/MCP paths)
    • image handoff flow via view_image
    • prompt-injection text for js_repl guidance
    • execution/end event behavior and related regression coverage

git stack

@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_dbch6anby6 to main February 4, 2026 20:15
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from 8bb2e54 to 67d6633 Compare February 4, 2026 20:15
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 4, 2026 20:15
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_dbch6anby6 to main February 4, 2026 21:13
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from 67d6633 to 8dd500e Compare February 4, 2026 21:13
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 4, 2026 21:13
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_dbch6anby6 to main February 4, 2026 22:15
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from 8dd500e to 676bc7d Compare February 4, 2026 22:15
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 4, 2026 22:15
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_dbch6anby6 to main February 4, 2026 22:39
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from 676bc7d to c4f3cd8 Compare February 4, 2026 22:39
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 4, 2026 22:39
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_dbch6anby6 to main February 5, 2026 03:16
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from c4f3cd8 to 333601f Compare February 5, 2026 03:16
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 5, 2026 03:16
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_dbch6anby6 to main February 5, 2026 04:54
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from 333601f to ff24d97 Compare February 5, 2026 04:54
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 5, 2026 04:54
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_dbch6anby6 to main February 5, 2026 05:29
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from ff24d97 to 608b2c1 Compare February 5, 2026 05:29
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 5, 2026 05:29
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_dbch6anby6 to main February 5, 2026 16:31
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from 608b2c1 to 0b33c6c Compare February 5, 2026 16:32
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 5, 2026 16:32
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_dbch6anby6 to main February 5, 2026 17:27
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 5, 2026 17:27
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 11, 2026 17:39
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_dbch6anby6 to main February 11, 2026 19:22
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from 25fa388 to abf0581 Compare February 11, 2026 19:22
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 11, 2026 19:22
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_dbch6anby6 to main February 11, 2026 19:47
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from abf0581 to 88dc0cd Compare February 11, 2026 19:47
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_dbch6anby6 February 11, 2026 19:47
fjord-oai added a commit that referenced this pull request Feb 11, 2026
## Summary

This PR adds an **experimental, feature-gated `js_repl` core runtime**
so models can execute JavaScript in a persistent REPL context across
tool calls.

The implementation integrates with existing feature gating, tool
registration, prompt composition, config/schema docs, and tests.

## What changed

- Added new experimental feature flag: `features.js_repl`.
- Added freeform `js_repl` tool and companion `js_repl_reset` tool.
- Gated tool availability behind `Feature::JsRepl`.
- Added conditional prompt-section injection for JS REPL instructions
via marker-based prompt processing.
- Implemented JS REPL handlers, including freeform parsing and pragma
support (timeout/reset controls).
- Added runtime resolution order for Node:
  1. `CODEX_JS_REPL_NODE_PATH`
  2. `js_repl_node_path` in config
  3. `PATH`
- Added JS runtime assets/version files and updated docs/schema.

## Why

This enables richer agent workflows that require incremental JavaScript
execution with preserved state, while keeping rollout safe behind an
explicit feature flag.

## Testing

Coverage includes:

- Feature-flag gating behavior for tool exposure.
- Freeform parser/pragma handling edge cases.
- Runtime behavior (state persistence across calls and top-level `await`
support).

## Usage

```toml
[features]
js_repl = true
```

Optional runtime override:

- `CODEX_JS_REPL_NODE_PATH`, or
- `js_repl_node_path` in config.

#### [git stack](https://github.com/magus/git-stack-cli)
- 👉 `1` #10674
- ⏳ `2` #10672
- ⏳ `3` #10671
- ⏳ `4` #10673
- ⏳ `5` #10670
Base automatically changed from fjord/js_repl_seq---4hn_dbch6anby6 to main February 11, 2026 20:05
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch 8 times, most recently from bdf7103 to 6c052c3 Compare February 12, 2026 05:13
@fjord-oai fjord-oai marked this pull request as ready for review February 12, 2026 05:21
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from 6c052c3 to 99351f8 Compare February 12, 2026 17:02
@fjord-oai fjord-oai requested a review from owenlin0 February 12, 2026 17:03
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch 2 times, most recently from f2798d4 to 0ca07e6 Compare February 12, 2026 19:09
git-stack-id: fjord/js_repl_seq---4hn_dcnepr036e
git-stack-title: Add js_repl host helpers and exec end events
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_dcnepr036e branch from 0ca07e6 to 3aa7980 Compare February 12, 2026 19:24
@fjord-oai fjord-oai merged commit 466be55 into main Feb 12, 2026
91 of 94 checks passed
@fjord-oai fjord-oai deleted the fjord/js_repl_seq---4hn_dcnepr036e branch February 12, 2026 20:10
@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments