fix: Check Claude Code CLI auth before showing warning#703
fix: Check Claude Code CLI auth before showing warning#703
Conversation
The startup warning "No Claude authentication configured" was shown even when users have Claude Code CLI installed and authenticated with a subscription. The Claude Agent SDK can reuse CLI authentication, so this was a false positive. Now checks for Claude Code CLI authentication indicators before showing the warning: - Recent CLI activity (stats cache) - CLI setup indicators (settings + project sessions) - OAuth credentials file Also updated the warning message to list all authentication options. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @Shironex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the server's authentication detection mechanism to prevent a misleading warning for users leveraging Claude Code CLI. It introduces a comprehensive check for CLI-based authentication, ensuring that the system correctly identifies authenticated environments. Additionally, the user-facing warning message has been improved to offer clearer guidance on all supported authentication methods, enhancing the overall user experience. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughStartup now performs an asynchronous Claude authentication check: it first checks for Changes
Sequence Diagram(s)sequenceDiagram
participant Server as Server Startup
participant Platform as `@automaker/platform`
participant User as UI / Developer
Server->>Server: read ANTHROPIC_API_KEY
alt ANTHROPIC_API_KEY present
Server->>User: log detection & continue
else no env key
Server->>Platform: call getClaudeAuthIndicators()
Platform-->>Server: return indicators (found / not found)
alt indicators found
Server->>User: log Claude CLI detected
else none found
Server->>User: show warning dialog with options (Claude CLI, Anthropic API key, setup wizard)
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses an issue where a false positive warning for Claude authentication was shown. The new logic properly checks for Claude Code CLI authentication before displaying the warning, which is a significant improvement. The updated warning message is also much clearer and more helpful to the user. The use of an async IIFE is a good choice to perform this check without blocking server startup. I have one suggestion to improve diagnosability by logging potential errors when checking for CLI authentication.
Updated the error handling in the Claude Code CLI authentication check to log the specific error encountered. This enhancement provides better visibility into issues during the authentication process, ensuring users are informed of any problems that arise.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/server/src/index.ts`:
- Around line 130-137: The CLI auth check incorrectly ignores API key auth: in
the block using getClaudeAuthIndicators() update the hasCliAuth computation
(variable hasCliAuth) to consider indicators.credentials.hasApiKey in addition
to indicators.credentials?.hasOAuthToken so API-key authenticated CLIs are
treated as valid; locate the hasCliAuth assignment and include the hasApiKey
condition alongside hasOAuthToken.
Address CodeRabbit review comment - API keys stored in CLI credentials file should also be detected as valid authentication. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Test plan
ANTHROPIC_API_KEYbut with Claude Code CLI authenticated → should show✓ Claude Code CLI authentication detectedANTHROPIC_API_KEYset → should show✓ ANTHROPIC_API_KEY detected🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.