openai / openai/codex

Native Windows VS Code terminal loses inline TUI scrollback because FullScreen strategy is not selected

Open
#42,020 0 comments 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.151.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.6-terra

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

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

VS Code 1.104.3 integrated terminal, Windows PowerShell 5.1.19041.6456, native Windows (not WSL), no terminal multiplexer

Codex doctor report
{
  "schemaVersion": 1,
  "generatedAt": "1788252485s since unix epoch",
  "overallStatus": "warning",
  "codexVersion": "0.151.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "C:\\Users\\vds\\.codex\\app-server-control\\app-server-control.sock",
        "daemon state dir": "C:\\Users\\vds\\.codex\\app-server-daemon",
        "mode": "ephemeral",
        "pid file": "C:\\Users\\vds\\.codex\\app-server-daemon\\app-server.pid (missing)",
        "settings": "C:\\Users\\vds\\.codex\\app-server-daemon\\settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "C:\\Users\\vds\\.codex\\app-server-daemon\\app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "C:\\Users\\vds\\.codex\\auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "C:\\Users\\vds\\.codex",
        "config.toml": "C:\\Users\\vds\\.codex\\config.toml",     
        "config.toml parse": "ok",
        "cwd": "C:\\Users\\vds\\Work\\Rabota\\DocAI",
        "enabled feature flags": "<redacted>",
        "feature flag overrides": "memories=true",
        "feature flags enabled": "48",
        "log dir": "C:\\Users\\vds\\.codex\\log",
        "mcp servers": "3",
        "model": "gpt-5.6-terra",
        "model provider": "openai",
        "sqlite home": "C:\\Users\\vds\\.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "desktop.app.version": {
      "id": "desktop.app.version",
      "category": "desktop",
      "status": "ok",
      "summary": "the desktop application is installed",
      "details": {
        "log directory": "$HOME\\AppData\\Local\\Codex/Logs",     
        "running": "true",
        "version": "26.825.6671.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "desktop.app_server.handshake": {
      "id": "desktop.app_server.handshake",
      "category": "desktop",
      "status": "ok",
      "summary": "the desktop app-server initialized successfully",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "desktop.security.enforcement": {
      "id": "desktop.security.enforcement",
      "category": "desktop",
      "status": "ok",
      "summary": "no locally visible recent Codex security enforcement was found",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.43.0.windows.1",
      "details": {
        "PATH git #1": "C:\\Program Files\\Git\\cmd\\git.exe",    
        "PATH git entries": "1",
        "git build options": "git version 2.43.0.windows.1; cpu: x86_64; built from commit: 4b968f3ea3b32a7bc50846bab49f3f381841d297; sizeof-long: 4; sizeof-size_t: 8; shell-path: /bin/sh; feature: 
fsmonitor--daemon",
        "git exec path": "C:/Program Files/Git/mingw64/libexec/git-core",
        "git version": "git version 2.43.0.windows.1",
        "repo detected": "false",
        "selected git": "C:\\Program Files\\Git\\cmd\\git.exe"    
      },
      "remediation": null,
      "durationMs": 49
    },
    "git.worktree.dev_drive": {
      "id": "git.worktree.dev_drive",
      "category": "git",
      "status": "ok",
      "summary": "no Git worktree is active",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "C:\\Users\\vds\\AppData\\Roaming\\npm\\codex",
        "PATH codex #2": "C:\\Users\\vds\\AppData\\Roaming\\npm\\codex.cmd",
        "PATH codex entries": "2",
        "current executable": "C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin\\codex.exe",
        "install context": "npm (package C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc, bin C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin, resources C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-resources, path C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-path)", 
        "managed by bun": "false",
        "managed by npm": "true",
        "managed by pnpm": "false",
        "managed package root": "C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex",
        "npm update target": "C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex"
      },
      "remediation": null,
      "durationMs": 369
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",       
      "details": {
        "configured servers": "3",
        "disabled servers": "1",
        "stdio servers": "3"
      },
      "remediation": null,
      "durationMs": 12
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",    
      "details": {
        "managed proxy": "not configured",
        "proxy env vars": "none",
        "respect system proxy": "disabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT inference URL": "https://chatgpt.com/backend-api/<redacted> reachable (HTTP 405)",
        "desktop assets CDN": "https://persistent.oaistatic.com/codex-app-prod/<redacted> reachable (HTTP 200)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 1093
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",       
      "details": {
        "DNS": "2 IPv4, 2 IPv6, first IPv4",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",   
        "handshake result": "HTTP 101 Switching Protocols",       
        "model provider": "openai",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 2292
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running npm on windows-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin\\codex.exe",
        "install method": "npm (package C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc, bin C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin, resources C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-resources, path C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-path)",  
        "platform": "windows-x86_64",
        "version": "0.151.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (bundled)",
      "details": {
        "search command": "C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-path\\rg.exe",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "none",
        "denied-read restrictions": "false",
        "execve wrapper helper": "none",
        "filesystem sandbox": "restricted",
        "network sandbox": "restricted",
        "sandbox backend": "elevated",
        "sandbox provisioning": "complete"
      },
      "remediation": null,
      "durationMs": 1
    },
    "security.endpoint": {
      "id": "security.endpoint",
      "category": "security",
      "status": "ok",
      "summary": "no supported endpoint protection detected",     
      "details": {
        "endpoint products": "none detected"
      },
      "remediation": null,
      "durationMs": 8
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",     
      "details": {
        "CODEX_HOME": "C:\\Users\\vds\\.codex (dir)",
        "active rollout files": "171 files, 699491425 total bytes, 4090593 average bytes",
        "archived rollout files": "14 files, 33149358 total bytes, 2367811 average bytes",
        "goals DB": "C:\\Users\\vds\\.codex\\goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "C:\\Users\\vds\\.codex\\logs_2.sqlite (file)", 
        "log DB integrity": "ok",
        "log dir": "C:\\Users\\vds\\.codex\\log (missing)",       
        "memories DB": "C:\\Users\\vds\\.codex\\memories_1.sqlite 
(file)",
        "memories DB integrity": "ok",
        "queue DB": "C:\\Users\\vds\\.codex\\queue_1.sqlite (file)",
        "queue DB integrity": "ok",
        "sqlite home": "C:\\Users\\vds\\.codex (dir)",
        "state DB": "C:\\Users\\vds\\.codex\\state_5.sqlite (file)",
        "state DB integrity": "ok",
        "thread history DB": "C:\\Users\\vds\\.codex\\thread_history_1.sqlite (file)",
        "thread history DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 2435
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "warning",
      "summary": "rollout files and state DB thread inventory differ",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "171",
        "rollout DB active rows": "167",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "14",
        "rollout DB archived rows": "14",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread id sample": [        
          "01a0338c-df56-7e71-bb37-9daedbd323a6",
          "01a034bb-6e47-72b1-a21d-9ba78eaedd1b",
          "01a05a3c-99aa-7c12-8c37-39afe2526205"
        ],
        "rollout DB duplicate rollout thread ids": "3",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "4",
        "rollout DB missing active sample": [
          "C:\\Users\\vds\\.codex\\sessions\\2026\\09\\01\\rollout-2026-09-01T02-51-56-01a05a3c-99aa-7c12-8c37-39afe2526205.jsonl", 
          "C:\\Users\\vds\\.codex\\sessions\\2026\\08\\24\\rollout-2026-08-24T14-34-25-01a0338c-df56-7e71-bb37-9daedbd323a6.jsonl", 
          "C:\\Users\\vds\\.codex\\sessions\\2026\\08\\24\\rollout-2026-08-24T15-00-48-01a0338c-df56-7e71-bb37-9daedbd323a6_01a033a5-0651-72f1-9df7-f28bbd561106.jsonl",
          "C:\\Users\\vds\\.codex\\sessions\\2026\\08\\24\\rollout-2026-08-24T20-04-53-01a034bb-6e47-72b1-a21d-9ba78eaedd1b.jsonl"  
        ],
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "openai=181",
        "rollout DB rows": "181",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "vscode=68, subagent:thread_spawn=57, subagent:other=49, cli=7",
        "rollout DB stale rows": "0"
      },
      "issues": [
        {
          "severity": "warning",
          "cause": "rollout files are missing from the state DB", 
          "measured": "4 active, 0 archived",
          "expected": "every rollout file has a matching threads row",
          "remedy": null,
          "fields": []
        },
        {
          "severity": "warning",
          "cause": "duplicate thread inventory entries found",    
          "measured": "3 duplicate rollout thread ids, 0 duplicate DB paths",
          "expected": "one rollout path and thread id per thread",          "remedy": "Attach the doctor report to a bug report so support can inspect samples.",
          "fields": []
        }
      ],
      "remediation": null,
      "durationMs": 294
    },
    "system.disk": {
      "id": "system.disk",
      "category": "disk",
      "status": "ok",
      "summary": "sufficient free disk space (19.9 GiB)",
      "details": {
        "CODEX_HOME available": "19.9 GiB",
        "failure threshold": "1.0 GiB",
        "warning threshold": "5.0 GiB",
        "worktree available": "19.9 GiB"
      },
      "remediation": null,
      "durationMs": 0
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language ru-RU",
      "details": {
        "EDITOR": "not set",
        "LANG": "en_US.UTF-8",
        "VISUAL": "not set",
        "os": "Windows 10.0.19045 (Windows 10 Pro) [64-bit]",     
        "os language": "ru-RU",
        "os type": "Windows",
        "os version": "10.0.19045"
      },
      "remediation": null,
      "durationMs": 1
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "warning",
      "summary": "width 66 cols - output may wrap (recommended >=80)",
      "details": {
        "COLORTERM": "truecolor",
        "TERM_PROGRAM": "vscode",
        "VSCODE_INJECTION": "present",
        "color output": "enabled",
        "console input code page": "1251",
        "console output code page": "1251",
        "effective locale": "en_US.UTF-8",
        "stderr console mode": "0x00000007 (VT processing: true)",        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout console mode": "0x00000007 (VT processing: true)",        "stdout is terminal": "true",
        "terminal": "VS Code",
        "terminal size": "66x41",
        "terminal version": "1.104.3"
      },
      "issues": [
        {
          "severity": "warning",
          "cause": "width 66 cols - output may wrap (recommended >=80)",
          "measured": "66 x 41",
          "expected": ">= 80 columns",
          "remedy": "resize the window to at least 80 columns",   
          "fields": [
            "terminal size"
          ]
        }
      ],
      "remediation": null,
      "durationMs": 0
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title default",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "project config",        
        "terminal title project value": "DocAI",
        "terminal title source": "default"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",    
      "details": {
        "cached latest version": "0.152.0",
        "check for update on startup": "true",
        "desktop application": "OpenAI.Codex",
        "desktop latest build": "26.831.1138.0",
        "desktop update status": "available",
        "dismissed version": "0.152.0",
        "last checked at": "2026-09-01T07:51:50.751065900Z",      
        "latest version": "0.152.0",
        "latest version status": "newer version is available",    
        "npm update target": "C:\\Users\\vds\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex",
        "update action": "npm install -g @openai/codex",
        "version cache": "C:\\Users\\vds\\.codex\\version.json"   
      },
      "remediation": null,
      "durationMs": 1561
    }
  }
}
What issue are you seeing?

When Codex runs in inline mode in the native Windows VS Code integrated terminal, printing new output or repainting the TUI removes older rows from the terminal scrollback.

The problem occurs with --no-alt-screen enabled. Increasing the VS Code scrollback limit and disabling terminal GPU acceleration do not resolve it.

When Codex prints another part of a response or otherwise redraws the inline viewport, previously visible output disappears. Resizing the terminal may temporarily make some rows visible again, but they disappear after the next TUI update.

The conversation is not lost, Codex retains the session state. The failure is in the terminal rendering and scrollback behavior.

I reproduced the issue using the official npm build of Codex CLI 0.151.0 in the native Windows VS Code integrated terminal. I then built the same official rust-v0.151.0 source tag with a minimal terminal-strategy change, and the problem stopped occurring.

What steps can reproduce the bug?
  1. Open the VS Code integrated terminal on native Windows using PowerShell. Do not use WSL, tmux, zellij, or another terminal multiplexer.

  2. Start Codex in inline mode:

    codex --no-alt-screen
    
    
  3. Ask Codex for a response long enough to occupy more than one terminal
    viewport.

  4. Wait for Codex to print additional output or perform another TUI repaint.

  5. Scroll upward in the VS Code terminal.

  6. Observe that older response rows have disappeared from terminal scrollback. Resizing the terminal may temporarily restore the display, but another TUI update causes the rows to disappear again.

The issue also persists with:

{
  "terminal.integrated.gpuAcceleration": "off",
  "terminal.integrated.scrollback": 10000
}

And using --no-alt-screen does not prevent the scrollback loss.

What is the expected behavior?

When Codex runs with --no-alt-screen, completed response rows should be moved into the VS Code terminal's native scrollback and remain available after later TUI updates.

Printing new output, updating the composer, or growing the inline viewport should not remove previously rendered rows from terminal scrollback.
The behavior should match the existing FullScreen scrollback strategy used forWindows Terminal.

Additional information

Root Cause

The FullScreen scrollback strategy introduced by #39619 avoids partial DEC scroll regions that can cause terminal rows to be discarded.

However, ScrollbackStrategy::detect() currently enables that strategy only for Windows Terminal or when WT_SESSION is present:

} else if terminal.name == TerminalName::WindowsTerminal
    || std::env::var_os("WT_SESSION").is_some()
{
    Self::FullScreen
}

The native Windows VS Code integrated terminal is detected as TerminalName::VsCode and does not normally set WT_SESSION. It therefore continues to use ScrollbackStrategy::Standard, including the partial scroll-region path.

Tested fix

The following change fixes the issue locally:

diff --git a/codex-rs/tui/src/tui/scrollback.rs b/codex-rs/tui/src/tui/scrollback.rs
@@
         if terminal.is_zellij() {
             Self::Zellij
         } else if terminal.name == TerminalName::WindowsTerminal
+            || (cfg!(windows) && terminal.name == TerminalName::VsCode)
             || std::env::var_os("WT_SESSION").is_some()
         {
             Self::FullScreen

I built Codex from the official rust-v0.151.0 tag with this change. The resulting release binary preserves scrollback correctly in the native Windows VS Code integrated terminal.

I also added this regression test:

#[cfg(windows)]
#[test]
fn vscode_on_windows_uses_full_screen_scrollback() {
    let terminal = TerminalInfo {
        name: TerminalName::VsCode,
        term_program: Some("vscode".to_string()),
        version: None,
        term: None,
        multiplexer: None,
    };

    assert_eq!(
        ScrollbackStrategy::detect(&terminal),
        ScrollbackStrategy::FullScreen
    );
}

Test result:

cargo test -p codex-tui vscode_on_windows_uses_full_screen_scrollback --lib

1 passed

The release build also completed successfully:

cargo build --release -p codex-cli --bin codex

0 errors

Newer release verification

I did not install Codex 0.152.0, but I checked the source code from the official rust-v0.152.0 tag. Its ScrollbackStrategy::detect() implementation still does not include TerminalName::VsCode.
I also checked the current main branch after the 0.152.0 release, and the detection logic is still unchanged.
Related reports and changes

  • #39619 — Preserve inline TUI scrollback in Windows Terminal
  • #36474 — Windows Terminal inline scrollback loss
  • #11164 — Related VS Code terminal output corruption
    The attached doctor report was generated after installing the locally rebuilt 0.151.0 binary. The original reproduction was performed with the official npm 0.151.0 binary.

I have a tested patch ready and would be happy to submit a PR if the maintainers would like me to.

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 by locating the terminal FullScreen strategy selection and reproduce the report in a native Windows VS Code integrated terminal using PowerShell. Compare the behavior with the expected FullScreen path; done means inline TUI scrollback remains available after the terminal interaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.