From a902f56f405115b5b2a7bcd73308ca38fd7068b1 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 05:05:09 +0000 Subject: [PATCH] fix(tui): ChatGPT OAuth callback stream reads blocking on BSD sockets Signed-off-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Hunter Bown --- crates/tui/src/chatgpt_oauth.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/tui/src/chatgpt_oauth.rs b/crates/tui/src/chatgpt_oauth.rs index 1fa689758..1aae21cd7 100644 --- a/crates/tui/src/chatgpt_oauth.rs +++ b/crates/tui/src/chatgpt_oauth.rs @@ -495,6 +495,11 @@ fn wait_for_callback(listeners: &[TcpListener], expected_state: &str) -> Result< } fn handle_callback_stream(mut stream: TcpStream, expected_state: &str) -> Result { + // BSD sockets (macOS) hand the accepted stream the listener's O_NONBLOCK; + // the bounded read below needs a blocking socket with a timeout. + stream + .set_nonblocking(false) + .context("ChatGPT OAuth callback stream could not be set blocking")?; stream.set_read_timeout(Some(Duration::from_secs(5))).ok(); // One read is not one request: TCP may deliver the callback in // fragments, and a truncated query parses as a missing parameter.