Skip to content

[Bug]: Scheduled fresh Codex sessions accumulate MCP processes #41032

Closed

Description

@Yclpaiva

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Configure a lightweight local stdio MCP server for Codex.
  2. Bind an interval task to one T3 Code conversation. Select Fresh session, set the interval to two minutes, and use a simple prompt such as "Reply with OK."
  3. Let a few rounds complete. Compare the native thread/start and thread/unsubscribe requests in the server trace and count the MCP processes under the shared Codex app-server.

Expected behavior

Each completed round should retain its own idle cleanup even if the next round opens a new native Codex thread in the same T3 conversation.

Actual behavior

On my Mac, the scheduled task recorded 352 runs and there were 352 new native Codex sessions for that workflow. macOS's historical process sample recorded 2,414 processes in T3 Code's process group, out of 2,919 sampled. T3 and Chrome began failing to create subprocesses with EAGAIN (error 35), and SSH authentication succeeded while session creation failed.

The cleanup record in holdThreadLoaded is keyed by the T3 conversation ID. All the rounds reuse that ID and use the same app-server. Each fresh native thread replaces the previous cleanup record and cancels its pending idle timer. The older native thread stays subscribed. I found the same bookkeeping in the installed nightly, a newer nightly and the current main branch. Installed nightly · Main at 3806763

Impact

Major degradation or frequent failure

Version or commit

T3 Code 0.1.11-nightly.20261117.4838

Environment

macOS 26.4 on Apple Silicon. Codex CLI/app-server 0.169.0.

Logs or stack traces

The retained server trace shows 21 thread/start requests and 22 idle cleanup schedules, with zero thread/unsubscribe or thread/archive requests in that window.

In an isolated test with the same Codex binary and a stub MCP server, opening three threads left three MCP processes alive. Unsubscribing the previous native thread before starting the next kept the count at one. This tests the provider's cleanup independently of the scheduled task.

Related reports cover idle conversation cleanup and Codex-native subagent cleanup. This case replaces successive native threads within a single scheduled T3 conversation. #16917 · #21354

Workaround

Pausing the task stopped new rounds. Rebooting cleared the accumulated processes. SSH sessions worked again, and Chrome loaded a local test page in a temporary profile.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions