Skip to content

fix: complete GitHub Copilot TUI & auth-files support#508

Closed
conversun wants to merge 2 commits intorouter-for-me:mainfrom
conversun:fix/github-copilot-tui-support-v3
Closed

fix: complete GitHub Copilot TUI & auth-files support#508
conversun wants to merge 2 commits intorouter-for-me:mainfrom
conversun:fix/github-copilot-tui-support-v3

Conversation

@conversun
Copy link
Copy Markdown

Summary

  • Add GitHub Copilot to TUI OAuth tab with device-flow user code display
  • Fix auth-files tab reading non-existent channel/auth_type fields; use actual API response fields (type/provider)
  • Add github-copilot to NormalizeOAuthProvider for callback routing consistency
  • Clear stale OAuth session state (userCode, providerName, etc.) on flow reset to prevent cross-provider UI leaks

Changes

File Change
internal/tui/oauth_tab.go Add GitHub Copilot provider entry; propagate user_code from API; show device-flow code in remote mode; hide callback input for device-flow; reset transient state on Esc/re-enter
internal/tui/auth_tab.go List view: channeltype; Detail view: ChannelType, Auth Type/auth_typeProvider/provider, File Name/file_nameFile Name/name
internal/tui/i18n.go Add oauth_user_code i18n string (zh: 验证码, en: User Code)
internal/api/handlers/management/oauth_sessions.go NormalizeOAuthProvider: "github""github", "github-copilot", "copilot" all return "github-copilot"

Testing

  • Rebased on v6.9.22-0 (origin/main latest)
  • go build / go test — all pass

- 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.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for GitHub Copilot via the OAuth device flow. Key changes include updating the provider normalization logic to handle Copilot, adding a userCode field to the TUI model to display verification codes, and modifying the TUI to hide the callback URL input when a device code is present. Feedback highlights a potential issue where input focus might block TUI navigation during device-based authentication and identifies a redundant field in the authentication detail view.

m.authURL = msg.url
m.authState = msg.state
m.providerName = msg.providerName
m.userCode = msg.userCode
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

For device-based OAuth flows (like GitHub Copilot), the userCode is provided and the user does not need to paste a callback URL. However, the logic following this hunk (specifically line 117, which is outside the diff) unconditionally sets m.inputActive = true and line 116 calls Focus().

This is problematic because when inputActive is true, the TUI redirects all keystrokes to the (now hidden) text input. This will prevent the user from scrolling the viewport or using other navigation keys while waiting for authentication. Please ensure that inputActive is only set to true and Focus() is only called if m.userCode is empty.

Comment on lines +278 to +279
{"File Name", "name", false},
{"Provider", "provider", false},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The 'File Name' entry is now redundant because it uses the 'name' key, which is already displayed as 'Name' on line 273. Since the API response fields have been normalized, this duplicate entry should be removed to keep the detail view clean.

Suggested change
{"File Name", "name", false},
{"Provider", "provider", false},
{"Provider", "provider", false},

@conversun
Copy link
Copy Markdown
Author

Closing - changes require corresponding Web panel modifications that are out of scope.

@conversun conversun closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant