Fix Claude 5 context window selection (#2433)

* fix(claude): select the correct Opus 5 context window

Bare Opus 5 IDs resolve to 200K behind third-party gateways. Expose explicit context variants and require a Claude Code version that recognizes the model.

* fix(claude): add Fable and Sonnet context variants

* test(cli): expect Claude context variants

* test(cli): compose Claude catalog expectations

* fix(claude): preserve catalog on version probe failure

* fix(claude): preserve parsed context variants

* chore(release): cut 0.2.2
This commit is contained in:
Mohamed Boudra
2026-07-26 10:03:44 +02:00
committed by GitHub
parent 51ab86bab6
commit c9fb31f709
19 changed files with 371 additions and 125 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/cli",
"version": "0.2.1",
"version": "0.2.2",
"description": "Paseo CLI - control your AI coding agents from the command line",
"bin": {
"paseo": "bin/paseo"
@@ -28,9 +28,9 @@
},
"dependencies": {
"@clack/prompts": "^1.0.0",
"@getpaseo/client": "0.2.1",
"@getpaseo/protocol": "0.2.1",
"@getpaseo/server": "0.2.1",
"@getpaseo/client": "0.2.2",
"@getpaseo/protocol": "0.2.2",
"@getpaseo/server": "0.2.2",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
+37 -5
View File
@@ -107,6 +107,38 @@ const EXPECTED_CLAUDE_MODELS = [
},
] as const;
const EXPECTED_CLAUDE_CONTEXT_MODELS = [
{
id: "claude-opus-5[1m]",
model: "Opus 5 1M",
descriptionFragment: "1M context window",
},
{
id: "claude-opus-5",
model: "Opus 5",
descriptionFragment: "200K context window",
},
{
id: "claude-fable-5[1m]",
model: "Fable 5 1M",
descriptionFragment: "1M context window",
},
{
id: "claude-sonnet-5[1m]",
model: "Sonnet 5 1M",
descriptionFragment: "1M context window",
},
] as const;
const EXPECTED_CLAUDE_CATALOG_MODELS = [
...new Map(
[...EXPECTED_CLAUDE_MODELS, ...EXPECTED_CLAUDE_CONTEXT_MODELS].map((model) => [
model.id,
model,
]),
).values(),
];
let claudeModelIdsFromJson: string[] = [];
let claudeModelsFromJson: ProviderModel[] = [];
@@ -139,18 +171,18 @@ async function runProviderModelsJson(provider: string): Promise<ProviderModel[]>
function assertClaudeModels(data: ProviderModel[]): void {
assert.strictEqual(
data.length,
EXPECTED_CLAUDE_MODELS.length,
EXPECTED_CLAUDE_CATALOG_MODELS.length,
"claude output should match the current catalog size",
);
const byId = new Map(data.map((model) => [model.id, model]));
const ids = [...byId.keys()].sort();
const expectedIds = EXPECTED_CLAUDE_MODELS.map((model) => model.id).sort();
const expectedIds = EXPECTED_CLAUDE_CATALOG_MODELS.map((model) => model.id).sort();
assert.strictEqual(byId.size, data.length, "claude model IDs should be unique");
assert.deepStrictEqual(ids, expectedIds, "claude IDs should match the current catalog");
for (const expectedModel of EXPECTED_CLAUDE_MODELS) {
for (const expectedModel of EXPECTED_CLAUDE_CATALOG_MODELS) {
const actualModel = byId.get(expectedModel.id);
assert(actualModel, `claude output should include ${expectedModel.id}`);
assert.strictEqual(
@@ -388,7 +420,7 @@ try {
const lines = result.stdout.trim().split("\n").filter(Boolean);
assert.strictEqual(
lines.length,
EXPECTED_CLAUDE_MODELS.length,
EXPECTED_CLAUDE_CATALOG_MODELS.length,
"should have one line per Claude catalog model",
);
assert.deepStrictEqual(
@@ -398,7 +430,7 @@ try {
);
assert.deepStrictEqual(
[...lines].sort(),
EXPECTED_CLAUDE_MODELS.map((model) => model.id).sort(),
EXPECTED_CLAUDE_CATALOG_MODELS.map((model) => model.id).sort(),
"--quiet should print the current Claude catalog IDs",
);
assert(