fix(coding-agent/cli): qualified model IDs to avoid cross-provider collisions

- Updated PI native streaming requests to send model identifiers as provider-qualified keys.
- Updated the auth-gateway model registry to store `${provider}/${id}` first and retain legacy bare IDs as fallback keys.
This commit is contained in:
can1357
2026-06-08 22:31:00 +02:00
parent 532e2b1b16
commit 0089811129
2 changed files with 4 additions and 3 deletions
@@ -154,7 +154,7 @@ export function streamPiNative<TApi extends Api>(
typeof options?.apiKey === "string" ? options.apiKey : undefined,
);
const body = JSON.stringify({
modelId: model.id,
modelId: `${model.provider}/${model.id}`,
context,
options: buildWireOptions(options),
stream: true,
@@ -175,8 +175,9 @@ async function runServe(flags: AuthGatewayCommandArgs["flags"]): Promise<void> {
for (const provider of getBundledProviders()) {
if (!providersWithCreds.has(provider)) continue;
for (const model of getBundledModels(provider as GeneratedProvider)) {
// First-write-wins so a canonical model id collisions across providers
// stick to the provider listed first by getBundledProviders.
// Always set the qualified key (no collision possible)
modelById.set(`${model.provider}/${model.id}`, model);
// Bare id as fallback for legacy clients (first-write-wins)
if (!modelById.has(model.id)) modelById.set(model.id, model);
}
}