Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(notifications): keep ask titles stable

vastsa2cbe71ce5274
diff --git a/apps/desktop/src/stores/runtime/notification-runtime.ts b/apps/desktop/src/stores/runtime/notification-runtime.ts
index 451bae323..8dcb77e4c 100644
--- a/apps/desktop/src/stores/runtime/notification-runtime.ts
+++ b/apps/desktop/src/stores/runtime/notification-runtime.ts
@@ -18,7 +18,9 @@ export function createInteractivePromptNotifier(
let title = "";
let body = "";
if (kind === "ask") {
- title = i18n.t("notifications.askTitle", { sessionTitle });
+ // Session titles can contain generated/tool-call text; keep the native
+ // banner title stable and let its body carry the actual question.
+ title = i18n.t("notifications.askTitle");
body = payload?.question?.trim() || i18n.t("notifications.askBodyFallback");
} else if (kind === "permission") {
title = i18n.t("notifications.permissionTitle", { sessionTitle });
diff --git a/apps/desktop/test/notification-sound.test.mjs b/apps/desktop/test/notification-sound.test.mjs
index d16592dd7..aa5119f21 100644
--- a/apps/desktop/test/notification-sound.test.mjs
+++ b/apps/desktop/test/notification-sound.test.mjs
@@ -14,6 +14,26 @@ const promptNotificationSource = await readFile(
new URL("../src/stores/runtime/notification-runtime.ts", import.meta.url),
"utf8",
);
+const englishLocaleSource = await readFile(
+ new URL("../../../packages/i18n/src/locales/en/index.ts", import.meta.url),
+ "utf8",
+);
+const chineseLocaleSource = await readFile(
+ new URL("../../../packages/i18n/src/locales/zh-CN/index.ts", import.meta.url),
+ "utf8",
+);
+const germanLocaleSource = await readFile(
+ new URL("../../../packages/i18n/src/locales/de/index.ts", import.meta.url),
+ "utf8",
+);
+const spanishLocaleSource = await readFile(
+ new URL("../../../packages/i18n/src/locales/es/index.ts", import.meta.url),
+ "utf8",
+);
+const frenchLocaleSource = await readFile(
+ new URL("../../../packages/i18n/src/locales/fr/index.ts", import.meta.url),
+ "utf8",
+);
const shellNotificationSource = await readFile(
new URL("../src/features/app/useAppShellRuntime.tsx", import.meta.url),
"utf8",
@@ -104,6 +124,21 @@ test("toast chimes only for newly visible toasts that have not opted out", () =>
assert.equal(shouldPlayToastSound({ id: 3, sound: false }, visible), false);
});
+test("ask notifications use a stable title instead of the generated session title", () => {
+ const askBranch = promptNotificationSource.match(
+ /if \(kind === "ask"\) \{([\s\S]*?)\} else if \(kind === "permission"\)/,
+ )?.[1];
+ assert.ok(askBranch, "ask notification branch exists");
+ assert.match(askBranch, /i18n\.t\("notifications\.askTitle"\)/);
+ assert.doesNotMatch(askBranch, /sessionTitle/);
+ assert.match(askBranch, /payload\?\.question/);
+ assert.match(englishLocaleSource, /askTitle: "A question needs your answer"/);
+ assert.match(chineseLocaleSource, /askTitle: "有问题需要你回答"/);
+ assert.match(germanLocaleSource, /"askTitle": "Eine Frage braucht Ihre Antwort"/);
+ assert.match(spanishLocaleSource, /"askTitle": "Hay una pregunta que requiere su respuesta"/);
+ assert.match(frenchLocaleSource, /"askTitle": "Une question attend votre réponse"/);
+});
+
test("app and plugin notification surfaces share one chime without native double-sounds", () => {
assert.match(toastSource, /shouldPlayToastSound\(toast, visibleToastIds\.current\)/);
assert.match(toastSource, /if \(shouldPlay\) playNotificationChime\(\)/);
diff --git a/docs/spec/03-runtime/17-asktool-questions.md b/docs/spec/03-runtime/17-asktool-questions.md
index f574325a7..7d266b500 100644
--- a/docs/spec/03-runtime/17-asktool-questions.md
+++ b/docs/spec/03-runtime/17-asktool-questions.md
@@ -34,10 +34,11 @@ There is no timer, countdown, or automatic expiration. The card remains pending
until the user submits or the turn is stopped. If the turn is stopped while a
card is open, the runtime resolves every remaining question as skipped.
-When an ask arrives, the app shows an in-app toast containing the session and
-first question, in addition to the existing native notification policy for
-background sessions. The ask event plays one soft in-app chime; its toast does
-not play a second one.
+When an ask arrives, the app shows an in-app toast with a stable localized
+prompt title and the first question; background sessions also follow the
+existing native notification policy. Ask titles deliberately do not interpolate
+the session title, because generated titles may contain tool-call text. The ask
+event plays one soft in-app chime; its toast does not play a second one.
## 4. Tool output
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index df404773a..14c4c56e4 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -9752,10 +9752,11 @@ This test plan spec is accepted when:
between questions, and
keeps `question:` for the skipped question, and selecting a rich option
returns only its label. Decline all produces empty placeholders for every
- question and still completes the tool call. A pending ask shows a localized
- in-app toast with its session and first question, while background sessions
- retain the existing native notification policy. Exactly one soft chime plays
- for the ask; the toast and native banner do not double it.
+ question and still completes the tool call. A pending ask shows a stable
+ localized title and the first question in its toast; generated session-title
+ text never replaces that title. Background sessions retain the existing
+ native notification policy. Exactly one soft chime plays for the ask; the
+ toast and native banner do not double it.
- **Specs linked**: `03-runtime/17-asktool-questions.md`,
`04-ux/11-asktool-question-card.md`, ADR 0077
- **Acceptance**: E (interactive tool output), C (inline card)
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 00a39b8c3..7bdae4e9a 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -2419,7 +2419,7 @@ sklm: {
"failedTitle": "{{sessionTitle}} benötigt Aufmerksamkeit",
"failedBody": "Der Chat wurde nicht erfolgreich beendet.",
"failedBodyWithCode": "Der Chat wurde mit dem Fehler {{code}} beendet.",
- "askTitle": "{{sessionTitle}} benötigt Ihre Eingabe",
+ "askTitle": "Eine Frage braucht Ihre Antwort",
"askBody": "{{question}}",
"askBodyFallback": "Die Aufgabe erfordert Ihre Antwort, um fortzufahren.",
"permissionTitle": "{{sessionTitle}} benötigt Tool-Genehmigung",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index c11cfdf46..6ccae7b15 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -2460,7 +2460,7 @@ importConfirm: "Imported extensions run inside the agent process with the same a
failedTitle: "{{sessionTitle}} needs attention",
failedBody: "The chat didn't finish successfully.",
failedBodyWithCode: "The chat stopped with error {{code}}.",
- askTitle: "{{sessionTitle}} needs your input",
+ askTitle: "A question needs your answer",
askBody: "{{question}}",
askBodyFallback: "The task requires your response to proceed.",
permissionTitle: "{{sessionTitle}} needs tool approval",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index c63e7b3f7..fac90c890 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -2419,7 +2419,7 @@ sklm: {
"failedTitle": "{{sessionTitle}} necesita atención",
"failedBody": "El chat no finalizó exitosamente.",
"failedBodyWithCode": "El chat se detuvo con el error {{code}}.",
- "askTitle": "{{sessionTitle}} necesita su respuesta",
+ "askTitle": "Hay una pregunta que requiere su respuesta",
"askBody": "{{question}}",
"askBodyFallback": "La tarea requiere su respuesta para continuar.",
"permissionTitle": "{{sessionTitle}} necesita aprobación de herramienta",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index b445386ea..bfb5fc461 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -2419,7 +2419,7 @@ sklm: {
"failedTitle": "{{sessionTitle}} a besoin d'attention",
"failedBody": "La conversation n'a pas abouti.",
"failedBodyWithCode": "Le chat s'est arrêté avec l'erreur {{code}}.",
- "askTitle": "{{sessionTitle}} a besoin de votre réponse",
+ "askTitle": "Une question attend votre réponse",
"askBody": "{{question}}",
"askBodyFallback": "La tâche nécessite votre réponse pour continuer.",
"permissionTitle": "{{sessionTitle}} nécessite une autorisation d'outil",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index 827fd49a4..8f0d6b59a 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -2455,7 +2455,7 @@ importConfirm: "가져온 확장은 에이전트 프로세스 안에서 에이
failedTitle: "{{sessionTitle}} 확인 필요",
failedBody: "채팅이 정상적으로 완료되지 않았습니다.",
failedBodyWithCode: "채팅이 오류 {{code}}과(와) 함께 중지되었습니다.",
- askTitle: "{{sessionTitle}} 입력 필요",
+ askTitle: "답변이 필요한 질문이 있습니다",
askBody: "{{question}}",
askBodyFallback: "작업을 계속하려면 응답이 필요합니다.",
permissionTitle: "{{sessionTitle}} 도구 승인 필요",
diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.ts
index 91103e0fc..74c8e485d 100644
--- a/packages/i18n/src/locales/pt-BR/index.ts
+++ b/packages/i18n/src/locales/pt-BR/index.ts
@@ -2374,7 +2374,7 @@ export const ptBR = {
failedTitle: "{{sessionTitle}} precisa de atenção",
failedBody: "A conversa não foi concluída com sucesso.",
failedBodyWithCode: "A conversa foi interrompida com o código de erro {{code}}.",
- askTitle: "{{sessionTitle}} precisa da sua resposta",
+ askTitle: "Uma pergunta precisa da sua resposta",
askBody: "{{question}}",
askBodyFallback: "A tarefa requer sua resposta para prosseguir.",
permissionTitle: "{{sessionTitle}} requer aprovação de ferramenta",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index 214acfb62..ea78cd330 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -2445,7 +2445,7 @@ importConfirm: "İçe aktarılan uzantılar ajan sürecinde, ajanın kendi araç
failedTitle: "{{sessionTitle}} ilgi bekliyor",
failedBody: "Sohbet başarıyla bitmedi.",
failedBodyWithCode: "Sohbet {{code}} hatasıyla durdu.",
- askTitle: "{{sessionTitle}} yanıtınızı bekliyor",
+ askTitle: "Bir soruyu yanıtlamanız gerekiyor",
askBody: "{{question}}",
askBodyFallback: "Görevin devam etmesi için yanıtınız gerekiyor.",
permissionTitle: "{{sessionTitle}} araç onayı bekliyor",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index 105c91fdf..ce39374c6 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -2408,7 +2408,7 @@ sklm: {
failedTitle: "{{sessionTitle}} 需要处理",
failedBody: "该对话未能顺利完成。",
failedBodyWithCode: "该对话因错误 {{code}} 停止。",
- askTitle: "{{sessionTitle}} 等待您的回答",
+ askTitle: "有问题需要你回答",
askBody: "{{question}}",
askBodyFallback: "任务需要您的回答以继续执行。",
permissionTitle: "{{sessionTitle}} 需要工具授权",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 2cffad9e1..8d6000545 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -2406,7 +2406,7 @@ sklm: {
failedTitle: "{{sessionTitle}} 需要處理",
failedBody: "該對話未能順利完成。",
failedBodyWithCode: "該對話因錯誤 {{code}} 停止。",
- askTitle: "{{sessionTitle}} 等待您的回答",
+ askTitle: "有問題需要您回答",
askBody: "{{question}}",
askBodyFallback: "任務需要您的回答以繼續執行。",
permissionTitle: "{{sessionTitle}} 需要工具授權",