From c2d514356fef0377abdca85e6cabeaea187bdcdd Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Fri, 26 Sep 2025 12:36:45 -0300 Subject: [PATCH] fix: handle chat app not found (#19947) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes users can misconfigure the app used for chat. When that happens, we should make it clear to the user. Screenshot 2025-09-24 at 14 15 12 - Handle “chat app not found.” - Simplify stories. - Have `TaskAppIframe` handle all task iframes so we don’t need a separate iframe component for chat. --- site/src/modules/tasks/tasks.ts | 23 +- site/src/pages/TaskPage/TaskAppIframe.tsx | 39 ++- site/src/pages/TaskPage/TaskApps.stories.tsx | 2 + site/src/pages/TaskPage/TaskApps.tsx | 56 ++-- site/src/pages/TaskPage/TaskPage.stories.tsx | 288 +++++++++---------- site/src/pages/TaskPage/TaskPage.tsx | 27 +- site/src/pages/TaskPage/TaskSidebar.tsx | 108 ------- 7 files changed, 245 insertions(+), 298 deletions(-) delete mode 100644 site/src/pages/TaskPage/TaskSidebar.tsx diff --git a/site/src/modules/tasks/tasks.ts b/site/src/modules/tasks/tasks.ts index 93c8ca4b4c..135586626e 100644 --- a/site/src/modules/tasks/tasks.ts +++ b/site/src/modules/tasks/tasks.ts @@ -16,19 +16,12 @@ export type WorkspaceAppWithAgent = WorkspaceApp & { }; export function getTaskApps(task: Task): WorkspaceAppWithAgent[] { - return ( - task.workspace.latest_build.resources - .flatMap((r) => r.agents ?? []) - .flatMap((agent) => - agent.apps.map((app) => ({ - ...app, - agent, - })), - ) - // The Chat UI app will be displayed in the sidebar, so we don't want to - // show it as a tab. - .filter( - (app) => app.id !== task.workspace.latest_build.ai_task_sidebar_app_id, - ) - ); + return task.workspace.latest_build.resources + .flatMap((r) => r.agents ?? []) + .flatMap((agent) => + agent.apps.map((app) => ({ + ...app, + agent, + })), + ); } diff --git a/site/src/pages/TaskPage/TaskAppIframe.tsx b/site/src/pages/TaskPage/TaskAppIframe.tsx index e893af148f..e1803948c4 100644 --- a/site/src/pages/TaskPage/TaskAppIframe.tsx +++ b/site/src/pages/TaskPage/TaskAppIframe.tsx @@ -84,9 +84,7 @@ export const TaskAppIFrame: FC = ({ )} - {app.health === "healthy" || - app.health === "disabled" || - app.health === "unhealthy" ? ( + {app.health === "healthy" || app.health === "disabled" ? (