ux(redstone): surface AI provider failure instead of silent drop
When both OpenRouter AND Gemini return null (no key / 429 / 503 / network) and no tool ran during the turn, the handler used to silently return, leaving the user staring at their unanswered message wondering if the bot was broken. Real cause is usually the daily free-tier rate-limit exhausting + Gemini's intermittent 503s lining up. Now post a one-liner reply explaining: "🤖 AI is unreachable right now — both OpenRouter and Gemini just declined. Usually the free-tier daily cap resetting around UTC midnight. Try again in a few minutes, or use /model to pick a different model." Only fires when ranTool is false — if the model successfully called a tool earlier in the turn (image already sent, message posted, etc.) the user has already seen something visible and we keep the silent return for that case. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
16
bot/bot.ts
16
bot/bot.ts
@@ -1653,7 +1653,21 @@ bot.on("message:text", async (ctx) => {
|
||||
}
|
||||
|
||||
if (!reply) {
|
||||
if (!ranTool) console.warn("redstone: no reply and no tool ran for", { chatId, text: text.slice(0, 80) });
|
||||
if (!ranTool) {
|
||||
// Both providers returned null AND nothing useful happened during the
|
||||
// turn — surface that to the user instead of silently dropping the
|
||||
// message. Usually means OpenRouter hit its free-tier rate limit and
|
||||
// Gemini is also down/throttled; tell them what to do.
|
||||
console.warn("redstone: no reply and no tool ran for", { chatId, text: text.slice(0, 80) });
|
||||
try {
|
||||
await ctx.reply(
|
||||
"🤖 AI is unreachable right now — both OpenRouter and Gemini just declined. "
|
||||
+ "Usually the free-tier daily cap resetting around UTC midnight. Try again in a few minutes, "
|
||||
+ "or use <code>/model</code> to pick a different model.",
|
||||
{ parse_mode: "HTML", reply_parameters: { message_id: ctx.message.message_id } },
|
||||
);
|
||||
} catch { /* if even the error reply fails, nothing more we can do */ }
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user