fix(gateway): reject 'list' and 'status' as invalid model refs (#51126)
When sessions.patch receives model='list' or model='status' from Control UI, it now returns a clear error message instead of failing with a confusing 'model not allowed: openai-codex/list' error. These are chat command aliases, not model identifiers. Fixes #51126
This commit is contained in:
parent
b5a9b99299
commit
71851ff56e
@ -273,6 +273,21 @@ describe("gateway sessions patch", () => {
|
||||
expect(entry.modelOverride).toBe("claude-sonnet-4-6");
|
||||
});
|
||||
|
||||
test.each([
|
||||
{ name: "list", model: "list" },
|
||||
{ name: "LIST (uppercase)", model: "LIST" },
|
||||
{ name: "List (mixed case)", model: "List" },
|
||||
{ name: "status", model: "status" },
|
||||
{ name: "STATUS (uppercase)", model: "STATUS" },
|
||||
{ name: "Status (mixed case)", model: "Status" },
|
||||
])("rejects model command alias '$name' as invalid model", async ({ model }) => {
|
||||
const result = await runPatch({
|
||||
patch: { key: MAIN_SESSION_KEY, model },
|
||||
});
|
||||
expectPatchError(result, `invalid model`);
|
||||
expectPatchError(result, `command alias`);
|
||||
});
|
||||
|
||||
test("sets spawnDepth for subagent sessions", async () => {
|
||||
const entry = expectPatchOk(
|
||||
await runPatch({
|
||||
|
||||
@ -389,6 +389,11 @@ export async function applySessionsPatchToStore(params: {
|
||||
if (!trimmed) {
|
||||
return invalid("invalid model: empty");
|
||||
}
|
||||
if (trimmed.toLowerCase() === "list" || trimmed.toLowerCase() === "status") {
|
||||
return invalid(
|
||||
`invalid model: "${trimmed}" is a command alias, not a model. Use /models list or /model status in chat instead.`,
|
||||
);
|
||||
}
|
||||
if (!params.loadGatewayModelCatalog) {
|
||||
return {
|
||||
ok: false,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user