fix(model): add aq alias for amazon-q provider so parseModel resolves it instead of falling back to OpenAI (#9550)

This commit is contained in:
diegosouzapw
2026-08-06 20:59:02 -03:00
parent 5f471181fa
commit 1fa5cbcdb5
3 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1 @@
- fix(model): add "aq" alias for amazon-q provider so parseModel resolves it instead of falling back to OpenAI (#9550)

View File

@@ -54,6 +54,10 @@ ALIAS_TO_PROVIDER_ID["xiaomi"] = "xiaomi-mimo";
ALIAS_TO_PROVIDER_ID["llamacpp"] = "llama-cpp";
// agy/ is the short alias for antigravity provider.
ALIAS_TO_PROVIDER_ID["agy"] = "antigravity";
// aq/ is the user-visible prefix for the Amazon Q (AWS Builder ID) provider.
// The canonical provider ID is "amazon-q". Register it so parseModel("aq/<model>")
// resolves provider = "amazon-q" instead of falling through to the identity fallback.
ALIAS_TO_PROVIDER_ID["aq"] = "amazon-q";
// Provider-scoped legacy model aliases. Used to normalize provider/model inputs
// and keep backward compatibility when upstream IDs change.

View File

@@ -0,0 +1,39 @@
// repro-9550-amazon-q-alias-resolution.test.ts
// Issue #9550: amazon-q provider silently falls back to OpenAI's endpoint
// because the "aq" alias is never resolved to "amazon-q".
import { describe, it } from "node:test";
import { strict as assert } from "node:assert";
import { resolveProviderAlias, parseModel } from "../../open-sse/services/model.ts";
import { getExecutor } from "../../open-sse/executors/index.ts";
describe("Issue #9550 - amazon-q alias resolution", () => {
it("resolveProviderAlias('aq') should return 'amazon-q'", () => {
const provider = resolveProviderAlias("aq");
assert.equal(
provider,
"amazon-q",
`Expected "amazon-q" but got "${provider}" — ALIAS_TO_PROVIDER_ID["aq"] is missing`
);
});
it('parseModel("aq/amazon-q") should resolve provider to "amazon-q"', () => {
const parsed = parseModel("aq/amazon-q");
assert.equal(
parsed.provider,
"amazon-q",
`parseModel("aq/amazon-q") provider should be "amazon-q" but got "${parsed.provider}"`
);
assert.equal(parsed.model, "amazon-q");
});
it('getExecutor("amazon-q") should exist and be a KiroExecutor', () => {
const executor = getExecutor("amazon-q");
assert.ok(executor, "getExecutor('amazon-q') should return an executor");
assert.equal(
executor.constructor.name,
"KiroExecutor",
"amazon-q executor should be a KiroExecutor"
);
});
});