Skip to content

feat(hub)!: insights reads stock observability; delete the insights mount and package (CL-8160) - #778

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-8160-insights
Sep 17, 2026
Merged

TheGreatAxios merged 1 commit into
mainfrom
cl-8160-insights

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

Owner ruling: the hub mounts nothing Workbench-specific. packages/insights (usage, activity, tool-call, turn-latency, run-trace, and cross-workbench-scope routes plus their Postgres writers) is deleted along with its ${TENANT_PREFIX}/insights mount in apps/hub/src/index.ts. The stock observability routes it could have read instead (vendor/intx/hub-api/src/routes/observability.ts's four GET routes: agent logs, agent metrics, list traces, get trace) are unimplemented — each returns { error: "not_implemented" }, 501. With no data source left, usage/cost, activity, tool-call, latency, run-trace, and cross-workbench scope switching are dropped rather than faked.

Insights now reads only the native tenant-scoped GET /workflows/runs listing (already used since CL-8087) for its KPI row, "running now" strip, recent runs, and run history grouped by definition.

packages/insights's turn-text-snapshot reader (chat message-edit replay) has no dependency on the deleted usage/latency tables — it reads only native inference_turn/turn_part rows — so it moves to apps/hub/src/turn-text-snapshot.ts instead of disappearing with the rest of the package.

scripts/db-setup.ts forward-drops the insights Postgres schema for existing databases, per docs/package-migrations.md's convention (same pattern as the existing run_key_history/preferences drops).

UI dropped (no stock source)

  • Cost/token KPIs (Cost, Tokens in/out, cache-hit rate, token mosaic) — read packages/insights' usage store; no replacement writer exists.
  • Activity chart (turns/tokens per day) — same usage-store dependency.
  • Cost by model / calls by tool tables — same.
  • Turn latency tiles (p50/p95 stage timings, CL-6257) — read the deleted turn_latency table; the vendored event collector never persisted the raw events another reader could recompute from.
  • Cross-workbench "activity by workbench" chart and the landing scope switcher ("All workbenches" vs. sibling workbenches) — both read /scope and /workbenches, rolled up from the deleted usage store.
  • Run-detail trace waterfall (steps/completed/failed/duration, timeline) — derived from /runs/:runId/trace, which read the deleted trace-reader.ts.
  • Sidebar's "Weekly usage" account-menu line — read the deleted /usage route; the sidebar's Insights-nav-row gating now checks for any top-level run instead of usage turns.
  • Mission Control's "Runs today" / "Spend today" KPI tiles and "This week" panel — same usage-store dependency.

What's kept: the Insights landing's Runs/Errored/Deployed/Running-now KPIs, the "running now" strip, recent runs, and runs history grouped by definition — all backed by the native GET /workflows/runs feed already used since CL-8087. The per-workbench Insights route (/insights/workbench/:workbenchId) is untouched — it renders WorkbenchTimelineRoute, a chat/run timeline with no dependency on packages/insights.

Deleted tests

Per the hard-cutover ruling, tests encoding the deleted behavior were deleted rather than adapted:

  • apps/web/test/insights-page.test.tsx — the full usage/activity/scope-switcher/trace-timeline/workbench-activity/latency-tile render suite (878 lines), superseded by the trimmed suites in apps/web/src/pages/insights-page.test.ts and insights-page-render.test.tsx for the surviving run-list behavior.
  • packages/insights/** tests (all of them, with the package).
  • insights-stats.test.ts's computeTraceStats and filterRunsByCreatedAt describe blocks (both functions deleted — no trace/range data left to test).
  • mission-control-page.test.tsx's three "Runs today"/"Spend today"/"This week" tests.
  • sidebar.test.tsx's "Weekly usage" zero-spend test.

Test plan

  • bun run typecheck
  • bun run lint
  • bun run check:structural
  • bun --cwd apps/web test (814 pass)

…ts mount and package (CL-8160)

The hub mounts nothing Workbench-specific: packages/insights (its usage,
latency, tools, activity, run-trace, and cross-workbench-scope routes and
Postgres writers) is deleted, along with its ${TENANT_PREFIX}/insights
mount in apps/hub. The stock observability routes it could have read
instead (vendor/intx/hub-api's four GET routes) are unimplemented 501
stubs, so usage/cost, activity, tool-call, latency, run-trace, and scope
switching have no data source left and are dropped rather than faked.

Insights now reads only the native tenant-scoped GET /workflows/runs
listing (already used since CL-8087) for its KPI row, "running now"
strip, recent runs, and run history grouped by definition. Run detail
drops its trace waterfall (steps/completed/failed/duration) since it was
derived from spans this build no longer has. Mission Control drops its
"Runs today" / "Spend today" KPI tiles and "This week" panel; the
sidebar's "Insights" row now gates on having any top-level runs instead
of usage turns, and its "Weekly usage" account-menu line is gone.

packages/insights' turn-text-snapshot reader (chat message-edit replay)
has no dependency on the deleted usage/latency tables, so it moves to
apps/hub/src/turn-text-snapshot.ts instead of disappearing with the rest
of the package.

scripts/db-setup.ts forward-drops the insights schema for existing
databases per docs/package-migrations.md's convention, alongside the
run_key_history/preferences precedent.
@linear-code

linear-code Bot commented Sep 17, 2026

Copy link
Copy Markdown

CL-8160

@TheGreatAxios
TheGreatAxios merged commit d134fe9 into main Sep 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant