Narrow login-error detection to avoid false login prompts on custom endpoints#206
Open
leonidasbarkas98-cpu wants to merge 3 commits into
Open
Conversation
…enta#12) Match "Please run /login" instead of the bare "/login" substring, and skip the broad pattern list entirely (falling back to the strict exact-match check) when a custom, non-OpenCredits ANTHROPIC_BASE_URL is configured, so a relay's own error text can no longer trigger a false login prompt. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ta#12) _hasCustomAnthropicEndpoint() ignored the environment.disabled toggle, so a stale custom URL left in settings could still suppress the real login prompt after the user disabled custom env vars. Skip the settings variables when disabled, same as _isOpenCredits(), while still honoring the process.env fallback since that continues to apply via spawnEnv. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
extension.ts: extract the 'opencredits.ai'/'localhost:8787' substrings duplicated across _isOpenCredits() and _hasCustomAnthropicEndpoint() into a single KNOWN_ENDPOINT_MARKERS constant, and lowercase the base URL before comparing (matching the already-lowercase markers and the 'api.anthropic.com' check). script.ts: the two OpenCredits base-URL checks already agreed with each other on the broader bare 'opencredits' substring (vs. extension.ts's 'opencredits.ai'), so that behavior is kept as-is to avoid narrowing OpenCredits detection in the webview; only deduped them onto a shared OPENCREDITS_BASE_URL_MARKERS constant and lowercased the compared URLs for consistency. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_isLoginErrorResult()matched broad substrings (e.g.'/login','Invalid API key') in any error text, which forced spurious login flows for users on relays/customANTHROPIC_BASE_URLendpoints. With a custom endpoint configured, only the exact 401 message triggers the login flow now; marker lists are deduplicated and URL comparisons case-normalized.Fixes #163
🤖 Generated with Claude Code