fix(tui): route each OAuth picker row to its own provider, not kimi.com
Root cause: PendingMenuItem::Login carried only a label, so every provider row collapsed to the id-less Action::Login, and dispatch_login resolved the FIRST advertised interactive method — the Kimi device flow. Selecting Grok/Claude/Copilot/Codex all opened kimi.com. (The shell side was already correct: authenticate() dispatches each method id to its own OAuth flow.) - PendingMenuItem::Login now carries the advertised method id (None only on the no-interactive-method fallback row). - New Action::LoginWith(AuthMethodId); the picker dispatches it with the row's own id. Action::Login keeps its meaning (resolved/default method) for /login, auto-login, and re-auth. - dispatch_login_with resolves the id against the advertised methods and FAILS CLOSED on an unknown id — no silent first-method fallback — then adopts the method's label and start mode. Tests: picker rows pinned to their method ids; LoginWith(claude-pro-max) must authenticate with claude-pro-max even when kimi-code was previously resolved; unknown ids surface an error and start nothing. Verified: kigi-tui 6867 tests green, clippy clean.
This commit is contained in:
@@ -562,6 +562,11 @@ pub enum Action {
|
||||
SwitchAccount,
|
||||
/// User pressed login on the welcome screen.
|
||||
Login,
|
||||
/// User chose a specific OAuth provider row on the login picker. Routes
|
||||
/// the flow to THAT advertised method — `Login` alone resolves to the
|
||||
/// first interactive method, which sent every provider row to the Kimi
|
||||
/// device flow.
|
||||
LoginWith(acp::AuthMethodId),
|
||||
/// Cancel an in-progress login that was started from inside a session
|
||||
/// (`/login` or a 401 re-auth prompt) and return to the previous view.
|
||||
/// Distinct from `Quit`: abandoning a mid-session re-auth must not exit
|
||||
|
||||
Reference in New Issue
Block a user