fix: complete GitHub Copilot TUI & auth-files support#504
fix: complete GitHub Copilot TUI & auth-files support#504conversun wants to merge 2 commits intorouter-for-me:mainfrom
Conversation
- Add GitHub Copilot to OAuth tab provider list with device flow user_code display - Fix auth-files tab reading non-existent 'channel' field; use 'type'/'provider' from API - Add 'github-copilot' to NormalizeOAuthProvider for callback routing - Add i18n strings for user code display (zh/en)
Prevent userCode/providerName from leaking across OAuth sessions, which would hide the callback input for redirect-based providers after visiting a device-flow provider like GitHub Copilot.
There was a problem hiding this comment.
Code Review
This pull request introduces support for GitHub Copilot OAuth device flows. Key changes include updating the backend provider normalization, adding internationalization strings for user codes, and modifying the TUI to display device-specific codes while conditionally managing callback inputs. The review feedback identifies a logic error where the TUI captures keyboard focus unnecessarily during device flows, which breaks navigation, and points out redundant data fields in the authentication detail view.
| m.authURL = msg.url | ||
| m.authState = msg.state | ||
| m.providerName = msg.providerName | ||
| m.userCode = msg.userCode |
There was a problem hiding this comment.
For device-based OAuth flows (like GitHub Copilot) where a userCode is provided, the TUI should not enter the manual callback input mode. Currently, m.callbackInput.Focus() (line 116) and m.inputActive = true (line 117) are executed unconditionally. This causes the TUI to capture keyboard input for a hidden text field, which prevents normal navigation keys (like L for language or Esc for exit) from working as expected and requires the user to press Esc twice to return to the provider list.
Please wrap the focus and activation logic in a check: if msg.userCode == "" { ... }.
| {"File Name", "name", false}, | ||
| {"Provider", "provider", false}, |
There was a problem hiding this comment.
The field "File Name" has been updated to use the key "name", which is already displayed at the top of the detail view under the label "Name" (line 273). This results in the same information being shown twice. Since the API has consolidated these fields, you should remove the redundant entry.
| {"File Name", "name", false}, | |
| {"Provider", "provider", false}, | |
| {"Provider", "provider", false}, |
|
Rebased onto v6.9.22-0 (latest origin/main). See replacement PR. |
Summary
channel/auth_typefields; use actual API response fields (type/provider)github-copilottoNormalizeOAuthProviderfor callback routing consistencyuserCode,providerName, etc.) on flow reset to prevent cross-provider UI leaksChanges
internal/tui/oauth_tab.gouser_codefrom API; show device-flow code in remote mode; hide callback input for device-flow; reset transient state on Esc/re-enterinternal/tui/auth_tab.gochannel→type; Detail view:Channel→Type,Auth Type/auth_type→Provider/provider,File Name/file_name→File Name/nameinternal/tui/i18n.gooauth_user_codei18n string (zh: 验证码, en: User Code)internal/api/handlers/management/oauth_sessions.goNormalizeOAuthProvider:"github"→"github", "github-copilot", "copilot"all return"github-copilot"Testing
go build ./internal/tui/... ./internal/api/handlers/management/...— compiles cleanlygo test ./internal/tui/... ./internal/api/handlers/management/... -count=1— all tests pass