From abc946c5bd572de438646ef34fbdc3f471ce99ea Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Thu, 28 Aug 2025 12:14:53 -0300 Subject: [PATCH] fix: don't show prebuild workspaces as tasks (#19572) Fixes https://github.com/coder/coder/issues/19570 **Before:** image **After:** Screenshot 2025-08-27 at 09 11 31 **Things to notice:** - There is a task without a prompt at the end, it should not happen anymore - There is no test for this because we mock the API function and the fix was inside of it. It is a temp solution, the API should be ready to be used by the FE soon --- site/src/api/api.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/site/src/api/api.ts b/site/src/api/api.ts index d95d644ef7..f1ccef1faf 100644 --- a/site/src/api/api.ts +++ b/site/src/api/api.ts @@ -2702,14 +2702,18 @@ class ExperimentalApiMethods { queryExpressions.push(`owner:${filter.username}`); } - const workspaces = await API.getWorkspaces({ + const res = await API.getWorkspaces({ q: queryExpressions.join(" "), }); + // Exclude prebuild workspaces as they are not user-facing. + const workspaces = res.workspaces.filter( + (workspace) => !workspace.is_prebuild, + ); const prompts = await API.experimental.getAITasksPrompts( - workspaces.workspaces.map((workspace) => workspace.latest_build.id), + workspaces.map((workspace) => workspace.latest_build.id), ); - return workspaces.workspaces.map((workspace) => ({ + return workspaces.map((workspace) => ({ workspace, prompt: prompts.prompts[workspace.latest_build.id], }));