diff --git a/src/workspaces/officerdev/src/apps/Chat/components/BackgroundTaskTray.tsx b/src/workspaces/officerdev/src/apps/Chat/components/BackgroundTaskTray.tsx index cd2c9212..a26a2f24 100644 --- a/src/workspaces/officerdev/src/apps/Chat/components/BackgroundTaskTray.tsx +++ b/src/workspaces/officerdev/src/apps/Chat/components/BackgroundTaskTray.tsx @@ -82,7 +82,19 @@ export const BackgroundTaskTray = ({ messages, sessionId }: BackgroundTaskTrayPr try { await client.delete(`/chat/tasks/${taskId}${force ? '?force=1' : ''}`); } catch (err) { - toast.error(err instanceof Error ? err.message : 'Could not stop that job'); + const message = err instanceof Error ? err.message : ''; + // The server saying it cannot FIND the job is authoritative, not an error to report: there is no + // output file, therefore no pid, therefore nothing running. The chip was the last thing claiming + // otherwise. + // + // Without this the tray showed a job that could not be stopped, killed or dismissed — a chip with + // no way out, because dismiss is only offered for a task the tray believes has finished. Pressing + // Stop then Kill both answered {"stopped":false,"reason":"no such task"} and changed nothing. + if (message.includes('no such task') || message.includes('already stopped')) { + dismiss(taskId); + return; + } + toast.error(message || 'Could not stop that job'); } };