fix(coding-agent): serve catalogs without version redirect (#11690)

Update the model catalog protocol to pi.dev after a change to stop
pi.dev redirecting released clients to `?pi-version=` URLs and serve
their catalog directly. The released CLI is unaffected.
This commit is contained in:
Vegard Stikbakke 2026-11-02 14:42:17 +01:00 • committed by GitHub
parent 9823079ad9
commit 62752fd4c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 18 deletions

View file

@ -55,25 +55,23 @@ test("selects the newest catalog a Pi version supports", () => {
assert.equal(selectModelCatalog(index, undefined)?.revision, mixedApiRevision);
});
test("redirects Pi user agents to an explicit catalog version", () => {
test("serves Pi user agents the catalog for their version", () => {
// Regression test for #9099: released clients identify themselves only by User-Agent.
assert.deepEqual(
parseModelCatalogRequest(
"https://pi.dev/api/models/providers/openrouter?types=chat%2Cimage",
"pi/0.84.4 (linux; node/v22.0.0; x64)",
),
{
kind: "redirect",
location: "https://pi.dev/api/models/providers/openrouter?types=chat%2Cimage&pi-version=0.84.4",
},
{ kind: "catalog", piVersion: "0.84.4", representation: "typed" },
);
assert.deepEqual(parseModelCatalogRequest("https://pi.dev/api/models", "pi/0.84.4"), {
kind: "redirect",
location: "https://pi.dev/api/models?pi-version=0.84.4",
kind: "catalog",
piVersion: "0.84.4",
representation: "legacy",
});
});
test("serves explicit and unversioned catalog requests without redirecting", () => {
test("serves explicit and unversioned catalog requests", () => {
assert.deepEqual(
parseModelCatalogRequest("https://pi.dev/api/models?pi-version=0.83.0", "pi/0.85.1 (linux; node/v22.0.0; x64)"),
{ kind: "catalog", piVersion: "0.83.0", representation: "legacy" },