Repository navigation
fix(discovery): read the plane from the path, in both endpoint families - #100
Merged
Merged
Conversation
release-please resolves a MERGE COMMIT to the pull request's title, so under a merge-commit history every pull request appears in `CHANGELOG.md` once for its title and once for each commit inside it. The 1.4.0 notes listed nine entries for four changes, and a reader cannot tell a real second change from a repeated one. A squashed commit carries the pull request's title and nothing else, so each change is exactly one line — and the title is then the release signal, which is why it must be a Conventional Commit.
**The Go plane's model list was answered with the Zen catalog.** Three places
ask which plane a URL belongs to, and they had three answers, because the newer
`inference` family was added to each of them separately and each addition was
partial:
| path | the old substring checks said | is |
| :-- | :-- | :-- |
| `/inference/go/openai/v1` | zen (two of the three knew only `/zen/go`) | go |
| `/inference/google/v1beta` | **go** (`/inference/go` is a PREFIX of it) | **zen** |
| `/inference/openai/v1` | unknown (`/inference/v1` is not inside it) | zen |
The first row is the reported symptom. The Go plane's base is the `inference`
family now, and the adapter lists its models at `${base}/models` — a path the
gateway does not serve, so the answer comes from this plugin's enrichment. That
enrichment asks which plane the listing is on, read by substring, and it read
the modern Go path as the Zen plane. The Go plane was therefore answered with
the Zen catalog: every Zen model, and none of the Go plane's own — the Gemini
contributor and the Muse contributor, both of which the deployment declares.
Measured against the real gateway, through the patched fetch:
| listing | before | after |
| :-- | :-- | :-- |
| `…/zen/go/v1/models` | 36 Go models | 36 Go models |
| `…/inference/go/openai/v1/models` | **82 Zen models** | **28 Go models** |
The second row is a credential filed under the wrong account: the Zen google
family's captured key was filed as a Go key, and used as one. The third is a
credential filed under no account at all, which is the "my key is invalid"
report on a key that was fine — the same report this plugin has already been
asked about once.
**One predicate answers it now**, in `src/utils/request-shape.ts`, and the
three call sites use it: `isGoModelsListingUrl`, `resolveDiscoveryProvider`
and `tierForRequest`. The segment boundary is load-bearing — `/inference/go`
must END there, or the Zen google family is read as the Go plane.
A relative path answers too (`/zen/go/v1/models`), because a caller with no
origin passes a path and the plane is a property of the path; a string that is
neither a URL nor a path is still not guessed at.
**The Go plane's other traffic is unaffected**, and measured: the gateway
serves `/inference/go/openai/v1/chat/completions` (200, a real completion),
`/inference/go/google/v1beta/…:generateContent` (200, a real completion) and
`/zen/go/v1/usage` (200, the quota panel's endpoint, which stays on the older
family because there is no `/inference/…/usage` counterpart). The three
planted violations of the old behaviour each fail the new tests.
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.
The Go plane's model list was being answered with the Zen catalog. Three places ask which plane a URL belongs to, and they had three answers — because the newer
inferenceendpoint family was added to each of them separately, and each addition was partial./inference/go/openai/v1/zen/go)/inference/google/v1beta/inference/gois a prefix of it)/inference/openai/v1/inference/v1is not inside it)The first row is the reported symptom
The Go plane's base is the
inferencefamily now, and the adapter lists its models at${base}/models— a path the gateway does not serve, so the answer comes from this plugin's enrichment. That enrichment asks which plane the listing is on, read by substring, and it read the modern Go path as the Zen plane.So the Go plane was answered with the Zen catalog: every Zen model, and none of the Go plane's own — the Gemini contributor and the Muse contributor, both of which the deployment declares.
Measured against the real gateway, through the patched fetch:
…/zen/go/v1/models…/inference/go/openai/v1/modelsThe other two rows are credentials filed under the wrong account
The fix
One predicate answers it now, in
src/utils/request-shape.ts, and the three call sites use it:isGoModelsListingUrl,resolveDiscoveryProviderandtierForRequest.The segment boundary is load-bearing —
/inference/gomust end there, or the Zen google family is read as the Go plane. A relative path answers too (/zen/go/v1/models), because a caller with no origin passes a path and the plane is a property of the path; a string that is neither a URL nor a path is still not guessed at.The Go plane's other traffic is unaffected — and measured
POST …/inference/go/openai/v1/chat/completionsPOST …/inference/go/google/v1beta/…:generateContentGET …/zen/go/v1/usageThe usage endpoint stays on the older family on purpose: the vendor's inference proxy has no
/inference/…/usagecounterpart, which is whytoGoBaseURLrewrites an inference-family base tohttps://opencode.ai/zen/go/v1.Verification
vp checkscripts/check.tsEach of the three old behaviours was planted back and watched fail the new tests — the listing predicate (
expected false to be true: the Go-only Gemini model missing), the tier classifier, and the path predicate.Also in this branch
AGENTS.mdrecords the merge policy: squash, so one pull request is one commit onmain, one line in the changelog, and the pull request's title is the release signal.