fix: surface reviewer response failures
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
import type { RpcClient } from "../rpc/rpc-client.js";
|
||||
|
||||
const GENERIC_MODEL_FAILURE =
|
||||
"Model request failed. Check provider connectivity, then Resume the session.";
|
||||
const SUBSCRIPTION_MODEL_FAILURE =
|
||||
"The selected model is unavailable for the current subscription. Choose another model and start a new session.";
|
||||
|
||||
function safeModelFailure(error: unknown): string {
|
||||
const detail = typeof error === "string" ? error : "";
|
||||
const isSubscriptionFailure =
|
||||
/\b429\b/.test(detail) &&
|
||||
/(subscription plan|code["':\s]+1311|does not yet include access)/i.test(detail);
|
||||
|
||||
return isSubscriptionFailure ? SUBSCRIPTION_MODEL_FAILURE : GENERIC_MODEL_FAILURE;
|
||||
}
|
||||
|
||||
export type ToolActivity = {
|
||||
kind: "tool";
|
||||
toolCallId: string;
|
||||
@@ -53,7 +67,7 @@ export class SessionBridge {
|
||||
this.fan({
|
||||
type: "info",
|
||||
level: "error",
|
||||
text: "Model request failed. Check provider connectivity, then Resume the session.",
|
||||
text: safeModelFailure(m.message.errorMessage),
|
||||
});
|
||||
}
|
||||
} else if (m.type === "extension_ui_request" && m.method === "notify") {
|
||||
|
||||
Reference in New Issue
Block a user