From a023231edd5b3087714b22f83aa9f96f0346ec1f Mon Sep 17 00:00:00 2001 From: amosblomqvist Date: Fri, 11 Sep 2026 03:08:07 +0300 Subject: [PATCH] =?UTF-8?q?Activity=20feed:=20drop=20busyChats=20=E2=80=94?= =?UTF-8?q?=20dock=20is=20background=20processes=20only=20(user=20decision?= =?UTF-8?q?=202026-09-11)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/observability.ts | 31 ++++++++++--------------------- tests/activity-feed.test.ts | 2 -- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/server/observability.ts b/src/server/observability.ts index c1ef08b..2033e9e 100644 --- a/src/server/observability.ts +++ b/src/server/observability.ts @@ -5,17 +5,18 @@ * THE ACTIVITY FEED (2026-09 observability design): the bottom-right dock is * visible in every view, so it needs the complete running-process picture — * sub-agent jobs across ALL chats (not just the open one) plus the global - * extraction runs — in one poll. /api/jobs stays chat-scoped untouched: it - * is the transcript machinery's poll and carries turnInFlight for the - * re-attach seam (chat-transport); the dock is a different consumer with a - * different shape, served here. Single sources of truth are unchanged: the - * job store, the pipeline registry, the turn-liveness registry — this file - * only composes them. + * extraction runs — in one poll. The dock is BACKGROUND PROCESSES ONLY + * (user decision, 2026-09-11): teaching sessions already have their own + * observability, so in-flight teacher turns are deliberately NOT in the + * feed. /api/jobs stays chat-scoped untouched: it is the transcript + * machinery's poll and carries turnInFlight for the re-attach seam + * (chat-transport); the dock is a different consumer with a different + * shape, served here. Single sources of truth are unchanged: the job + * store and the pipeline registry — this file only composes them. */ import { extractionStatuses, type ExtractionPhase } from "../agent/subagents/extraction.ts"; import { chatStore } from "../store/chats.ts"; -import { isTurnRunning } from "./turn-liveness.ts"; import { listJobs } from "./jobs.ts"; import type { JobRecord } from "../core/contracts.ts"; @@ -35,32 +36,20 @@ export interface ActivityExtraction { startedAt: number; } -/** A chat with a teacher turn in flight right now (the wake-turn process — - * the biggest spender; data made available, rendering it is a dock - * decision). */ -export interface ActivityChatTurn { - chatId: string; - title: string; -} - /** The dock's whole world in one payload: every running process, every view. * Jobs are RUNNING-ONLY — finished jobs belong to their chat's transcript; * the blob disappears when the process ends. Cost math is NOT done here: * raw usage rides on the records and the client folds it with the pure * helpers in core/prices.ts (transport stays thin). */ -export function activityFeed(): { jobs: ActivityJob[]; extractions: ActivityExtraction[]; busyChats: ActivityChatTurn[] } { +export function activityFeed(): { jobs: ActivityJob[]; extractions: ActivityExtraction[] } { const chats = chatStore.listChats(); const jobs: ActivityJob[] = []; - const busyChats: ActivityChatTurn[] = []; for (const chat of chats) { for (const job of listJobs(chat.id)) { if (job.status === "running") { jobs.push({ ...job, title: chat.title ?? chat.id }); } } - if (isTurnRunning(chat.id)) { - busyChats.push({ chatId: chat.id, title: chat.title ?? chat.id }); - } } const extractions: ActivityExtraction[] = extractionStatuses().map((run) => ({ chatId: run.chatId, @@ -70,5 +59,5 @@ export function activityFeed(): { jobs: ActivityJob[]; extractions: ActivityExtr })); // oldest-first on last activity: the stable blob order (ISO strings sort chronologically) jobs.sort((a, b) => a.updatedAt.localeCompare(b.updatedAt)); - return { jobs, extractions: extractions.sort((a, b) => a.startedAt - b.startedAt), busyChats }; + return { jobs, extractions: extractions.sort((a, b) => a.startedAt - b.startedAt) }; } diff --git a/tests/activity-feed.test.ts b/tests/activity-feed.test.ts index 33b90be..7819cfd 100644 --- a/tests/activity-feed.test.ts +++ b/tests/activity-feed.test.ts @@ -43,8 +43,6 @@ test("activityFeed: running jobs across ALL chats, running-only, title-joined, o // extraction runs are absent when the pipeline is idle (registry empty) assert.deepEqual(feed.extractions, []); - // busyChats reports turn-liveness (none in flight here) - assert.deepEqual(feed.busyChats, []); } finally { fs.unlinkSync(`${PATHS.chats}/${chatA.id}.json`); fs.unlinkSync(`${PATHS.chats}/${chatB.id}.json`);