Skip to content

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Sep 4, 2025

In Codespaces/web, generate https auth_redirect via vscode.env.asExternalUri so the callback returns to the running instance instead of launching desktop. Complements Roo-Code-Cloud change that applies /auth/clerk/callback on https redirects.


Important

In WebAuthService.ts, login() now uses vscode.env.asExternalUri for auth_redirect in Codespaces, with fallback to deep link on failure.

  • Behavior:
    • In WebAuthService.ts, login() now uses vscode.env.asExternalUri to generate auth_redirect URL for Codespaces/web environments.
    • Fallback to raw deep link if asExternalUri fails, ensuring desktop compatibility.
  • Logging:
    • Logs error if asExternalUri fails and falls back to deep link.

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

@roomote roomote bot requested review from mrubens, cte and jr as code owners September 4, 2025 18:23
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Sep 4, 2025
Copy link
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.

Reviewing my own code because apparently I trust no one, not even myself.

let authRedirect = deepLink.toString()
try {
const external = await vscode.env.asExternalUri(deepLink)
authRedirect = external.toString()
Copy link
Author

Choose a reason for hiding this comment

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

Missing test coverage for this new asExternalUri logic. Should we add tests to verify both the success path and the fallback behavior when asExternalUri fails? The existing test file doesn't mock or test this new functionality.

authRedirect = external.toString()
} catch (e) {
// Fallback to the raw deep link if resolution fails (desktop will still work).
this.log(`[auth] asExternalUri failed, falling back to deep link: ${e}`)
Copy link
Author

Choose a reason for hiding this comment

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

Could we make the error logging more specific here? Instead of just ${e}, perhaps ${e.message} or even the full error object would help with debugging, especially since this is a new code path that might fail in unexpected ways.

const publisher = packageJSON?.publisher ?? "RooVeterinaryInc"
const name = packageJSON?.name ?? "roo-cline"

const deepLink = vscode.Uri.parse(`${vscode.env.uriScheme}://${publisher}.${name}`)
Copy link
Author

Choose a reason for hiding this comment

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

Consider extracting this deep link construction and resolution logic (lines 271-280) into a separate private method like resolveAuthRedirectUri(). This would improve readability and make it easier to unit test this specific functionality.

const state = crypto.randomBytes(16).toString("hex")
await this.context.globalState.update(AUTH_STATE_KEY, state)

// Resolve the deep link target for the CURRENT VS Code instance.
Copy link
Author

Choose a reason for hiding this comment

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

Would it be worth adding a JSDoc comment to the login method documenting this new Codespaces-specific behavior? The inline comments are helpful, but a method-level documentation might help future maintainers understand the overall auth flow better.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 4, 2025
@daniel-lxs daniel-lxs marked this pull request as draft September 5, 2025 01:15
@daniel-lxs daniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap Sep 5, 2025
@hannesrudolph hannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 5, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 23, 2025
@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR - Draft / In Progress size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants