The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(webapp): bound the warning for a large drop that could not attach
unsupportedpastels1f12eb870426
diff --git a/apps/desktop/src/app/chat/hooks/use-composer-actions.test.ts b/apps/desktop/src/app/chat/hooks/use-composer-actions.test.tsindex bef75451b19..8781e59ce39 100644--- a/apps/desktop/src/app/chat/hooks/use-composer-actions.test.ts+++ b/apps/desktop/src/app/chat/hooks/use-composer-actions.test.ts@@ -471,6 +471,49 @@ describe('useComposerActions native image drops', () => {expect(warning?.message).toContain("Could not attach my-repo: Folders can't be attached")})+ // 50 oversized files must not grow one toast off screen: name a few, count the rest.+ it('bounds the warning for a large mixed drop and keeps the full list in its detail', async () => {+ const stageFileForAttach = vi.fn(async (file: File) => {+ if (file.name.startsWith('huge-')) {+ throw new Error('Upload request is too large')+ }++ return `/srv/uploads/web-${file.name}`+ })++ const value = { getPathForFile: () => '', stageFileForAttach }+ Object.defineProperty(window, 'hermesDesktop', { configurable: true, value })++ const add = vi.fn()++ const { result } = renderHook(() =>+ useComposerActions({+ activeSessionId: null,+ currentCwd: '/w',+ requestGateway: vi.fn(),+ scope: { add, remove: vi.fn(() => null), target: 'main', update: vi.fn(() => true), updateIfCurrent: vi.fn(() => true) }+ })+ )++ const huge = Array.from({ length: 50 }, (_, index) => ({ file: new File(['x'], `huge-${index}.zip`), path: '' }))++ await act(async () => {+ await result.current.attachDroppedItems([{ file: new File(['x'], 'notes.txt'), path: '' }, ...huge])+ })++ expect(add).toHaveBeenCalledOnce()++ const warning = $notifications.get().find(notice => notice.message.includes('huge-0.zip'))++ expect(warning).toMatchObject({ kind: 'warning' })+ expect(warning?.message).toContain('huge-2.zip')+ expect(warning?.message).not.toContain('huge-3.zip')+ expect(warning?.message).toMatch(/and 47 more$/)+ expect(warning?.message.length).toBeLessThan(300)+ expect(warning?.detail?.split('\n')).toHaveLength(50)+ expect(warning?.detail).toContain('huge-49.zip')+ })+it('copies dropped screenshot bytes before trusting a transient macOS path', async () => {const transientPath ='/var/folders/x7/example/T/TemporaryItems/NSIRD_screencaptureui_4roSuW/Screen Shot 2026-08-11.png'diff --git a/apps/desktop/src/app/chat/hooks/use-composer-actions.ts b/apps/desktop/src/app/chat/hooks/use-composer-actions.tsindex 5ce2a90c173..451d11bbb1e 100644--- a/apps/desktop/src/app/chat/hooks/use-composer-actions.ts+++ b/apps/desktop/src/app/chat/hooks/use-composer-actions.ts@@ -47,6 +47,9 @@ export function isImagePath(filePath: string): boolean {return IMAGE_EXTENSION_PATTERN.test(filePath)}+/** How many failed drop items the warning names before it counts the rest. */+const DROP_FAILURES_SHOWN = 3+/** A dropped File the composer sends as an image; never a folder, which has no bytes. */function isDroppedImage(file: File, filePath: string, isDirectory?: boolean): boolean {return !isDirectory && (file.type.startsWith('image/') || isImagePath(file.name) || isImagePath(filePath))@@ -890,12 +893,23 @@ export function useComposerActions({}if (failures.length) {- notify({ kind: 'warning', title: copy.dropFiles, message: failures.join('; ') })+ // Name the first few and count the rest so a large drop can't grow the toast+ // off screen; the full list rides in the collapsible detail.+ const hidden = failures.length - DROP_FAILURES_SHOWN+ const shown = failures.slice(0, DROP_FAILURES_SHOWN).join('; ')+ const more = copy.dropFilesMore++ notify({+ kind: 'warning',+ title: copy.dropFiles,+ message: hidden > 0 ? `${shown}; ${more(hidden)}` : shown,+ ...(hidden > 0 ? { detail: failures.join('\n') } : {})+ })}return attached},- [attachContextFilePath, attachContextFolderPath, attachImageBlob, attachImagePath, copy.dropFiles]+ [attachContextFilePath, attachContextFolderPath, attachImageBlob, attachImagePath, copy.dropFiles, copy.dropFilesMore])const removeAttachment = useCallback(diff --git a/apps/desktop/src/components/notifications.tsx b/apps/desktop/src/components/notifications.tsxindex 8971db9dd40..a47b8df666e 100644--- a/apps/desktop/src/components/notifications.tsx+++ b/apps/desktop/src/components/notifications.tsx@@ -360,7 +360,7 @@ function NotificationDetail({ detail }: { detail: string }) {<summary className="select-none font-medium text-muted-foreground hover:text-foreground">{copy.details}</summary><div className="mt-1 rounded-md bg-background/65 p-2"><pre- className="max-h-32 whitespace-pre-wrap wrap-break-word font-mono text-[0.6875rem] leading-relaxed"+ className="max-h-32 overflow-y-auto overscroll-contain whitespace-pre-wrap wrap-break-word font-mono text-[0.6875rem] leading-relaxed"data-selectable-text="true">{detail}diff --git a/apps/desktop/src/i18n/ar_chat.ts b/apps/desktop/src/i18n/ar_chat.tsindex f45249c6b2d..e9479b249aa 100644--- a/apps/desktop/src/i18n/ar_chat.ts+++ b/apps/desktop/src/i18n/ar_chat.ts@@ -472,6 +472,7 @@ export const arChat = {noClipboardImage: 'لا توجد صورة في الحافظة',clipboardPasteFailed: 'فشل اللصق من الحافظة',dropFiles: 'أفلت الملفات هنا',+ dropFilesMore: (count: number) => `و${count} أخرى`,handoff: {pickPlatform: 'اختر وجهة',success: platform => `تم التسليم إلى ${platform}. استأنف هنا في أي وقت.`,diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex 2349812799e..7175c61ae95 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -5420,6 +5420,7 @@ export const deOverrides = {noClipboardImage: 'Kein Bild in der Zwischenablage',clipboardPasteFailed: 'Zwischenablage-Einfügen fehlgeschlagen',dropFiles: 'Dateien ablegen',+ dropFilesMore: (count: number) => `und ${count} weitere`,handoff: {pickPlatform: 'Ziel wählen',success: platform => `Übergeben an ${platform}. Jederzeit hier fortsetzen.`,diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 14a6b4533b2..d8d00b4aa0d 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -4757,6 +4757,7 @@ export const en: Translations = {noClipboardImage: 'No image found in clipboard',clipboardPasteFailed: 'Clipboard paste failed',dropFiles: 'Drop files',+ dropFilesMore: (count: number) => `and ${count} more`,handoff: {pickPlatform: 'Choose a destination',success: platform => `Handed off to ${platform}. Resume here anytime.`,diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex d906e8fb6f4..2abe7056910 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -5404,6 +5404,7 @@ export const esOverrides = {noClipboardImage: 'No se encontró ninguna imagen en el portapapeles',clipboardPasteFailed: 'No se pudo pegar desde el portapapeles',dropFiles: 'Soltar archivos',+ dropFilesMore: (count: number) => `y ${count} más`,handoff: {pickPlatform: 'Elige un destino',success: platform => `Transferido a ${platform}. Puedes reanudar aquí cuando quieras.`,diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex 539bcc970b1..d0c02b2cb40 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -5427,6 +5427,7 @@ export const frOverrides = {noClipboardImage: 'Aucune image trouvée dans le presse-papiers',clipboardPasteFailed: 'Échec du collage depuis le presse-papiers',dropFiles: 'Déposer des fichiers',+ dropFilesMore: (count: number) => `et ${count} de plus`,handoff: {pickPlatform: 'Choisissez une destination',success: platform => `Transféré vers ${platform}. Reprenez ici à tout moment.`,diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 5b4c66d2954..f4362cce7e0 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -3643,6 +3643,7 @@ export const jaOverrides = {noClipboardImage: 'クリップボードに画像が見つかりません',clipboardPasteFailed: 'クリップボードからの貼り付けに失敗しました',dropFiles: 'ファイルをドロップ',+ dropFilesMore: (count: number) => `ほか ${count} 件`,handoff: {pickPlatform: '送信先を選択',success: platform => `${platform} に引き継ぎました。いつでもここで再開できます。`,diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex a85f52d51f6..1c0af102eed 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -3790,6 +3790,7 @@ export const ruOverrides = {noClipboardImage: 'Изображение в буфере обмена не найдено',clipboardPasteFailed: 'Вставка из буфера обмена не удалась',dropFiles: 'Перетащите файлы',+ dropFilesMore: (count: number) => `и ещё ${count}`,handoff: {pickPlatform: 'Выберите назначение',success: platform => `Передаём в ${platform}. Возобновите здесь в любой момент.`,diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 08a6ce86002..05d4247c3ff 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -4201,6 +4201,7 @@ catalog: CatalogTranslationsnoClipboardImage: stringclipboardPasteFailed: stringdropFiles: string+ dropFilesMore: (count: number) => stringhandoff: {pickPlatform: stringsuccess: (platform: string) => stringdiff --git a/apps/desktop/src/i18n/zh-hant_chat.ts b/apps/desktop/src/i18n/zh-hant_chat.tsindex f825769dbe5..9c55c122dc4 100644--- a/apps/desktop/src/i18n/zh-hant_chat.ts+++ b/apps/desktop/src/i18n/zh-hant_chat.ts@@ -494,6 +494,7 @@ export const zhHantChat = {noClipboardImage: '剪貼簿中沒有圖片',clipboardPasteFailed: '剪貼簿貼上失敗',dropFiles: '拖曳檔案',+ dropFilesMore: (count: number) => `以及另外 ${count} 項`,handoff: {pickPlatform: '選擇目標平台',success: platform => `已移交到 ${platform}。隨時可在此處恢復。`,diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 18c168f528a..ad3e6221885 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -4617,6 +4617,7 @@ export const zhOverrides = {noClipboardImage: '剪贴板中没有图片',clipboardPasteFailed: '粘贴剪贴板失败',dropFiles: '拖放文件',+ dropFilesMore: (count: number) => `以及另外 ${count} 项`,handoff: {pickPlatform: '选择目标平台',success: platform => `已移交到 ${platform}。随时可在此处恢复。`,diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.jsonindex cf5e7ea73ac..4da70362320 100644--- a/locales/_keys.desktop.json+++ b/locales/_keys.desktop.json@@ -1519,6 +1519,7 @@"desktop.downloadImage","desktop.downloadStarted","desktop.dropFiles",+ "desktop.dropFilesMore","desktop.editFailed","desktop.editTurnUnavailable","desktop.emptySlashCommand",