Skip to content

Code Mode dispatch worker stops at sampling end while yielded cells still need subsequent tools #45945

Open

Description

@mkXultra

What version of Codex CLI is running?

Installed upstream CLI: 0.154.0. Source inspection below is pinned to upstream main 4701aa4. The end-to-end fix validation was on a local fork; this is not a claim of a fresh stock-0.154.0 runtime reproduction.

What subscription do you have?

ChatGPT Pro

Which model were you using?

The proposed failure mechanism is in the tool dispatch lifecycle, rather than a specific model's output. Model for a fresh upstream reproduction: not yet recorded.

What platform is your computer?

Linux 7.0.0-31-generic x86_64 unknown

What terminal emulator and version are you using (if applicable)?

Not recorded.

Codex doctor report

Not collected for this source-level report.

What issue are you seeing?

A yielded Code Mode cell may remain alive after the assistant ends its turn, but subsequent nested tool calls cannot be dispatched while the thread is idle. The first already-dispatched tool can finish; the next awaited tool then waits for a receive worker from a later sampling request.

This is separate from automatically waking the model: even without any completion wake, the Cell's JavaScript should be able to finish sequential non-interactive tools while idle.

What steps can reproduce the bug?

Suggested minimal reproduction (stock-current-version runtime confirmation still pending):

  1. In interactive CLI with Code Mode available, ask for one Cell containing the following JavaScript.
  2. Have the assistant finish its turn after the Cell yields. Do not call wait or send another user message during the sleeps. Ensure each command is permitted without additional approval.
  3. Observe whether the second command starts after the first returns, without another sampling request.
// @exec: {"yield_time_ms": 1000, "max_output_tokens": 1000}
const first = await tools.exec_command({
  cmd: "sleep 8", yield_time_ms: 10000, max_output_tokens: 100
});
text({step: 1, result: first});
const second = await tools.exec_command({
  cmd: "sleep 8", yield_time_ms: 10000, max_output_tokens: 100
});
text({step: 2, result: second});

The outer Cell yields after one second, but each inner tool has time to finish before its own yield. A deterministic regression should gate the first tool result until after the parent reaches idle, then assert that the second tool dispatches before any further model request. Our local fork has such an HTTP MCP regression, in addition to a manual two-sleep success test on the patched binary.

What is the expected behavior?

Ordinary nested tools requiring no new approval should continue until the live Cell completes, without keeping the model busy. This does not ask for idle approval UI, unlimited tool timeouts, or an automatic model continuation.

Additional information

Source inspection at the pinned upstream commit:

These lifetimes explain the observed boundary in our investigation; the suggested stock repro above has not yet been rerun in this reporting session.

A possible approach is to retain the existing dispatch worker while unfinished Cells exist, releasing it on completion/teardown and respecting existing sampling-boundary replacement. Approval provenance and cancellation need explicit handling; retaining the worker alone exposes previously unreachable idle prompt paths.

Reference experiment: fork commit af1f26f725. This sits on top of separate completion-wake changes and is not an independent upstream-ready patch or a PR request.

Related, but distinct:

Activity

  1. added
    bugSomething isn't working
    CLIIssues related to the Codex CLI
    tool-callsIssues related to tool calling
    on Sep 16, 2026
  2. noises1990 commented on Sep 16, 2026

    @noises1990

    Btw this is really blocking. I literally cannot use codex at all on the Windows machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingtool-callsIssues related to tool calling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions