Skip to content

Conversation

@ranaroussi
Copy link
Member

@ranaroussi ranaroussi commented Oct 15, 2025

πŸŽ‰ New Feature: Qwen Support

This PR adds full OAuth integration for Qwen AI, allowing users to authenticate and use Qwen with VibeProxy.

✨ Key Features

  • Browser-based OAuth flow - Seamless authentication via web browser
  • Pre-authentication email collection - Native SwiftUI dialog collects email before OAuth
  • Automatic email submission - App automatically submits email after OAuth completes (5s delay)
  • Status tracking - Real-time connection status with email and expiration display
  • Qwen service UI - Added to end of service providers list with icon

πŸ”§ Technical Details

Changes Made

  1. AuthStatus.swift

    • Added qwenStatus tracking
    • Added Qwen detection in auth file monitoring
    • Added reset logic for Qwen credentials
  2. ServerManager.swift

    • Added qwenLogin(email: String) auth command
    • Implemented automatic email piping after 5 seconds
    • Added -qwen-login CLI flag support
  3. SettingsView.swift

    • Added Qwen service section with icon
    • Implemented email prompt dialog with validation
    • Added connect/disconnect functionality
    • Increased window height (440px β†’ 490px)
  4. Resources

    • Added icon-qwen.png (4.8K)
  5. Documentation

    • Updated CHANGELOG.md for v1.0.6
    • Updated README.md to mention Qwen support

πŸ§ͺ Testing

βœ… Tested successfully:

  • Email prompt dialog appears before OAuth
  • Browser opens for authentication
  • Email auto-submits after OAuth completion
  • Status updates correctly after auth
  • Connect/Disconnect functionality works
  • Icon displays properly in UI

πŸ“ User Flow

  1. User clicks "Connect" on Qwen
  2. Dialog prompts for Qwen email address
  3. User enters email β†’ clicks "Continue"
  4. Browser opens for OAuth
  5. After OAuth success, app auto-submits email (5s)
  6. Authentication completes, status updates

πŸ”— Related Issues

Closes #10

Summary by CodeRabbit

  • New Features

    • Added Qwen as a supported provider with OAuth login, including pre-auth email collection and automatic credential creation; Settings now include Connect/Reconnect/Disconnect controls and show email/expiry.
  • Improvements

    • Settings window height increased to accommodate Qwen section.
    • Enhanced post-auth notifications and streamlined Qwen authentication flow.
  • Documentation

    • README updated to include Gemini and Qwen, OAuth guidance, and new icons.
    • CHANGELOG updated for release 1.0.6.

- Add Qwen authentication with browser-based OAuth flow
- Implement pre-auth email collection dialog for seamless UX
- Add automatic email submission after OAuth completion
- Add Qwen service section to settings UI with icon
- Add auth status tracking for Qwen credentials
- Increase settings window height (440px β†’ 490px)
- Update README and CHANGELOG for v1.0.6

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@coderabbitai
Copy link

coderabbitai bot commented Oct 15, 2025

Walkthrough

Adds Qwen OAuth support across docs, auth status model, server auth command/flow (including email capture and auto-fill), and settings UI. Introduces Qwen connection management (connect/reconnect/disconnect), status tracking, and a Qwen email prompt. Updates CHANGELOG and README. Adjusts settings window height.

Changes

Cohort / File(s) Summary
Docs
CHANGELOG.md, README.md
Add release 1.0.6 entries and README updates: Qwen and Gemini referenced in onboarding/auth text, asset list updated (added icon-qwen.png), and note about settings height.
Auth Status Model
src/Sources/AuthStatus.swift
Add @Published var qwenStatus = AuthStatus(isAuthenticated: false, type: "qwen"); parse and track Qwen credential files; reset/update Qwen status in success/error paths.
Server Auth Flow
src/Sources/ServerManager.swift
Add AuthCommand.case qwenLogin(email: String); start -qwen-login flow, capture qwenEmail, and after OAuth initiation auto-send the email (with newline) to auth process stdin; logging and notifications wired like other providers.
Settings UI
src/Sources/SettingsView.swift
Add Qwen UI block, email prompt sheet, and handlers: connectQwen(), startQwenAuth(email:), disconnectQwen(); new state vars (isAuthenticatingQwen, showingQwenEmailPrompt, qwenEmail); increase view frame height to 490.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant SettingsView
  participant ServerManager
  participant AuthProcess as Auth CLI/Process
  participant OAuthBrowser as OAuth Browser
  participant AuthStatus as Auth Status

  User->>SettingsView: Click "Connect Qwen"
  SettingsView->>SettingsView: Show email prompt
  User->>SettingsView: Enter email
  SettingsView->>ServerManager: qwenLogin(email)

  ServerManager->>AuthProcess: Start process with -qwen-login
  AuthProcess-->>OAuthBrowser: Open Qwen OAuth URL
  OAuthBrowser-->>AuthProcess: OAuth callback (success)
  note over ServerManager,AuthProcess #e5f5e0: wait ~10s then auto-send email
  ServerManager->>AuthProcess: Write "<email>\n" to stdin

  AuthProcess-->>ServerManager: Auth result
  ServerManager->>AuthStatus: Update qwenStatus (success/error)
  AuthStatus-->>SettingsView: Published status update
  SettingsView-->>User: Show Connected / Error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A whisk of code, a hop, a grinβ€”
I tapped the OAuth, Qwen slipped in.
An email nudged, then newline flew,
Connections stitched, the status true.
I thump my paw: "New releaseβ€”woohoo!" πŸ₯•

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
βœ… Passed checks (4 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check βœ… Passed The provided title concisely and clearly summarizes the main change of the pull request by stating the addition of Qwen OAuth support along with email pre-collection. It is specific to the primary change without extraneous details or vague language, making it easy for teammates to understand the core purpose of the PR at a glance.
Linked Issues Check βœ… Passed The pull request fully implements the requested Qwen OAuth authentication feature from issue #10 by adding command support in ServerManager, status tracking in AuthStatus, UI flows in SettingsView, and documentation updates for Qwen integration, satisfying the core coding requirements outlined in the feature request.
Out of Scope Changes Check βœ… Passed All changes in this PR relate directly to implementing Qwen OAuth support, including updates to authentication logic, UI, assets, and documentation. There are no modifications outside the scope of the feature request defined in issue #10.
✨ Finishing touches
  • πŸ“ Generate docstrings
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/qwen

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/Sources/ServerManager.swift (1)

262-262: Consider using forced String to Data conversion.

SwiftLint suggests using the non-optional Data(_:) initializer when converting String to Data, as UTF-8 encoding of a Swift String should never fail.

Apply this diff:

-                    if let data = "\(email)\n".data(using: .utf8) {
-                        try? inputPipe.fileHandleForWriting.write(contentsOf: data)
-                        NSLog("[Auth] Sent Qwen email: %@", email)
-                    }
+                    let data = Data("\(email)\n".utf8)
+                    try? inputPipe.fileHandleForWriting.write(contentsOf: data)
+                    NSLog("[Auth] Sent Qwen email: %@", email)
src/Sources/SettingsView.swift (2)

310-335: Consider adding email format validation.

The email prompt only validates that the field is not empty (line 329). Adding basic format validation would improve user experience by catching typos before initiating the OAuth flow.

You could add a simple validation helper:

private func isValidEmail(_ email: String) -> Bool {
    let emailPattern = #"^[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$"#
    return email.range(of: emailPattern, options: .regularExpression) != nil
}

Then update the Continue button:

                     Button("Continue") {
                         showingQwenEmailPrompt = false
                         startQwenAuth(email: qwenEmail)
                     }
-                    .disabled(qwenEmail.isEmpty)
+                    .disabled(qwenEmail.isEmpty || !isValidEmail(qwenEmail))
                     .keyboardShortcut(.defaultAction)

202-243: Consider extracting service UI into a reusable component.

The Qwen service section (lines 202-243) duplicates the same pattern used for Claude, Codex, and Gemini. While this works, extracting a reusable ServiceRow component would reduce duplication and make future service additions easier to maintain.

Example structure:

struct ServiceRow: View {
    let iconName: String
    let serviceName: String
    let status: AuthStatus
    let isAuthenticating: Bool
    let onConnect: () -> Void
    let onDisconnect: () -> Void
    
    var body: some View {
        // Common UI structure
    }
}
πŸ“œ Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 6065058 and ccfed6b.

β›” Files ignored due to path filters (1)
  • src/Sources/Resources/icon-qwen.png is excluded by !**/*.png
πŸ“’ Files selected for processing (5)
  • CHANGELOG.md (2 hunks)
  • README.md (4 hunks)
  • src/Sources/AuthStatus.swift (5 hunks)
  • src/Sources/ServerManager.swift (3 hunks)
  • src/Sources/SettingsView.swift (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/Sources/SettingsView.swift (2)
src/Sources/IconCatalog.swift (1)
  • image (12-37)
src/Sources/ServerManager.swift (1)
  • runAuthCommand (203-325)
πŸͺ› LanguageTool
README.md

[grammar] ~37-~37: There might be a mistake here.
Context: ..., Gemini, and Qwen directly from the app - πŸ“Š Real-Time Status - Live connectio...

(QB_NEW_EN)

CHANGELOG.md

[grammar] ~10-~10: There might be a mistake here.
Context: ...ml). ## [1.0.6] - 2025-10-15 ### Added - Qwen Support - Full integration with Q...

(QB_NEW_EN)


[grammar] ~11-~11: There might be a mistake here.
Context: ...on with Qwen AI via OAuth authentication - Browser-based Qwen OAuth flow with autom...

(QB_NEW_EN)


[grammar] ~12-~12: There might be a mistake here.
Context: ...uth flow with automatic email submission - Pre-authentication email collection dial...

(QB_NEW_EN)


[grammar] ~13-~13: There might be a mistake here.
Context: ... email collection dialog for seamless UX - Automatic credential file creation with ...

(QB_NEW_EN)


[grammar] ~14-~14: There might be a mistake here.
Context: ...edential file creation with type: "qwen" - Connection status display with email and...

(QB_NEW_EN)


[grammar] ~15-~15: There might be a mistake here.
Context: ...splay with email and expiration tracking - Qwen added to end of service providers l...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ... of service providers list ### Improved - Settings Window - Increased height fro...

(QB_NEW_EN)


[grammar] ~19-~19: There might be a mistake here.
Context: ...Increased height from 440px to 490px to accommodate Qwen service section ## [1.0.5] - 2025...

(QB_NEW_EN)

πŸͺ› SwiftLint (0.57.0)
src/Sources/ServerManager.swift

[Warning] 262-262: Prefer non-optional Data(_:) initializer when converting String to Data

(non_optional_string_data_conversion)

πŸ”‡ Additional comments (6)
CHANGELOG.md (1)

8-20: LGTM!

The changelog entry accurately documents the Qwen OAuth integration with clear, concise bullet points covering all major features and improvements.

src/Sources/AuthStatus.swift (1)

31-31: LGTM!

The Qwen authentication status tracking follows the exact same pattern as existing services (Claude, Codex, Gemini), maintaining excellent consistency throughout the codebase.

Also applies to: 40-40, 84-87, 109-112, 121-121

README.md (1)

14-14: LGTM!

Documentation updates consistently reflect Qwen support across all relevant sections (features, usage, requirements, and assets).

Also applies to: 19-19, 37-37, 68-68, 109-110

src/Sources/ServerManager.swift (1)

222-234: LGTM!

The qwenLogin command implementation correctly follows the established pattern for authentication commands, properly storing the email for later use.

src/Sources/SettingsView.swift (2)

475-510: LGTM!

The Qwen authentication methods (connectQwen, startQwenAuth, disconnectQwen) correctly implement the email collection flow and follow the established patterns for other services.


309-309: LGTM!

The window height increase from 440px to 490px appropriately accommodates the new Qwen service section.

- Increase OAuth completion delay from 5s to 10s for more reliable timing
- Add detailed comment explaining why 10s was chosen
- Document that OAuth typically completes in 5-8s but can vary
- Note future improvement: monitor OAuth completion signal directly

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Sources/ServerManager.swift (1)

257-272: Good improvements from the previous review.

The 10-second delay and comprehensive documentation address the previous timing concerns. The approach is reasonable for an initial implementation.

Optional: Address the SwiftLint warning.

Line 266: SwiftLint prefers the non-optional Data(_:) initializer. While the optional version is safe for UTF-8 strings, the non-optional form is more idiomatic.

Apply this diff:

-                    if let data = "\(email)\n".data(using: .utf8) {
-                        try? inputPipe.fileHandleForWriting.write(contentsOf: data)
+                    let data = Data("\(email)\n".utf8)
+                    try? inputPipe.fileHandleForWriting.write(contentsOf: data)
                         NSLog("[Auth] Sent Qwen email: %@", email)
-                    }

Note on error handling: The try? pattern silently ignores pipe write failures. This is consistent with the existing Gemini flow (line 250), but for a critical auth step, consider logging failures in future iterations to help diagnose issues if users report incomplete authentication.

πŸ“œ Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between ccfed6b and 37c01a5.

πŸ“’ Files selected for processing (1)
  • src/Sources/ServerManager.swift (3 hunks)
🧰 Additional context used
πŸͺ› SwiftLint (0.57.0)
src/Sources/ServerManager.swift

[Warning] 266-266: Prefer non-optional Data(_:) initializer when converting String to Data

(non_optional_string_data_conversion)

πŸ”‡ Additional comments (3)
src/Sources/ServerManager.swift (3)

222-223: LGTM!

The variable declaration is clean and appropriately scoped for capturing the email parameter from the auth command.


231-233: LGTM!

The Qwen login case handling is implemented consistently with the other authentication commands and correctly captures the email for later submission.


395-395: LGTM!

The enum case definition is clean and follows Swift conventions for associated values.

@ranaroussi ranaroussi merged commit a57c9e0 into main Oct 15, 2025
1 check passed
@ranaroussi ranaroussi deleted the feature/qwen branch October 15, 2025 12:41
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.

Feature Request: Qwen Code oAuth?

2 participants