Skip to content

fix(tui): flush input buffer on init to prevent early exit on Windows#10729

Merged
etraut-openai merged 1 commit intoopenai:mainfrom
Ashutosh0x:fix/windows-tui-login-early-exit-10661
Feb 5, 2026
Merged

fix(tui): flush input buffer on init to prevent early exit on Windows#10729
etraut-openai merged 1 commit intoopenai:mainfrom
Ashutosh0x:fix/windows-tui-login-early-exit-10661

Conversation

@Ashutosh0x
Copy link
Contributor

@Ashutosh0x Ashutosh0x commented Feb 5, 2026

Fixes #10661.

Problem

On Windows, the sign-in menu can exit immediately if the OS-level input buffer contains trailing characters (like the Enter key from running the command).

Solution

Flush Input Buffer on Init: Use FlushConsoleInputBuffer on Windows (and cflush on Unix) in ui::init() to discard any input captured before the TUI was ready.

Verified by @CodebyAmbrose in #10661.

@etraut-openai
Copy link
Collaborator

@codex review

Copy link
Collaborator

@etraut-openai etraut-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Let's keep it targeted to just the input buffer flush.

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@etraut-openai
Copy link
Collaborator

You can ignore the fact that the Bazel builds are failing.

@Ashutosh0x Ashutosh0x force-pushed the fix/windows-tui-login-early-exit-10661 branch from 335f040 to b543f12 Compare February 5, 2026 08:45
@Ashutosh0x Ashutosh0x changed the title fix(tui): flush input buffer and improve onboarding loop for Windows fix(tui): flush input buffer on init to prevent early exit on Windows Feb 5, 2026
@etraut-openai etraut-openai merged commit 7b28b35 into openai:main Feb 5, 2026
25 of 31 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: codex sign-in menu exits immediately (can’t press Enter / select option)

2 participants