Compare commits

...
Author SHA1 Message Date
paseo-bot[bot]andtieo c04f19e257 fix(app): explain interrupted message sends
Show that delivery is unconfirmed when the host connection drops during submission. A missing response does not establish whether the host received the prompt.

Co-authored-by: tieo <65707274+tieo@users.noreply.github.com>
2026-12-05 11:37:50 +00:00
11 changed files with 59 additions and 5 deletions
+34
View File
@@ -1,3 +1,4 @@
import { DaemonConnectionError } from "@getpaseo/client/internal/daemon-client";
import { describe, expect, it, vi } from "vitest";
import { createLocalFileAttachmentStore } from "@/attachments/local-file-attachment-store";
import {
@@ -25,6 +26,39 @@ function createDeferredPromise<T>() {
}
describe("submitAgentInput", () => {
it("explains an interrupted send and restores the draft", async () => {
let draft = "hello";
let sendError: string | null = null;
const result = await submitAgentInput({
message: draft,
attachments: [],
isAgentRunning: false,
canSubmit: true,
queueMessage: async () => {
throw new Error("Expected to send directly");
},
submitMessage: async () => {
throw new DaemonConnectionError("Software caused connection abort");
},
getDraftRevision: () => 0,
clearDraft: () => {
draft = "";
},
setUserInput: (text) => {
draft = text;
},
setAttachments: () => {},
setSendError: (message) => {
sendError = message;
},
setIsProcessing: () => {},
});
expect(result).toBe("failed");
expect(draft).toBe("hello");
expect(sendError).toBe("Connection lost. Paseo could not confirm that your message was sent.");
});
it("clears the composer before an in-flight submit resolves", async () => {
const deferred = createDeferredPromise<void>();
const queueMessage = vi.fn();
+12 -5
View File
@@ -1,3 +1,5 @@
import { DaemonConnectionError } from "@getpaseo/client/internal/daemon-client";
import { retainAttachmentForGarbageCollection } from "@/attachments/gc-retention";
import { i18n } from "@/i18n/i18next";
@@ -112,11 +114,7 @@ export async function submitAgentInput<TAttachment>(
input.setUserInput(trimmedMessage);
input.setAttachments(attachments);
}
input.setSendError(
error instanceof Error
? error.message
: (input.failedToSendMessage ?? i18n.t("composer.errors.failedToSend")),
);
input.setSendError(describeSendError(error, input.failedToSendMessage));
input.setIsProcessing(false);
return "failed";
}
@@ -126,3 +124,12 @@ export async function submitAgentInput<TAttachment>(
}
}
}
function describeSendError(error: unknown, fallback?: string): string {
if (error instanceof DaemonConnectionError && error.code === "DAEMON_CONNECTION_LOST") {
return i18n.t("composer.errors.sendConnectionLost");
}
return error instanceof Error
? error.message
: (fallback ?? i18n.t("composer.errors.failedToSend"));
}
+1
View File
@@ -220,6 +220,7 @@ export const ar: TranslationResources = {
errors: {
removePluginCommandAttachments: "أزل المرفقات لتشغيل الأمر /{{command}}.",
failedToSend: "فشل في إرسال الرسالة",
sendConnectionLost: "انقطع الاتصال. لم يتمكن Paseo من تأكيد إرسال رسالتك.",
failedToCreateAgent: "فشل في إنشاء الوكيل",
noHostSelected: "لم يتم تحديد مضيف",
initialPromptRequired: "مطلوب موجه الأولي",
+1
View File
@@ -218,6 +218,7 @@ export const en = {
errors: {
removePluginCommandAttachments: "Remove attachments to run /{{command}}.",
failedToSend: "Failed to send message",
sendConnectionLost: "Connection lost. Paseo could not confirm that your message was sent.",
failedToCreateAgent: "Failed to create agent",
noHostSelected: "No host selected",
initialPromptRequired: "Initial prompt is required",
+2
View File
@@ -221,6 +221,8 @@ export const es: TranslationResources = {
errors: {
removePluginCommandAttachments: "Quita los archivos adjuntos para ejecutar /{{command}}.",
failedToSend: "No se pudo enviar el mensaje",
sendConnectionLost:
"Se perdió la conexión. Paseo no pudo confirmar que se enviara tu mensaje.",
failedToCreateAgent: "No se pudo crear el agente",
noHostSelected: "Ningún anfitrión seleccionado",
initialPromptRequired: "Se requiere aviso inicial",
+2
View File
@@ -222,6 +222,8 @@ export const fr: TranslationResources = {
errors: {
removePluginCommandAttachments: "Retirez les pièces jointes pour exécuter /{{command}}.",
failedToSend: "Impossible d’envoyer le message",
sendConnectionLost:
"La connexion a été interrompue. Paseo n’a pas pu confirmer l’envoi de votre message.",
failedToCreateAgent: "Impossible de créer l’agent",
noHostSelected: "Aucun hôte sélectionné",
initialPromptRequired: "Un prompt initial est requis",
+2
View File
@@ -221,6 +221,8 @@ export const ja: TranslationResources = {
errors: {
removePluginCommandAttachments: "/{{command}} を実行するには添付ファイルを削除してください。",
failedToSend: "メッセージの送信に失敗しました",
sendConnectionLost:
"接続が切断されました。Paseo はメッセージが送信されたことを確認できませんでした。",
failedToCreateAgent: "エージェントの作成に失敗しました",
noHostSelected: "ホストが選択されていません",
initialPromptRequired: "初期プロンプトが必要です",
+1
View File
@@ -220,6 +220,7 @@ export const ko: TranslationResources = {
errors: {
removePluginCommandAttachments: "/{{command}} 명령을 실행하려면 첨부 파일을 제거하세요.",
failedToSend: "메시지를 보내지 못했습니다",
sendConnectionLost: "연결이 끊겼습니다. Paseo에서 메시지가 전송되었는지 확인하지 못했습니다.",
failedToCreateAgent: "에이전트를 생성하지 못했습니다",
noHostSelected: "선택된 호스트가 없습니다",
initialPromptRequired: "초기 프롬프트가 필요합니다",
+2
View File
@@ -221,6 +221,8 @@ export const ptBR: TranslationResources = {
errors: {
removePluginCommandAttachments: "Remova os anexos para executar /{{command}}.",
failedToSend: "Falha ao enviar mensagem",
sendConnectionLost:
"A conexão foi perdida. O Paseo não conseguiu confirmar o envio da sua mensagem.",
failedToCreateAgent: "Falha ao criar agente",
noHostSelected: "Nenhum host selecionado",
initialPromptRequired: "O prompt inicial é obrigatório",
+1
View File
@@ -221,6 +221,7 @@ export const ru: TranslationResources = {
errors: {
removePluginCommandAttachments: "Чтобы выполнить /{{command}}, удалите вложения.",
failedToSend: "Не удалось отправить сообщение",
sendConnectionLost: "Соединение прервано. Paseo не удалось подтвердить отправку сообщения.",
failedToCreateAgent: "Не удалось создать агента.",
noHostSelected: "Хост не выбран",
initialPromptRequired: "Необходим инициализирующий промпт",
+1
View File
@@ -220,6 +220,7 @@ export const zhCN: TranslationResources = {
errors: {
removePluginCommandAttachments: "请先移除附件,再运行 /{{command}}。",
failedToSend: "发送消息失败",
sendConnectionLost: "连接已断开。Paseo 无法确认消息是否已发送。",
failedToCreateAgent: "创建 Agent 失败",
noHostSelected: "未选择 Host",
initialPromptRequired: "初始 prompt 必填",