Windows Terminal: --no-alt-screen retains only one viewport and does not preserve scrollback
What version of Codex CLI is running?
0.146.0
What subscription do you have?
Windows Terminal: --no-alt-screen retains only one viewport and does not preserve scrollback
Which model were you using?
gpt-5.6-sol,gpt-5.6-terra
What platform is your computer?
Microsoft Windows NT 10.0.22621.0 x64
What terminal emulator and version are you using (if applicable)?
Windows Terminal, running PowerShell 7.6.3, without tmux/zellij/WSL.
Codex doctor report
{
"schemaVersion": 1,
"generatedAt": "1785588838s since unix epoch",
"overallStatus": "fail",
"codexVersion": "0.146.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\\27942\\.codex\\app-server-control\\app-server-control.sock",
"daemon state dir": "C:\\Users\\27942\\.codex\\app-server-daemon",
"mode": "ephemeral",
"pid file": "C:\\Users\\27942\\.codex\\app-server-daemon\\app-server.pid (missing)",
"settings": "C:\\Users\\27942\\.codex\\app-server-daemon\\settings.json (missing)",
"status": "not running",
"update-loop pid file": "C:\\Users\\27942\\.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\\27942\\.codex\\auth.json",
"auth storage mode": "File",
"stored API key": "true",
"stored ChatGPT tokens": "false",
"stored agent identity": "false",
"stored auth mode": "api_key"
},
"remediation": null,
"durationMs": 0
},
"config.load": {
"id": "config.load",
"category": "config",
"status": "ok",
"summary": "config loaded",
"details": {
"CODEX_HOME": "C:\\Users\\27942\\.codex",
"config.toml": "C:\\Users\\27942\\.codex\\config.toml",
"config.toml parse": "ok",
"cwd": "D:\\ywq",
"enabled feature flags": "<redacted>",
"feature flag overrides": "none",
"feature flags enabled": "38",
"log dir": "C:\\Users\\27942\\.codex\\log",
"mcp servers": "3",
"model": "gpt-5.6-sol",
"model provider": "custom",
"sqlite home": "C:\\Users\\27942\\.codex"
},
"remediation": null,
"durationMs": 0
},
"git.environment": {
"id": "git.environment",
"category": "git",
"status": "ok",
"summary": "git version 2.45.1.windows.1",
"details": {
"PATH git #1": "D:\\Git\\cmd\\git.exe",
"PATH git entries": "1",
"git build options": "git version 2.45.1.windows.1; cpu: x86_64; built from commit: 965b16798dab6962ada5b0d8cf0dca68f385c448; sizeof-long: 4; sizeof-size_t: 8; shell-path: /bin/sh; feature: fsmonitor--daemon",
"git exec path": "D:/Git/mingw64/libexec/git-core",
"git version": "git version 2.45.1.windows.1",
"repo detected": "false",
"selected git": "D:\\Git\\cmd\\git.exe"
},
"remediation": null,
"durationMs": 36
},
"installation": {
"id": "installation",
"category": "install",
"status": "fail",
"summary": "npm install -g @openai/codex would update a different install",
"details": {
"PATH codex #1": "D:\\node\\node_global\\codex",
"PATH codex #2": "D:\\node\\node_global\\codex.cmd",
"PATH codex #3": "D:\\nodejs\\codex",
"PATH codex #4": "D:\\nodejs\\codex.cmd",
"PATH codex entries": "4",
"current executable": "D:\\node\\node_global\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin\\codex.exe",
"install context": "npm (package D:\\node\\node_global\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc, bin D:\\node\\node_global\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin, resources D:\\node\\node_global\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-resources, path D:\\node\\node_global\\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": "D:\\node\\node_global\\node_modules\\@openai\\codex",
"npm package root": "D:\\nodejs\\node_modules\\@openai\\codex",
"running package root": "D:\\node\\node_global\\node_modules\\@openai\\codex"
},
"remediation": "Fix PATH or npm prefix so the running package root (D:\\node\\node_global\\node_modules\\@openai\\codex) matches the npm global package root (D:\\nodejs\\node_modules\\@openai\\codex).",
"durationMs": 195
},
"mcp.config": {
"id": "mcp.config",
"category": "mcp",
"status": "ok",
"summary": "MCP configuration is locally consistent",
"details": {
"configured servers": "3",
"disabled servers": "0",
"stdio servers": "2",
"streamable_http servers": "1"
},
"remediation": null,
"durationMs": 178
},
"network.env": {
"id": "network.env",
"category": "network",
"status": "ok",
"summary": "network-related environment looks readable",
"details": {
"proxy env vars": "none"
},
"remediation": null,
"durationMs": 0
},
"network.provider_reachability": {
"id": "network.provider_reachability",
"category": "reachability",
"status": "ok",
"summary": "active provider endpoints are reachable over HTTP",
"details": {
"custom API base URL": "https://api.datacodex.net reachable (HTTP 200)",
"custom API route probe": "https://api.datacodex.net/models route exists (HTTP 401)",
"reachability mode": "API key auth"
},
"remediation": null,
"durationMs": 1969
},
"network.websocket_reachability": {
"id": "network.websocket_reachability",
"category": "websocket",
"status": "ok",
"summary": "Responses WebSocket is not enabled for the active provider",
"details": {
"model provider": "custom",
"provider name": "custom",
"proxy env vars": "none",
"supports websockets": "false",
"wire API": "responses"
},
"remediation": null,
"durationMs": 0
},
"runtime.provenance": {
"id": "runtime.provenance",
"category": "runtime",
"status": "ok",
"summary": "running npm on windows-x86_64",
"details": {
"commit": "unknown",
"current executable": "D:\\node\\node_global\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin\\codex.exe",
"install method": "npm (package D:\\node\\node_global\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc, bin D:\\node\\node_global\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin, resources D:\\node\\node_global\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-resources, path D:\\node\\node_global\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-path)",
"platform": "windows-x86_64",
"version": "0.146.0"
},
"remediation": null,
"durationMs": 0
},
"runtime.search": {
"id": "runtime.search",
"category": "search",
"status": "ok",
"summary": "search is OK (bundled)",
"details": {
"search command": "D:\\node\\node_global\\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",
"execve wrapper helper": "none",
"filesystem sandbox": "restricted",
"network sandbox": "restricted"
},
"remediation": null,
"durationMs": 0
},
"state.paths": {
"id": "state.paths",
"category": "state",
"status": "ok",
"summary": "state paths and databases are inspectable",
"details": {
"CODEX_HOME": "C:\\Users\\27942\\.codex (dir)",
"active rollout files": "254 files, 215357266 total bytes, 847863 average bytes",
"archived rollout files": "0 files, 0 total bytes, 0 average bytes",
"goals DB": "C:\\Users\\27942\\.codex\\goals_1.sqlite (file)",
"goals DB integrity": "ok",
"log DB": "C:\\Users\\27942\\.codex\\logs_2.sqlite (file)",
"log DB integrity": "ok",
"log dir": "C:\\Users\\27942\\.codex\\log (dir)",
"memories DB": "C:\\Users\\27942\\.codex\\memories_1.sqlite (file)",
"memories DB integrity": "ok",
"sqlite home": "C:\\Users\\27942\\.codex (dir)",
"state DB": "C:\\Users\\27942\\.codex\\state_5.sqlite (file)",
"state DB integrity": "ok",
"thread history DB": "C:\\Users\\27942\\.codex\\thread_history_1.sqlite (missing)",
"thread history DB integrity": "skipped (missing)"
},
"remediation": null,
"durationMs": 20
},
"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": "custom",
"rollout DB active files": "254",
"rollout DB active rows": "250",
"rollout DB archive mismatches": "0",
"rollout DB archived files": "0",
"rollout DB archived rows": "0",
"rollout DB duplicate DB paths": "0",
"rollout DB duplicate rollout thread ids": "0",
"rollout DB malformed file names": "0",
"rollout DB missing active rows": "7",
"rollout DB missing active sample": [
"C:\\Users\\27942\\.codex\\sessions\\2026\\04\\25\\rollout-2026-04-25T17-21-50-019dc3f2-0092-79b1-ad79-38d80013a160.jsonl",
"C:\\Users\\27942\\.codex\\sessions\\2026\\04\\24\\rollout-2026-04-24T16-07-41-019dbe87-c3ee-7541-afcc-4013b07ba022.jsonl",
"C:\\Users\\27942\\.codex\\sessions\\2026\\04\\24\\rollout-2026-04-24T16-52-50-019dbeb1-19f5-76e0-ab2e-603703868e73.jsonl",
"C:\\Users\\27942\\.codex\\sessions\\2026\\04\\24\\rollout-2026-04-24T16-57-06-019dbeb5-0189-71a0-9c29-61cb2053de00.jsonl",
"C:\\Users\\27942\\.codex\\sessions\\2026\\04\\24\\rollout-2026-04-24T22-30-37-019dbfe6-5969-7672-9432-efc148c3913c.jsonl"
],
"rollout DB missing archived rows": "0",
"rollout DB model providers": "<redacted>",
"rollout DB rows": "250",
"rollout DB scan cap reached": "false",
"rollout DB scan errors": "0",
"rollout DB sources": "cli=188, subagent:other=43, subagent:review=16, exec=3",
"rollout DB stale row sample": [
"C:\\Users\\27942\\.codex\\sessions\\2026\\04\\24\\rollout-2026-04-24T15-48-13-019dbe75-f1bc-7173-bbb4-2257288baf25.jsonl",
"C:\\Users\\27942\\.codex\\sessions\\2026\\04\\24\\rollout-2026-04-24T15-54-46-019dbe7b-efcf-7b31-a996-aa4bc88413c6.jsonl",
"C:\\Users\\27942\\.codex\\sessions\\2026\\04\\24\\rollout-2026-04-24T16-01-27-019dbe82-0cf3-7fa1-8773-9ccb9541e20b.jsonl"
],
"rollout DB stale rows": "3"
},
"issues": [
{
"severity": "warning",
"cause": "rollout files are missing from the state DB",
"measured": "7 active, 0 archived",
"expected": "every rollout file has a matching threads row",
"remedy": null,
"fields": []
},
{
"severity": "warning",
"cause": "state DB rows point at missing or unusable rollout files",
"measured": "3 stale rows",
"expected": "every state DB rollout path is a file on disk",
"remedy": null,
"fields": []
}
],
"remediation": null,
"durationMs": 82
},
"system.environment": {
"id": "system.environment",
"category": "system",
"status": "ok",
"summary": "OS language zh-CN",
"details": {
"EDITOR": "set",
"VISUAL": "set",
"os": "Windows 10.0.22621 (Windows 11 Professional) [64-bit]",
"os language": "zh-CN",
"os type": "Windows",
"os version": "10.0.22621"
},
"remediation": null,
"durationMs": 0
},
"terminal.env": {
"id": "terminal.env",
"category": "terminal",
"status": "ok",
"summary": "terminal metadata was detected",
"details": {
"WT_SESSION": "present",
"color output": "disabled (stdout is not a terminal)",
"console input code page": "936",
"console output code page": "936",
"stderr console mode": "0x00000007 (VT processing: true)",
"stderr is terminal": "true",
"stdin is terminal": "true",
"stdout console mode": "unavailable",
"stdout is terminal": "false",
"terminal": "Windows Terminal",
"terminal size": "150x44"
},
"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": "cwd",
"terminal title project value": "ywq",
"terminal title source": "default"
},
"remediation": null,
"durationMs": 0
},
"updates.status": {
"id": "updates.status",
"category": "updates",
"status": "fail",
"summary": "update would target a different npm install",
"details": {
"cached latest version": "0.146.0",
"check for update on startup": "true",
"dismissed version": "0.142.5",
"last checked at": "2026-08-01T08:01:15.414115800Z",
"latest version": "0.146.0",
"latest version status": "current version is not older",
"npm package root": "D:\\nodejs\\node_modules\\@openai\\codex",
"running package root": "D:\\node\\node_global\\node_modules\\@openai\\codex",
"update action": "npm install -g @openai/codex",
"version cache": "C:\\Users\\27942\\.codex\\version.json"
},
"remediation": "Fix PATH or npm prefix so the running package root (D:\\node\\node_global\\node_modules\\@openai\\codex) matches the npm global package root (D:\\nodejs\\node_modules\\@openai\\codex).",
"durationMs": 1022
}
}
}
What issue are you seeing?
In an interactive Codex CLI session on Windows Terminal with PowerShell 7,
conversation and command-output history is limited to approximately the
currently visible terminal height.
Once output exceeds the viewport, earlier messages cannot be reached using
the terminal scrollbar or mouse wheel. Increasing the terminal window height
makes some earlier content visible again, which suggests the content is
limited to the live TUI viewport rather than being preserved in the terminal
scrollback.
The same behavior occurs when Codex is started with:
codex --no-alt-screen
Ctrl+T opens the transcript overlay and the missing history can be viewed
there, so the conversation data itself has not been lost. The problem appears
to be specifically with rendering finalized history into Windows Terminal's
native scrollback.
What steps can reproduce the bug?
- Open Windows Terminal with PowerShell 7.
- Run:
codex --no-alt-screen
- Start an interactive conversation.
- Ask Codex to produce enough responses and command output to exceed the
current terminal height.
- Wait for the output/turn to finish.
- Try to scroll upward using the mouse wheel or Windows Terminal scrollbar.
- Observe that only approximately one viewport of Codex history is available.
- Increase the terminal window height.
- Observe that additional earlier Codex content becomes visible, but only up
to the newly increased viewport height.
The behavior also occurs without --no-alt-screen, but that is expected for an
alternate-screen application. The unexpected part is that --no-alt-screen
does not preserve native terminal scrollback.
What is the expected behavior?
When --no-alt-screen is used, finalized conversation messages and command
output should be written into Windows Terminal's normal scrollback buffer.
The user should be able to scroll back through prior Codex output independently
of the current window height, without opening the Ctrl+T transcript overlay.
Additional information
I inspected the source corresponding to rust-v0.146.0
(commit e363b08c9175ac1cbe5893615dd2cb9ddf95043b).
--no-alt-screen correctly disables EnterAlternateScreen, but it does not
replace the TUI renderer or the inline history insertion mechanism.
Inline history is written using a partial DECSTBM scrolling region:
queue!(writer, SetScrollRegion(1..area.top()))?;
and then lines are printed at the bottom of that partial region.
Relevant source:
https://github.com/openai/codex/blob/e363b08c9175ac1cbe5893615dd2cb9ddf95043b/codex-rs/tui/src/insert_history.rs#L193-L245
On Windows Terminal, lines scrolled out of a partial scrolling region do not
appear to be added to the terminal's main scrollback buffer. They are discarded
once the visible region fills. This matches the observed behavior exactly:
available history is determined by the window height.
The Windows implementation of SetScrollRegion also contains:
// TODO(nornagon): is this supported on Windows?
The main TUI event stream explicitly ignores mouse events, and the normal chat
viewport has no internal transcript scroll offset:
The existing real-terminal resize test skips Windows, while the VT100 tests
inspect only the visible screen and do not verify host-terminal scrollback.
The same partial-scroll-region implementation is still present on main as of
commit ee0247f95a6fe2b094ba2253d82cae2a2b4c2dff.
Possible fixes may include:
- using normal main-buffer line appends on Windows Terminal in inline mode;
- using a Windows-specific insertion strategy that actually populates native
scrollback;
- or adding internal scrolling/mouse handling to the main transcript viewport.
A Windows ConPTY integration test that verifies scrollback contents would
probably catch this regression.
1 Comment
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action