Skip to content

Add feature-gated js_repl polling flow#10673

Closed
fjord-oai wants to merge 1 commit intomainfrom
fjord/js_repl_seq---4hn_deh_pjc2v_
Closed

Add feature-gated js_repl polling flow#10673
fjord-oai wants to merge 1 commit intomainfrom
fjord/js_repl_seq---4hn_deh_pjc2v_

Conversation

@fjord-oai
Copy link
Contributor

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

Summary

Adds a feature-gated polling mode for js_repl.

With js_repl_polling enabled, js_repl can submit async JS executions and immediately return an exec_id / session_id, while js_repl_poll provides incremental logs and final results for that execution.

What Changed

Feature flag and tool exposure

  • Added js_repl_polling
  • Gated it behind js_repl
  • Added js_repl_poll to the tool spec only when polling is enabled
  • Allowed direct js_repl_poll calls in js_repl_tools_only mode when polling is enabled

Polling API

  • js_repl now accepts polling-related first-line pragma args:
    • poll=true
    • session_id=<id>
  • Added js_repl_poll
    • takes exec_id
    • optionally takes yield_time_ms
    • returns JSON with exec_id, session_id, status, logs, output, and error
  • Extended js_repl_reset
    • {"session_id":"..."} resets a single polling session
    • {} resets all js_repl kernels

Polling runtime

  • Added session-based polling support in JsReplManager
  • Enforces one active exec per polling session
  • Allows multiple polling sessions in parallel
  • Buffers incremental logs for polling and retains completed execs for replay for a bounded window
  • Emits output delta events while a polled exec is running

Semantics and robustness

  • Polling mode does not support timeout_ms; callers must use js_repl_poll.yield_time_ms
  • Omitted or short poll waits clamp to the intended idle long-poll behavior
  • Keeps poll semantics aligned with background-terminal expectations:
    • return early when logs or completion are available
    • keep polling the same exec_id until status becomes completed or error
  • Releases a polling session for reuse before async completion-event emission
  • Replaced non-polling timeout string matching with a typed local execute error
  • Removed redundant kernel-side log buffering in streaming mode and used host-side buffered logs for final poll output fallback

Parsing / guidance

  • Updated freeform js_repl parsing to support polling pragma args
  • Keeps comma-separated pragma args tolerant for compatibility, while preferring space-separated args in guidance
  • Added feature-aware error/help text so polling-specific guidance only appears when polling is enabled
  • Updated project-doc and docs/js_repl.md guidance for the polling flow

git stack

@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 4, 2026 20:15
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from 866343c to c20105a Compare February 4, 2026 20:15
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 4, 2026 20:15
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 4, 2026 21:13
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from c20105a to aa06c95 Compare February 4, 2026 21:13
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 4, 2026 21:13
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 4, 2026 22:15
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from aa06c95 to 89bfad9 Compare February 4, 2026 22:15
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 4, 2026 22:15
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 4, 2026 22:39
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from 89bfad9 to 0da0b7e Compare February 4, 2026 22:39
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 4, 2026 22:39
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 5, 2026 03:16
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from 0da0b7e to 292be86 Compare February 5, 2026 03:16
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 5, 2026 03:16
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 5, 2026 04:54
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from 292be86 to a9522de Compare February 5, 2026 04:54
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 5, 2026 04:54
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 5, 2026 05:29
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from a9522de to f4a2180 Compare February 5, 2026 05:29
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 5, 2026 05:29
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 5, 2026 16:31
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from f4a2180 to 5f3c7b9 Compare February 5, 2026 16:32
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 5, 2026 16:32
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 5, 2026 17:27
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from 5f3c7b9 to c495be5 Compare February 5, 2026 17:27
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from 8334f70 to 68c3b74 Compare February 10, 2026 17:41
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 10, 2026 17:41
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 10, 2026 18:45
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from 68c3b74 to 9282763 Compare February 10, 2026 18:45
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 10, 2026 18:45
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 11, 2026 05:50
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from 9282763 to 24b925c Compare February 11, 2026 05:50
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 11, 2026 05:50
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 11, 2026 17:21
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from 24b925c to 675dd71 Compare February 11, 2026 17:21
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 11, 2026 17:21
@fjord-oai fjord-oai changed the base branch from fjord/js_repl_seq---4hn_ddfuds7h9l to main February 11, 2026 17:39
@fjord-oai fjord-oai changed the base branch from main to fjord/js_repl_seq---4hn_ddfuds7h9l February 11, 2026 17:39
@fjord-oai fjord-oai force-pushed the fjord/js_repl_seq---4hn_deh_pjc2v_ branch from 675dd71 to 41f74d3 Compare February 11, 2026 17:39
@jif-oai
Copy link
Collaborator

jif-oai commented Feb 28, 2026

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

git-stack-id: fjord/js_repl_seq---4hn_deh_pjc2v_
git-stack-title: Add feature-gated js_repl polling flow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants