openai / openai/codex

Windows: /ps retains two completed background terminals as running in 0.153.2

Open
#42,810 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI TUI windows-os
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

codex-cli 0.153.2 (installed via npm)

What subscription do you have?

API key authentication (the issue is not model- or authentication-specific)

Which model were you using?

gpt-5.6-luna; the issue appears model-independent

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64 (Windows 11 Enterprise)

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

PowerShell 7.6.5 in Windows Terminal

Codex doctor report

Redacted relevant output from codex doctor --json:

overallStatus=warning; codexVersion=0.153.2; auth=api_key configured; installation=npm on windows-x86_64; desktop=not running; app_server=ephemeral mode; terminal=Windows Terminal; state databases=integrity ok; rollout_db_parity=ok, stale rows 0; security warning=Microsoft Defender exclusions unverified.

User paths, endpoint addresses, and all credential-related values have been redacted.

What issue are you seeing?

After upgrading to Codex CLI 0.153.x (currently 0.153.2), the TUI's Background terminals view /ps can retain exactly two entries as running indefinitely.

The distinctive behavior is:

  • The same two entries remain listed as running.
  • Starting one new background terminal changes the count from 2 to 3.
  • When the new terminal completes, its entry disappears and the count returns to 2.
  • The original two entries remain even though their commands have completed.
  • In the observed case, the two retained entries were ordinary PowerShell diagnostics, including reading a local models.json file and inspecting environment-variable names. The corresponding PowerShell/CMD processes were no longer present in the OS process list.
  • This looks like stale TUI state or a missed/mismatched completion event, although an actual process leak cannot be ruled out in every case.
What steps can reproduce the bug?

This is reliably observable after the stale state appears, although I do not yet have a deterministic clean-start trigger:

  1. Start Codex CLI 0.153.2 on Windows PowerShell.
  2. Use Codex to run background terminal commands normally.
  3. Open /ps and observe two old entries shown under Background terminals as running.
  4. Start another background terminal command.
  5. Observe that the count becomes 3 while the new command is running.
  6. Wait for the new command to finish.
  7. Run /ps again. The new entry is gone, but the same two old entries remain.
  8. Verify in Task Manager or PowerShell that no corresponding shell processes are still running.
What is the expected behavior?

A completed background terminal should be removed from the live Background terminals list after its completion event is processed. The list should not retain completed entries indefinitely.

Additional information

Related reports include #41841, #17911, and #17311, but this report highlights a version-specific UI/state pattern: two fixed stale entries remain while newly started entries are added and removed normally.

The issue is still present in 0.153.2. It appears related to background-terminal lifecycle reconciliation in the TUI, possibly around completion events, process-id/call-id matching, or app-server reconnect/replay handling.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the TUI /ps background-terminal lifecycle and inspect completion-event handling, process-id/call-id matching, and app-server reconnect or replay behavior on Windows. Reproduce the stale two-entry sequence, then verify that completed terminals are removed from the live list while newly completed entries continue to disappear normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, rust
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.