fix(walkthrough): block unauthenticated providers with a friendly refusal
When the walkthrough small model resolves to a provider with no usable login, readiness was still ready and generate returned a raw 500 message. Refuse up front with no-provider-login and surface a blocker instead. Closes openchamber/openchamber#2607 Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
co-authored by
Serhii Dziupin
parent
f47110c66f
commit
abb396e080
@@ -18,7 +18,13 @@ vi.mock('./catalog.js', () => ({
|
||||
getModelCatalog: vi.fn(),
|
||||
getCatalogProvider: vi.fn(),
|
||||
}));
|
||||
vi.mock('./call.js', () => ({ callSmallModel: vi.fn() }));
|
||||
vi.mock('./call.js', () => ({
|
||||
callSmallModel: vi.fn(),
|
||||
resolveProviderLogin: vi.fn(({ auth, providerID }) => {
|
||||
const entry = auth?.[providerID];
|
||||
return entry && typeof entry === 'object' ? entry : null;
|
||||
}),
|
||||
}));
|
||||
|
||||
const { generateSmallModelText, describeSmallModel } = await import('./index.js');
|
||||
const { readAuthFile } = await import('../opencode/auth.js');
|
||||
@@ -126,6 +132,19 @@ describe('describeSmallModel — capability reporting', () => {
|
||||
contextTokens: 8_000,
|
||||
contextKnown: true,
|
||||
structuredOutput: true,
|
||||
hasLogin: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('reports hasLogin false when the resolved provider has no usable credential', async () => {
|
||||
readAuthFile.mockReturnValue({});
|
||||
|
||||
const described = await describeSmallModel({ directory: '/proj' });
|
||||
|
||||
expect(described).toMatchObject({
|
||||
providerID: 'anthropic',
|
||||
modelID: 'claude-haiku-4-5',
|
||||
hasLogin: false,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user