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
@@ -5,7 +5,7 @@ import { readAuthFile } from '../opencode/auth.js';
|
||||
import { readConfigLayers } from '../opencode/shared.js';
|
||||
import { getModelCatalog } from './catalog.js';
|
||||
import { resolveSmallModel, parseModelRef, isUsableAuthEntry, getAuthEntryForProvider } from './resolve.js';
|
||||
import { callSmallModel } from './call.js';
|
||||
import { callSmallModel, resolveProviderLogin } from './call.js';
|
||||
|
||||
const OPENCHAMBER_SETTINGS_FILE = path.join(
|
||||
process.env.OPENCHAMBER_DATA_DIR
|
||||
@@ -252,8 +252,17 @@ export async function describeSmallModel({ directory, preferredProviderID, prefe
|
||||
outputReserveTokens: reserveTokens,
|
||||
});
|
||||
|
||||
// Settings/config/request overrides can name a provider with no usable login.
|
||||
// Report that here so readiness can refuse before the user pays for a 401.
|
||||
const hasLogin = Boolean(resolveProviderLogin({
|
||||
auth,
|
||||
workingDirectory: directory,
|
||||
providerID: resolved.providerID,
|
||||
}));
|
||||
|
||||
return {
|
||||
...resolved,
|
||||
hasLogin,
|
||||
inputCharBudget: maxChars,
|
||||
contextTokens,
|
||||
contextKnown,
|
||||
|
||||
Reference in New Issue
Block a user