Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 29, 2025

This PR fixes authentication issues in Firebase Studio IDE (formerly IDX Google) by implementing enhanced environment detection and improved callback handling.

Changes Made

🔍 Enhanced Environment Detection

  • Added Firebase Studio IDE detection in URI handler and authentication services
  • Detects environment using app name, remote name, and environment variables
  • Provides specific handling for cloud-based IDE environments

🔧 Improved Authentication Flow

  • Enhanced WebAuthService with Firebase Studio IDE specific handling
  • Added cloud IDE indicator to authentication requests
  • Improved error handling and user feedback for cloud environments
  • Better logging for debugging authentication issues

📊 Enhanced User Agent

  • Updated user agent to include environment information
  • Helps server-side debugging and analytics
  • Identifies Firebase Studio IDE and other remote environments

🐛 Better Error Handling

  • More descriptive error messages for cloud IDE users
  • Specific guidance for Firebase Studio IDE authentication issues
  • Enhanced logging throughout the authentication flow

Testing

  • ✅ Authentication tests pass
  • ✅ Activation tests pass
  • ✅ Type checking passes
  • ✅ Linting passes

Impact

This fix should resolve the issue where users cannot login to app.roocode.com via Firebase Studio IDE because "after confirmation the IDE not detected the confirmation."

Fixes #6369


Important

Enhances Firebase Studio IDE authentication by improving environment detection, callback handling, and logging in WebAuthService, utils.ts, handleUri.ts, and extension.ts.

  • Environment Detection:
    • Added isFirebaseStudioIDE() function to detect Firebase Studio IDE in WebAuthService, utils.ts, handleUri.ts, and extension.ts.
    • Detects environment using app name, remote name, and environment variables.
  • Authentication Flow:
    • Enhanced WebAuthService with Firebase Studio IDE specific handling.
    • Added cloud IDE indicator to authentication requests in WebAuthService.
    • Improved error handling and user feedback for cloud environments in WebAuthService and handleUri.ts.
  • User Agent:
    • Updated getUserAgent() in utils.ts to include environment information.
  • Logging:
    • Added detailed logging for debugging authentication issues in WebAuthService, handleUri.ts, and extension.ts.
  • Testing:
    • Authentication and activation tests pass.
    • Type checking and linting pass.

This description was created by Ellipsis for 782ec3e. You can customize this summary. It will automatically update as commits are pushed.

- Add Firebase Studio IDE environment detection in URI handler
- Enhance WebAuthService with cloud IDE specific handling
- Improve user agent detection to include environment info
- Add comprehensive logging for authentication debugging
- Provide better user feedback for cloud IDE environments

Fixes #6369
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 29, 2025 17:03
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jul 29, 2025
Copy link
Contributor Author

@roomote roomote 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 Summary

This PR addresses Firebase Studio IDE authentication issues by implementing enhanced environment detection and improved callback handling. While the core functionality looks solid, there are several areas that need attention for code quality and maintainability.

Critical Issues (Must Fix)

1. Code Duplication - DRY Violation
The isFirebaseStudioIDE() function is duplicated across 4 files with identical logic. This violates DRY principles and creates maintenance overhead. Consider extracting this to a shared utility module.

2. Missing Test Coverage
No tests exist for the new Firebase Studio IDE detection functionality, which is a core feature of this PR. This reduces confidence in the implementation and makes future changes risky.

3. Inconsistent Error Handling
Firebase Studio IDE gets special error handling in some places but not others. The error handling pattern should be consistent across all authentication flows.

Important Suggestions (Should Consider)

4. Environment Variable Security
The detection logic checks process.env.FIREBASE_PROJECT_ID and process.env.IDX_WORKSPACE_ID, but these could be set in any environment. Should this be more restrictive to avoid false positives?

5. User Experience
Multiple information messages are shown to users in Firebase Studio IDE environments. Could this become overwhelming? Consider consolidating notifications.

6. Logging Inconsistency
Some files use console.log while others use the injected logger. Should standardize logging approach across all files.

Minor Improvements (Nice to Have)

7. JSDoc Documentation
The isFirebaseStudioIDE() function lacks comprehensive JSDoc explaining the detection criteria and return conditions.

8. Type Safety
Consider creating a TypeScript enum or constant for the cloud IDE types instead of using string literals like "firebase_studio".

9. Performance
The environment detection runs on every authentication operation. Consider caching the result since environment does not change during runtime.

Overall Assessment

The PR successfully addresses the reported issue and the implementation approach is sound. However, the code quality issues, particularly the duplication and missing tests, should be addressed before merging to maintain codebase health.

if (isCloudIDE) {
// Show additional guidance for Firebase Studio IDE users
vscode.window.showInformationMessage(
"Opening authentication in Firebase Studio IDE. After signing in, the callback should be automatically handled.",
Copy link
Contributor

Choose a reason for hiding this comment

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

User‐facing messages (e.g. the authentication guidance) are hardcoded. Use the translation (i18n) function instead to support localization.

Suggested change
"Opening authentication in Firebase Studio IDE. After signing in, the callback should be automatically handled.",
t("Opening authentication in Firebase Studio IDE. After signing in, the callback should be automatically handled."),

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

await this.storeCredentials(credentials)

vscode.window.showInformationMessage("Successfully authenticated with Roo Code Cloud")
const successMessage = "Successfully authenticated with Roo Code Cloud"
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency with naming guidelines, consider using 'Roo Code' instead of 'Roo Code Cloud' when referring to the product in user-facing messages.

This comment was generated because it violated a code review rule: irule_VrRKWqywZ2YV2SOE.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 29, 2025
@daniel-lxs
Copy link
Member

Closing, the issue is not properly scoped yet

@daniel-lxs daniel-lxs closed this Jul 30, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 30, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 30, 2025
@daniel-lxs daniel-lxs deleted the fix/firebase-studio-ide-authentication branch July 30, 2025 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Can't Login to app.roocode.com via Firebase Studio IDE Flutter ( Formerly IDX Google )

4 participants