Skip to content

Narrow login-error detection to avoid false login prompts on custom endpoints#206

Open
leonidasbarkas98-cpu wants to merge 3 commits into
andrepimenta:mainfrom
leonidasbarkas98-cpu:fix/login-false-positive
Open

Narrow login-error detection to avoid false login prompts on custom endpoints#206
leonidasbarkas98-cpu wants to merge 3 commits into
andrepimenta:mainfrom
leonidasbarkas98-cpu:fix/login-false-positive

Conversation

@leonidasbarkas98-cpu

Copy link
Copy Markdown

_isLoginErrorResult() matched broad substrings (e.g. '/login', 'Invalid API key') in any error text, which forced spurious login flows for users on relays/custom ANTHROPIC_BASE_URL endpoints. 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

Jonas Kunert and others added 3 commits July 22, 2026 07:17
…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>
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.

Plugin keeps asking for login on server despite valid third-party API configuration

1 participant