Aident AI

Codex Terminal Stuck After Resize? Force a Safe Redraw
If Codex keeps drawing at the terminal's old width or height after you resize the window, do not reset the repository or delete the task. First resize the window once more by a small amount, then press Ctrl-L to request a redraw. If the viewport is still stale, preserve your work, exit Codex normally, update it through the installer that owns your current installation, and resume the task.
This guide covers a narrow signature: the terminal itself has the new dimensions, but Codex continues to render inside the old rectangle. It does not cover missing scrollback, a viewport that jumps when a response completes, or a terminal that is simply too small for the current layout.
Match the Stale-Size Signature
Resize the window while Codex is idle, then look for one or more of these symptoms:
lines wrap at the previous width;
the bottom of the interface stops at the previous height;
a newly exposed strip of the window remains blank;
the cursor or status area is drawn inside the old boundary; or
another small resize suddenly makes the layout snap to the correct size.
Use a different recovery path when the symptom differs:
What you observe | Likely boundary | First safe action |
|---|---|---|
Codex still draws inside the old rows and columns | Resize event or TUI redraw state | Resize once more, then press |
The viewport jumps only when a long response finishes | Completion-time rich-output reflow | Use the Codex iTerm2 scroll-jump guide |
Old output cannot be reached at all | Terminal scrollback or alternate-screen policy | Review the terminal's scrollback settings |
The screen briefly flashes blank but recovers | Transient redraw during resize | Record versions and test one controlled resize |
The shell also reports the old size | Terminal, multiplexer, SSH, or PTY boundary | Diagnose that layer before changing Codex |
Do not run git reset, remove Codex state, or clear the task. A drawing problem is not evidence that the repository or conversation is corrupt.
Preserve the Work Before Testing
Wait for the current response or command to finish. If Codex produced a result you need, save it to a reviewed project file or copy the necessary non-secret excerpt. Then record the current version:
Also note the operating system, terminal name and version, and whether tmux, screen, zellij, SSH, WSL, or another PTY layer sits between Codex and the terminal. Those layers can receive or relay resize events independently.
Do not paste a full diagnostic bundle into a public issue. It can contain local paths, configuration, provider details, or other private context.
Try the Lowest-Risk Redraw Sequence
Use this sequence once, stopping as soon as the layout is correct:
Drag one edge of the terminal by a few columns or rows.
Pause briefly and check whether Codex fills the new area.
Press
Ctrl-Lonce to request a terminal redraw.If your current Codex interface offers a safe task or agent switch, switch away and back only after the active work is saved.
If the stale rectangle remains, exit Codex normally and resume the task from a fresh process.
The original upstream report says switching agents forced a redraw, and later comments report that Ctrl-L or a second resize sometimes recovered the viewport. These are user-reported containment steps, not an OpenAI-confirmed fix. They are useful because they do not rewrite project files or Codex state.
Avoid repeatedly resizing while a command is running. A noisy reproduction makes it harder to tell which event restored the display and can obscure output you need to inspect.
Check Whether the Terminal Knows Its New Size
Open a separate ordinary shell in the same terminal application, or a neighboring pane that is not running inside Codex, and run:
The command prints rows first and columns second. Resize that shell and run it again. If the numbers change there while Codex still uses the old rectangle, the terminal can observe the new geometry and the remaining failure is more likely in the Codex TUI or the PTY path feeding that process.
If the numbers do not change, inspect the intermediate layer first. For example, reproduce without tmux or SSH before filing a Codex-specific report. Do not use stty size through a non-interactive tool call inside Codex as definitive evidence; that subprocess may not own a controlling terminal.
The upstream issue includes a case where the PTY size was correct while Codex remained visually stale. That establishes that a correct size reading does not guarantee the current viewport has redrawn.
Update Without Mixing Variables
If the problem survives one redraw sequence, update Codex through the same installation path that owns the current binary. Follow the current instructions in the official Codex repository, then confirm the new version:
Test one resize before changing terminal settings, installing a multiplexer, or editing shell startup files. A one-variable test tells you whether the version change mattered.
The selected issue was closed after the reporter said the problem no longer occurred. It does not identify a fixed Codex version, merged change, or confirmed root cause. Do not claim that every current release contains a specific fix. Updating is a safe first comparison, not proof of resolution.
Run One Controlled Reproduction
Use a disposable Codex task with no deployment, database write, or approval waiting in the transcript:
Start Codex in a terminal at a known size.
Ask for a short read-only response with several wrapped lines.
Widen the terminal once and record whether the text reflows.
Make the terminal taller once and record whether the bottom status area moves.
Run
stty sizein a separate shell at the original and final dimensions.Record whether a second resize,
Ctrl-L, or a normal restart restored the layout.
One failing pass is enough. Repeating the test many times can hide an intermittent resize-delivery problem.
Useful evidence is compact:
Codex version;
operating system and architecture;
terminal and version;
initial and final rows and columns;
multiplexer, SSH, or WSL presence;
whether the separate shell saw the new size;
whether the second resize,
Ctrl-L, or restart redrew Codex; andthe matching upstream issue URL.
Why a Correct PTY Size Can Still Look Wrong
A terminal resize normally updates the PTY dimensions and signals the foreground process. A terminal UI must then receive that change, recompute its layout, and repaint the affected region. A failure at the redraw stage can leave the process aware of the new geometry while the visible interface still reflects an older viewport.
That explanation fits the reported evidence, but it is not a confirmed diagnosis of Codex issue 21978. The report spans Ghostty on macOS and a later Alacritty/Sway case on Linux, which makes a terminal-specific explanation insufficient on its own. Multiplexers, remote shells, and platform event delivery remain separate variables.
Report the Result Without Losing Context
Add a concise reproduction to the matching upstream issue if the exact stale-size signature returns on a current version. Search for an existing report before opening a duplicate. Include the matrix above, but omit prompts, model output, repository names, secrets, and full local diagnostics.
If the display problem blocks a critical task, finish the work in a fresh terminal process after saving the relevant state. A normal exit and resume is safer than deleting the task or treating the viewport as evidence that the underlying work disappeared.
Monitor the Resize Issue With Aident Loadout
Start with the canonical setup instruction:
Follow https://aident.ai/SETUP.md
Then give your agent a bounded, read-only request:
Check Aident Loadout authentication and Vault status. Discover the current GitHub issue-search and issue-read Actions, inspect their schemas, and preflight them. If the estimates are free, return the state, close reason, updated time, labels, comment count, and canonical URL for openai/codex issue 21978, plus at most three newer open issues containing
terminal resize,stale viewport, orold terminal size. Do not create, edit, close, label, comment on, or react to any issue.
The measurable result is one current source record and up to three possible successors with no provider write. It also keeps a future refresh tied to upstream evidence rather than an assumed release.
For the distinct completion-time viewport failure, use Codex iTerm2 Jumps to the Top? Test Raw Output.
Set up Aident Loadout and monitor the Codex resize issue read-only
Sources
Codex issue 21978: terminal UI remains at the old size after resize, reviewed September 1, 2026.
Official OpenAI Codex repository, reviewed September 1, 2026.
Refresh this guide when issue 21978 gains a confirmed fix reference, a Codex release documents resize behavior, or a new current issue establishes a different safe recovery path.



The one tool
for every tool
your agent needs.
Give any AI agent real capabilities in seconds. Connect 27,000+ tools once, skip the setup headache, and let your agents execute.
