Repository navigation
fix(cli): keys add treats a provider name as a provider, not a URL (#142) - #155
Merged
Merged
Conversation
) `openscience keys add deepseek` crashed with "fetch() URL is invalid": the `add [url]` positional was passed straight to `fetch(`${url}/.well-known/openscience`)`, so a bare provider name became `fetch("deepseek/.well-known/openscience")`. Classify the positional (new pure `classifyKeyTarget` helper): - an http(s) URL is a custom endpoint → the well-known auth flow (unchanged) - a bare provider id (a-z0-9-, optional `@ai-sdk/` prefix) preselects that provider and skips the picker, so `keys add deepseek` goes straight to the key prompt and stores a BYOK credential - anything else falls through to the interactive picker with a clear note, instead of crashing Unknown-but-valid ids still store the key with a hint to finish wiring the provider in openscience.json. Adds unit tests for the classifier, including the exact `deepseek/deepseek-v4-pro` shape from the report.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Jul 8, 2026
pull Bot
pushed a commit
to vincentke1117/openscience
that referenced
this pull request
Jul 11, 2026
…etic-sciences#159, synthetic-sciences#142) The dashboard-synced config (default model, OpenRouter managed catalog) was merged ON TOP of the user's own config, so a user's chosen default model and custom OpenRouter models were reverted on every sync — the 'changes reverted on every sync' in synthetic-sciences#159/synthetic-sciences#142. Synced config is a server recommendation, not a lockdown (enterprise lockdown is the /etc managed layer, which still merges last and wins). Flip the merge so the user's config overrides synced while model records still union (server-whitelisted models the user didn't declare stay available). Combined with the existing enabled_providers scoping, custom BYOK providers and models added to openscience.json now persist. Note: openscience-synced.json is sync-owned and rewritten each sync — user edits belong in openscience.json. The 'keys add' crash was fixed separately in synthetic-sciences#155.
This branch was successfully deployed
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.
Addresses the CLI crash in #142.
Problem
openscience keys add deepseekcrashes:The
add [url]positional was passed straight tofetch(\${url}/.well-known/openscience`), so a bare provider name becamefetch("deepseek/.well-known/openscience")` — an invalid URL.Fix
A new pure helper
classifyKeyTarget(arg)classifies the positional:/.well-known/openscience(the existing flow, unchanged)a-z0-9-, optional@ai-sdk/prefix stripped) → preselects that provider and skips the picker, sokeys add deepseekgoes straight to the API-key prompt and stores a BYOK credentialdeepseek/deepseek-v4-pro, spaces, other schemes) → falls through to the interactive picker with a clear note, instead of crashingAn unknown-but-valid provider id still stores the key, with a hint to finish wiring the provider in
openscience.json.Tests
Unit tests for the classifier, including the exact
deepseek/deepseek-v4-proshape from the report. Typecheck clean.Scope note
This covers the CLI crash (path 2 in #142). The "manual config reverted on sync" part (path 1) is a separate concern in the sync/precedence layer — I'm tracking it separately and did not fold it in here. Supersedes #143, which stopped the crash but then ignored the provider name.