Skip to content

The agent that grows with you

merge main in

rob-maron83c5737be273
diff --cc apps/desktop/src/i18n/ar_assistant.ts
index 73c3cd6d4c9,08899b17d10..7fe9b0e76e0
--- a/apps/desktop/src/i18n/ar_assistant.ts
+++ b/apps/desktop/src/i18n/ar_assistant.ts
@@@ -62,13 -56,13 +56,23 @@@ export const arAssistant =
runtime: 'خطأ في بيئة التشغيل المحلية',
streaming: 'خطأ في اتصال البث'
},
+ errorCodes: {
+ cron_session_read_only: {
+ title: 'هذه المحادثة تابعة لمهمة مجدولة',
+ body: 'إنها تشغّل تلك المهمة فقط، لذا لم تُنفَّذ رسالتك. ابدأ محادثة جديدة لإرسالها.'
++ },
++ usage_window: {
++ title: 'نفد الاستخدام المضمّن',
++ body: 'نفد الاستخدام المضمّن في خطتك حتى إعادة التعيين. أضف رصيدًا عبر /topup للمتابعة.'
+ }
+ },
errorRetry: 'إعادة المحاولة',
+ errorSwitchToModel: (model, note) => (note ? `التبديل إلى ${model} (${note})` : `التبديل إلى ${model}`),
+ errorSwitchModelFailed: 'تعذر تبديل النموذج',
+ errorUseCredits: 'استخدام الرصيد',
+ errorUseCreditsFailed: 'تعذر تفعيل الاستمرار بالرصيد',
+ errorAddCredits: 'إضافة رصيد',
+ errorOpenBillingSettings: 'فتح إعدادات الفوترة',
errorLimitResets: time => `يُعاد ضبط الحد عند ${time}`,
errorRetryAtReset: time => `إعادة المحاولة عند إعادة ضبط الحد (${time})`,
errorRetryScheduled: (time, wait) => `ستتم إعادة المحاولة عند ${time} — بعد ${wait}`,
diff --cc apps/desktop/src/i18n/ja.ts
index 30de7e2d883,fe58a7c477a..1aca79b5e95
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@@ -3434,9 -3368,9 +3416,13 @@@ export const jaOverrides =
body: provider =>
`Hermes は ${provider} との安全な接続を検証できませんでした。ネットワークやプロキシの設定を確認するか、プロバイダーを切り替えて再送してください。`
},
+ cron_session_read_only: {
+ title: 'このチャットはスケジュールされたジョブ用です',
+ body: 'このチャットはそのジョブの実行専用のため、メッセージは実行されませんでした。送信するには新しいチャットを開始してください。'
++ },
+ usage_window: {
+ title: '含まれる利用量を使い切りました',
+ body: 'プランに含まれる利用量はリセットまで使い切りました。続けるには /topup でクレジットを追加してください。'
}
},
errorLayers: {
diff --cc apps/desktop/src/i18n/ru.ts
index de93b0391d5,6287a50b334..c0eccbc40f4
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@@ -3634,19 -3564,6 +3618,13 @@@ export const ruOverrides =
},
assistant: {
thread: {
- errorCodes: {
- usage_window: {
- title: 'Включённый объём исчерпан',
- body: 'Включённый объём вашего плана исчерпан до сброса. Пополните кредиты в /topup, чтобы продолжить.'
- }
- },
+ errorSwitchToModel: (model: string, note?: string) =>
+ note ? `Переключиться на ${model} (${note})` : `Переключиться на ${model}`,
+ errorSwitchModelFailed: 'Не удалось переключить модель',
+ errorUseCredits: 'Использовать кредиты',
+ errorUseCreditsFailed: 'Не удалось включить «Продолжать за кредиты»',
+ errorAddCredits: 'Пополнить кредиты',
+ errorOpenBillingSettings: 'Открыть настройки оплаты',
loadingSession: 'Загрузка сеанса',
showEarlier: 'Показать ранние сообщения',
loadingResponse: 'Hermes загружает ответ',
@@@ -3667,6 -3584,12 +3645,16 @@@
branchNewChat: 'Ветка в новый чат',
react: 'Реакция',
dismissError: 'Скрыть ошибку',
+ errorCodes: {
+ cron_session_read_only: {
+ title: 'Этот чат относится к запланированной задаче',
+ body: 'Он только выполняет эту задачу, поэтому ваше сообщение не было выполнено. Начните новый чат, чтобы отправить его.'
++ },
++ usage_window: {
++ title: 'Включённый объём исчерпан',
++ body: 'Включённый объём вашего плана исчерпан до сброса. Пополните кредиты в /topup, чтобы продолжить.'
+ }
+ },
filesChanged: count => `${count} ${RU_PLURAL(count, 'файл изменён', 'файла изменено', 'файлов изменено')}`,
reviewChanges: 'Проверить',
readAloudFailed: 'Не удалось зачитать вслух',
diff --cc apps/desktop/src/i18n/zh-hant_assistant.ts
index c68a41b75b7,8384fce5f7b..b4d246b1f28
--- a/apps/desktop/src/i18n/zh-hant_assistant.ts
+++ b/apps/desktop/src/i18n/zh-hant_assistant.ts
@@@ -97,9 -97,9 +97,13 @@@ export const zhHantAssistant =
title: '安全連線失敗',
body: provider => `Hermes 無法驗證與 ${provider} 的安全連線。請檢查網路或代理設定,或切換服務商後重新傳送。`
},
+ cron_session_read_only: {
+ title: '此聊天屬於一個排程工作',
+ body: '它只會執行該工作,因此你的訊息未被執行。請開始新的聊天後再傳送。'
++ },
+ usage_window: {
+ title: '包含用量已用完',
+ body: '你的方案包含的用量已用完,將在重設後恢復。在 /topup 中新增額度即可繼續。'
}
},
errorLayers: {
diff --cc apps/desktop/src/i18n/zh.ts
index 475ed640f1c,a24b0587a39..805a36b52ed
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@@ -4449,9 -4387,9 +4428,13 @@@ export const zhOverrides =
title: '安全连接失败',
body: provider => `Hermes 无法验证与 ${provider} 的安全连接。请检查网络或代理设置,或切换服务商后重新发送。`
},
+ cron_session_read_only: {
+ title: '此聊天属于一个定时任务',
+ body: '它只运行该任务,因此你的消息未被执行。请新建聊天后再发送。'
++ },
+ usage_window: {
+ title: '包含用量已用完',
+ body: '你的方案包含的用量已用完,将在重置后恢复。在 /topup 中添加额度即可继续。'
}
},
errorLayers: {
diff --cc apps/desktop/src/lib/error-surface.test.ts
index dce3b0d43a6,25bfeef53c0..04676290376
--- a/apps/desktop/src/lib/error-surface.test.ts
+++ b/apps/desktop/src/lib/error-surface.test.ts
@@@ -188,82 -195,15 +195,91 @@@ describe('free-tier refusals', () =>
})
})
+ describe('cron session read-only (#141348)', () => {
+ it('renders its own copy and offers a new chat instead of Retry', () => {
+ const surface = parseErrorSurface({ layer: 'gateway', code: 'cron_session_read_only', retryable: false })
+
+ expect(errorCardText(en.assistant.thread, surface)).toEqual(en.assistant.thread.errorCodes.cron_session_read_only)
+ expect(errorRecoveryPlan(surface)).toMatchObject({ retry: false, startNewSession: true })
+ })
+ })
+
+describe('usage-window refusal', () => {
+ it('shows the stop-line sentence, not the out-of-credits copy', () => {
+ const message = "You've hit your daily limit · resets 15:56 · turn on Keep going in /topup"
+ const surface = parseErrorSurface({ code: 'usage_window', layer: 'billing', message, retryable: false })!
+ const { body, title } = errorCardText(en.assistant.thread, surface)
+ expect(title).toBe(en.assistant.thread.errorCodes.usage_window.title)
+ expect(body).toBe(message)
+ const plain = parseErrorSurface({ code: 'billing', layer: 'billing', provider: 'nous', retryable: false })!
+ expect(body).not.toBe(errorCardText(en.assistant.thread, plain).body)
+ })
+
+ it('an older backend (no structured limit): Open billing, Retry and the model menu; no diagnostics', () => {
+ const surface = parseErrorSurface({
+ code: 'usage_window',
+ layer: 'billing',
+ resets_at: 1_800_000_000,
+ retryable: true
+ })!
+
+ const plan = errorRecoveryPlan(surface)
+ expect(plan.openBilling && plan.retry && plan.switchProvider).toBe(true)
+ expect(plan.switchToModel || plan.useCredits).toBe(false)
+ expect(plan.diagnostics).toBe(false)
+ expect(surface.resetsAt).toBe(1_800_000_000)
+ // Every other billing failure keeps today's card.
+ const plain = errorRecoveryPlan(parseErrorSurface({ code: 'billing', layer: 'billing', retryable: false }))
+ expect(plain.openBilling).toBe(false)
+ expect(plain.diagnostics).toBe(true)
+ })
+
+ it('with a structured limit: one-click Switch to <model> and Use credits, no provider menu', () => {
+ const surface = parseErrorSurface({
+ code: 'usage_window',
+ layer: 'billing',
+ retryable: true,
+ usage_limit: {
+ credits: { action: 'use_credits' },
+ suggestions: [
+ { label: 'Model A', model: 'example/model-a', note: 'included', provider: 'nous' },
+ { model: 'bad' },
+ { label: 'x' }
+ ]
+ }
+ })!
+
+ expect(surface.usageLimit).toEqual({
+ credits: 'use_credits',
+ suggestions: [
+ { label: 'Model A', model: 'example/model-a', note: 'included', provider: 'nous' },
+ { label: 'bad', model: 'bad', note: '', provider: 'nous' }
+ ]
+ })
+ const plan = errorRecoveryPlan(surface)
+ expect(plan.switchToModel && plan.useCredits && plan.retry).toBe(true)
+ expect(plan.openBilling || plan.switchProvider || plan.diagnostics).toBe(false)
+
+ // No balance: Add credits (Billing) instead of Use credits.
+ const add = errorRecoveryPlan(
+ parseErrorSurface({
+ code: 'usage_window',
+ layer: 'billing',
+ retryable: true,
+ usage_limit: { credits: { action: 'add_credits' }, suggestions: [] }
+ })
+ )
+
+ expect(add.openBilling).toBe(true)
+ expect(add.useCredits || add.switchToModel || add.switchProvider).toBe(false)
+ })
+
+ it('falls back to its own table body when an older backend sent no sentence', () => {
+ const bare = parseErrorSurface({ code: 'usage_window', layer: 'billing', retryable: false })!
+ expect(errorCardText(en.assistant.thread, bare).body).toBe(en.assistant.thread.errorCodes.usage_window.body)
+ })
+})
+
describe('limit reset (#98852)', () => {
it('parses resets_at and renders "HH:mm (in Nh MMm)" while the reset is ahead', () => {
const now = Date.UTC(2026, 0, 1, 12, 0, 0)