Fix Codex connect: streaming repair, named accounts, Alt+A picker - #468
Merged
Conversation
The Codex backend serves some models (observed live with the gpt-5.6 family) as HTTP 200 with a valid SSE body but no Content-Type header at all. The inference harness detects the response protocol from that header alone, so every turn on those models died with an unrecoverable protocol error despite a healthy stream. The fetch boundary now restores the header for Codex responses requests from the protocol the request's accept header declared; declared-but-unsupported types, ambiguous accept headers, and non-2xx responses keep the loud failure.
The connect flow always signed in under the same hardcoded profile name, so a second ChatGPT or xAI account silently overwrote the first one's tokens and there was no way to re-authorize an existing account. OAuth choices now insert a name step between provider selection and login: it prefills a suggested slug that auto-suffixes on collision, validates the entered slug (lowercase, restricted charset, length-capped) since it flows into a settings key, and asks for an explicit confirm before re-authorizing a name that already exists. The slug lives in its own form field rather than overloading the provider name field, which only gets the compound catalog name once login succeeds.
The flat /model list only shows a provider once it has zero connected accounts, so a second OAuth account (a second Codex or xAI login) had no path to a connect flow. Alt+A opens a fresh selector over every first-class provider kind, with a live connected-account count per row and no already-connected filtering, so a provider stays reachable no matter how many accounts it already has. Picking a row runs the same inline connect flow the flat list's connect rows use, and now reopens the model picker focused on the account's default model instead of leaving the operator to find it themselves.
Alt+A's add-provider selector is now the only path to connecting a provider, so the flat list's "connect →" rows and the filtering that fed them are dead weight: the unconnected-providers plumbing, the unconnected section of the models-first catalog, and the connect-row id helpers all go. The connected-choice predicates were only ever called to build that filtering, so they go too — their matching logic already lives on in the account-count helper.
Choosing a provider from Alt+A crashed with "Cannot create CliRenderer: stdin is already used by another CliRenderer": the inline connect flow asked the setup surface to create its own renderer while the session's TUI still owned stdin. The surface already supports a caller-owned renderer, so the session now lends it its own, suspends the shell's key/paste/submit handling for the surface's lifetime (Ctrl+C during sign-in must cancel the sign-in, not interrupt the running agent), and restores prompt focus after.
The overlay host floats absolutely over the landing screen, and the un-float path only flipped position back to relative. Yoga treats the leftover top inset as a relative offset, so after any overlay had opened on the landing, every later in-session overlay — the slash popup, the model picker — rendered that many rows below its flow slot, ending up under the prompt and clipped off the screen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the "cannot connect Codex" complaint class end to end. Closes CL-5894, CL-5895, CL-5896, CL-5897.
What broke
What changed
Verification