Fetch live TensorX catalog via refreshModels using the /login key - #1
Open
Marcuss2 wants to merge 1 commit into
Open
Fetch live TensorX catalog via refreshModels using the /login key#1Marcuss2 wants to merge 1 commit into
Marcuss2 wants to merge 1 commit into
Conversation
The provider previously only fetched GET /v1/model/info when TENSORX_API_KEY was set in the environment, otherwise it relied on a bundled snapshot. pi does not expose the /login-stored key directly, so /login-authenticated users were stuck with the snapshot. When TensorX retired deepseek-v4-flash (renamed to deepseek-v4-flash-0731) and dropped several models, pi requested a retired id and TensorX returned 403 permission_error. Register a refreshModels callback instead: pi invokes it on model refresh and passes the effective credential (the /login-stored key, falling back to TENSORX_API_KEY), so the live catalog is always fetched with an authenticated key. The bundled snapshot now only serves as the initial/offline catalog so the provider still appears under /login pre-auth, and as a fallback if the fetch fails. The snapshot is regenerated from the live endpoint, dropping retired models like deepseek-v4-flash. refreshModels requires pi >= 0.81.0 (was "*"), so the peer dependency is tightened and the dev dependency is bumped; this also re-resolves the lockfile.
Marcuss2
force-pushed
the
fix/stale-fallback-catalog
branch
from
August 8, 2026 16:56
72025a2 to
3733828
Compare
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.
Problem
The tensorx provider 403s with TensorX's
permission_error:The key is fine — TensorX retired
deepseek-v4-flash(renamed todeepseek-v4-flash-0731) and dropped several models. The extension only fetched the live/v1/model/infocatalog whenTENSORX_API_KEYwas set in the environment; otherwise it registered a bundled snapshot. Because/login-stored keys are not handed to the extension factory,/login-authenticated users always got the snapshot — so once the snapshot aged, pi requested a retired id and TensorX rejected it.Fix
Register a
refreshModelscallback instead of a factory-time env-only fetch. pi invokesrefreshModelsduring model refresh and passes the effective credential — the/login-stored API key, falling back toTENSORX_API_KEY. The extension uses it to fetch the live catalog fromGET /v1/model/infoevery refresh, so/loginusers always get current models with no snapshot maintenance.The bundled snapshot is retained only as the initial/offline catalog (so TensorX still appears under
/login→ API Keys before a key is stored) and as a failure fallback. It's regenerated from the live endpoint (removesdeepseek-v4-flash,-backup,deepseek-chat-v3*,meta-llama/*,gpt-oss-*,nemotron-*, GLM-4.x, etc.; addsdeepseek-v4-flash-0731,kimi-k3).Because
refreshModelsrequires pi>= 0.81.0(existingpeerDependencieswas"*"), the peer + dev ranges are bumped and the lockfile re-resolved so CI typecheck passes.Verification
tsc --noEmitpasses against@earendil-works/pi-coding-agent@0.83.0(the versionrefreshModelswas introduced) and latest.refreshModelswith a credential present; the/login-keyed fetch resolves the current catalog includingdeepseek-v4-flash-0731.GET /v1/model/infowith the key returns the new model set; chat completions todeepseek-v4-flash-0731return 200 while the retired id returns 403.