fix(quick-pane): restore model catalog controls

This commit is contained in:
2026-08-25 22:34:58 +02:00
parent ab482d3daa
commit 1b0b34fad8
10 changed files with 706 additions and 170 deletions
+54
View File
@@ -78,6 +78,60 @@ test("starts only the home agent and creates other worktree agents on explicit s
assert.ok(fixture.calls.every(({ adapter }) => adapter.stopped));
});
test("model catalog retries unsuccessful responses and falls back to last success", async () => {
const worktrees = await createWorktrees();
const fixture = createAdapterFactory();
const registry = createAgentRegistry({
homeWorktree: worktrees.home,
sessionRoot: worktrees.sessionRoot,
startAdapter: fixture.startAdapter,
});
await registry.start();
await registry.selectWorktree(worktrees.feature);
const expected = [{ provider: "provider", id: "family/model" }];
const rejected = [{ provider: "wrong", id: "must-not-be-cached" }];
const sends = fixture.calls.map(({ adapter }) => adapter.send.bind(adapter));
let homeCatalogCalls = 0;
let featureCatalogCalls = 0;
fixture.calls[0].adapter.send = async (command, options) => {
if (command.type === "get_available_models") {
homeCatalogCalls += 1;
return {
type: "response",
success: false,
data: { models: rejected },
};
}
return sends[0](command, options);
};
fixture.calls[1].adapter.send = async (command, options) => {
if (command.type === "get_available_models") {
featureCatalogCalls += 1;
return { type: "response", success: true, data: { models: expected } };
}
return sends[1](command, options);
};
assert.deepEqual(await registry.getModelCatalog(), expected);
assert.equal(homeCatalogCalls, 1);
assert.equal(featureCatalogCalls, 1);
fixture.calls[1].adapter.send = async (command, options) => {
if (command.type === "get_available_models") {
featureCatalogCalls += 1;
return {
type: "response",
success: true,
data: { models: "malformed" },
};
}
return sends[1](command, options);
};
assert.deepEqual(await registry.getModelCatalog(), expected);
assert.equal(homeCatalogCalls, 2);
assert.equal(featureCatalogCalls, 2);
await registry.stop();
});
test("sends abort without waiting behind a blocked prompt", async () => {
const worktrees = await createWorktrees();
const fixture = createAdapterFactory();