Open-source SEO, GEO, and marketing skills for AI agents.
feat(goals): improve escalation and check context
Yuting Zhong8ff5ed29afd0
diff --git a/notfair/src/app/(app)/[project]/goals/[agent]/page.tsx b/notfair/src/app/(app)/[project]/goals/[agent]/page.tsxindex a70fc264..9e54681b 100644--- a/notfair/src/app/(app)/[project]/goals/[agent]/page.tsx+++ b/notfair/src/app/(app)/[project]/goals/[agent]/page.tsx@@ -185,7 +185,11 @@ export default async function GoalPage({<div className="order-last flex w-full shrink-0 items-center justify-end gap-2 lg:order-none lg:ml-auto lg:w-auto">{/* Escalations stay visible at every width — they're the oneheader item that is the user's job, not the agent's. */}- <GoalNeedsYouDialog items={needsYou} />+ <GoalNeedsYouDialog+ items={needsYou}+ projectSlug={slug}+ agentSlug={agentSlug}+ /><div className="hidden lg:contents"><GoalContextDialogprojectSlug={slug}@@ -435,13 +439,8 @@ function GoalDashboard({key="cadence"className="mt-1.5 mb-0 text-[11px] leading-relaxed text-[hsl(var(--notfair-ink-4))]">- {cadenceLabel(goal.cadence_cron)} · next check{" "}- {goal.status === "active" && goal.next_tick_at- ? tickRunning- ? "running now"- : `${timeUntil(goal.next_tick_at)} (${fmtClock(goal.next_tick_at)})`- : "—"}{" "}- · {goal.tick_count} check{goal.tick_count === 1 ? "" : "s"} so far+ {cadenceLabel(goal.cadence_cron)} · {goal.tick_count} check+ {goal.tick_count === 1 ? "" : "s"} so far{goal.spend_envelope_usd !== null &&` · spent $${loggedSpendTotal(goal.id)} of $${goal.spend_envelope_usd}`}</p>@@ -472,7 +471,23 @@ function GoalDashboard({</RailSection>)}- <RailSection title="Checks" count={goal.tick_count}>+ <RailSection+ title="Checks"+ count={goal.tick_count}+ meta={+ goal.status === "active"+ ? tickRunning+ ? "running now"+ : goal.next_tick_at+ ? (+ <span title={`Scheduled for ${fmtClock(goal.next_tick_at)}`}>+ next check {timeUntil(goal.next_tick_at)}+ </span>+ )+ : "next check —"+ : undefined+ }+ >{checkRows.length === 0 ? (<p className="m-0 text-[12px] text-[hsl(var(--notfair-ink-4))]">None yet — the first runs{" "}diff --git a/notfair/src/components/chat/messages.tsx b/notfair/src/components/chat/messages.tsxindex c2daaa8b..7b8c7ec7 100644--- a/notfair/src/components/chat/messages.tsx+++ b/notfair/src/components/chat/messages.tsx@@ -184,8 +184,12 @@ export function ToolGroup({<StatusIcon className={cn("ml-auto size-3.5 shrink-0", statusClass)} /></summary><div className="mt-1.5 divide-y divide-border/30 rounded-xl bg-[hsl(var(--notfair-surface-2)/0.5)] px-3.5 py-1">- {tools.map((t) => (- <ToolRow key={t.toolCallId} entry={t} mcpCatalog={mcpCatalog} />+ {tools.map((t, index) => (+ <ToolRow+ key={`${t.toolCallId}:${index}`}+ entry={t}+ mcpCatalog={mcpCatalog}+ />))}</div></details>diff --git a/notfair/src/components/chat/transcript-model.more.test.ts b/notfair/src/components/chat/transcript-model.more.test.tsindex 378609a6..9e83353f 100644--- a/notfair/src/components/chat/transcript-model.more.test.ts+++ b/notfair/src/components/chat/transcript-model.more.test.ts@@ -3,7 +3,6 @@ import { describe, expect, it, vi } from "vitest";import type { TranscriptEvent } from "@/server/sessions/transcript-tail";import {collapseEvents,- eventSignature,handleSseEvent,upsertToolEntry,type SseToolEvent,@@ -194,28 +193,3 @@ describe("collapseEvents (top-up)", () => {});});});--describe("eventSignature (top-up)", () => {- it("keys lifecycle/unknown events by kind and id", () => {- expect(- eventSignature({ kind: "lifecycle", id: "l1", ts: t, phase: "start" }),- ).toBe("lifecycle|l1");- expect(- eventSignature({ kind: "unknown", id: "u9", ts: t, raw_type: "x" }),- ).toBe("unknown|u9");- });-- it("keys tool_results by call id so shadow and DB copies collide", () => {- expect(- eventSignature({- kind: "tool_result",- id: "shadow-1",- ts: t,- tool_call_id: "t1",- name: "shell",- summary: null,- ok: true,- }),- ).toBe("tool_result|t1");- });-});diff --git a/notfair/src/components/chat/transcript-model.test.ts b/notfair/src/components/chat/transcript-model.test.tsindex b1441edc..7dece81b 100644--- a/notfair/src/components/chat/transcript-model.test.ts+++ b/notfair/src/components/chat/transcript-model.test.ts@@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest";import type { TranscriptEvent } from "@/server/sessions/transcript-tail";import {collapseEvents,- eventSignature,+ nextToolGroupKey,upsertToolEntry,} from "./transcript-model";import { humanizeTool, matchMcpServerKey } from "./tool-intent";@@ -76,6 +76,22 @@ describe("collapseEvents", () => {]);});+ it("keeps groups unique when a harness reuses tool ids across turns", () => {+ const items = collapseEvents([+ call("c1", "item_1"),+ text("a1", "first turn"),+ call("c2", "item_1"),+ text("a2", "second turn"),+ ]);+ const groups = items.filter((item) => item.kind === "tool_group");++ expect(groups.map((group) => group.key)).toEqual([+ "tg:item_1",+ "tg:item_1:1",+ ]);+ expect(nextToolGroupKey(items, "item_1")).toBe("tg:item_1:2");+ });+it("keeps an orphan tool_result as its own done entry", () => {const items = collapseEvents([result("r9", "t9", false)]);expect(items).toHaveLength(1);@@ -87,13 +103,6 @@ describe("collapseEvents", () => {});});-describe("eventSignature", () => {- it("keys messages by trimmed body and tools by call id", () => {- expect(eventSignature(text("a", " same "))).toBe(eventSignature(text("b", "same")));- expect(eventSignature(call("x", "t1"))).toBe("tool_call|t1");- });-});-describe("upsertToolEntry", () => {it("inserts then completes an entry across phases", () => {let entries = upsertToolEntry([], {diff --git a/notfair/src/components/chat/transcript-model.ts b/notfair/src/components/chat/transcript-model.tsindex 9a0af5f9..a783bc18 100644--- a/notfair/src/components/chat/transcript-model.ts+++ b/notfair/src/components/chat/transcript-model.ts@@ -21,34 +21,28 @@ export type RenderedItem =| { kind: "tool_group"; key: string; tools: ToolEntry[] }| { kind: "system_unknown"; key: string; raw_type: string };-/** Stable across the optimistic SSE row and its committed transcript copy. */-export function toolGroupKey(toolCallId: string): string {- return `tg:${toolCallId}`;-}-/**- * Content signature for cross-writer dedup. The id-based set in the- * stream hook catches in-channel dups (e.g. polling racing itself);- * this catches dups when the same logical event arrives via different- * channels with different ids — e.g. the shadow transcript stream gave- * us an assistant turn during the run, and the eventual transcript- * flush gives us the same turn with a fresh UUID at session-end.- *- * Signature keys are intentionally narrow: text body for messages- * (case preserved, whitespace trimmed), tool_call_id for tool rows- * (unique per invocation regardless of the writer).+ * Stable across the optimistic SSE row and its committed transcript copy.+ * Harnesses may restart tool ids (for example `item_1`) on every turn, so+ * later occurrences need a suffix to remain unique within a long chat.*/-export function eventSignature(e: TranscriptEvent): string {- switch (e.kind) {- case "user_message":- case "assistant_text":- return `${e.kind}|${e.body.trim()}`;- case "tool_call":- case "tool_result":- return `${e.kind}|${e.tool_call_id}`;- default:- return `${e.kind}|${e.id}`;- }+export function toolGroupKey(toolCallId: string, occurrence = 0): string {+ return occurrence === 0+ ? `tg:${toolCallId}`+ : `tg:${toolCallId}:${occurrence}`;+}++/** Match the pending tool card to the key its committed group will receive. */+export function nextToolGroupKey(+ rendered: RenderedItem[],+ toolCallId: string,+): string {+ const occurrence = rendered.filter(+ (item) =>+ item.kind === "tool_group" &&+ item.tools[0]?.toolCallId === toolCallId,+ ).length;+ return toolGroupKey(toolCallId, occurrence);}/**@@ -132,13 +126,17 @@ export function collapseEvents(events: TranscriptEvent[]): RenderedItem[] {}const out: RenderedItem[] = [];let buffer: ToolEntry[] = [];+ const groupOccurrences = new Map<string, number>();const flush = () => {if (buffer.length === 0) return;+ const firstToolCallId = buffer[0]!.toolCallId;+ const occurrence = groupOccurrences.get(firstToolCallId) ?? 0;out.push({kind: "tool_group",- key: toolGroupKey(buffer[0]!.toolCallId),+ key: toolGroupKey(firstToolCallId, occurrence),tools: buffer,});+ groupOccurrences.set(firstToolCallId, occurrence + 1);buffer = [];};for (const step of steps) {diff --git a/notfair/src/components/chat/use-chat-stream.test.tsx b/notfair/src/components/chat/use-chat-stream.test.tsxindex 63ad0d0e..97935137 100644--- a/notfair/src/components/chat/use-chat-stream.test.tsx+++ b/notfair/src/components/chat/use-chat-stream.test.tsx@@ -97,20 +97,21 @@ it("exposes initial events, derives remote-turn state, and clears the local viewexpect(result.current.openTurn).toBeNull();});-it("polls, advances the cursor, and deduplicates by id and content signature", async () => {+it("polls, advances the cursor, and only deduplicates durable event ids", async () => {vi.useFakeTimers();const original: TranscriptEvent = { kind: "assistant_text", id: "one", ts: 1, body: "same" };+ const repeated: TranscriptEvent = { kind: "assistant_text", id: "two", ts: 2, body: "same" };const fresh: TranscriptEvent = { kind: "assistant_text", id: "three", ts: 3, body: "fresh" };vi.mocked(fetch).mockResolvedValue(pollResponse([original,- { ...original, id: "two", ts: 2 },+ repeated,fresh,], 3) as never,);const { result } = renderHook(() => useChatStream({ ...base, initialEvents: [original], initialCursor: 1 }));await act(async () => { await vi.advanceTimersByTimeAsync(2_000); });- expect(result.current.events).toEqual([original, fresh]);+ expect(result.current.events).toEqual([original, repeated, fresh]);expect(fetch).toHaveBeenCalledWith("/api/agents/goal-1/threads/main/transcript?offset=1&project=acme%20co",{ cache: "no-store" },diff --git a/notfair/src/components/chat/use-chat-stream.ts b/notfair/src/components/chat/use-chat-stream.tsindex dc71351b..6ac2a2a1 100644--- a/notfair/src/components/chat/use-chat-stream.ts+++ b/notfair/src/components/chat/use-chat-stream.ts@@ -5,7 +5,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { findOpenTurn, isOpenTurnLive } from "@/lib/turn-state";import type { TranscriptEvent } from "@/server/sessions/transcript-tail";import {- eventSignature,handleSseEvent,upsertToolEntry,type ToolEntry,@@ -16,7 +15,7 @@ const POLL_INTERVAL_MS = 2_000;/*** The chat's streaming state machine, extracted whole from the original* LiveTranscript. Owns: the committed event log (poll + SSE-bridge fed,- * dedup'd across writers), the optimistic pending state for an active+ * deduped by durable event id), the optimistic pending state for an active* send, the send/stop calls, and the remote-turn detection that keeps* the UI honest about turns this tab didn't start.*@@ -100,29 +99,13 @@ export function useChatStream({new Set(initialEvents.map((e) => e.id)),);- /**- * Content signatures we've already rendered, for cross-writer dedup.- * The id-based set above can't catch the case where the SAME logical- * message arrives twice via different paths with different ids — the- * server-side-kickoff path writes a shadow transcript (ids like- * `shadow-<uuid>`), and the poll later returns the DB copy of the- * session.jsonl at session-end with FRESH UUIDs. Without a content- * key, every assistant turn and tool call would render twice.- */- const seenSignaturesRef = useRef<Set<string>>(- new Set(initialEvents.map(eventSignature)),- );-const commitFresh = useCallback((incoming: TranscriptEvent[]) => {const fresh = incoming.filter((e) => {if (seenEventIdsRef.current.has(e.id)) return false;- const sig = eventSignature(e);- if (seenSignaturesRef.current.has(sig)) return false;return true;});for (const e of fresh) {seenEventIdsRef.current.add(e.id);- seenSignaturesRef.current.add(eventSignature(e));}if (fresh.length > 0) {setEvents((prev) => [...prev, ...fresh]);@@ -181,17 +164,15 @@ export function useChatStream({};}, [pollIntervalMs, pollOnce, sendingChat]);- // ── Live re-attach: SSE bridge to the shadow-transcript stream. ─────+ // ── Live re-attach: SSE bridge to committed transcript events. ──────// The DB poll can lag a fast-streaming turn, so polling sees nothing- // mid-turn. Both server-side task kickoffs and /api/chat tee their- // gateway events to a live stream — this bridge tails that file so a- // tab switching back to a thread mid-run picks up the stream instead- // of staring at a frozen transcript until the turn flushes.+ // mid-turn. Transcript inserts also emit the same durable row through+ // an in-process live stream, so a tab switching back to a thread sees+ // progress immediately instead of waiting for its next poll.//- // The bridge runs on every thread mount, not just tasks. The shadow- // file may not exist (idle thread) or exist-but-be-idle (run already- // finished); both cases are no-ops on the server. Same dedup set as- // polling, so events that later land in the DB don't double-render.+ // The bridge runs on every thread mount, not just tasks. An idle thread+ // simply emits nothing. Polling and the live bridge carry the same row+ // id, so the synchronous id set prevents double-rendering.//// Skipped during an active /api/chat send — that path already streams// its own deltas; layering re-attach on top would just duplicate work.diff --git a/notfair/src/components/goal-checks-list.test.tsx b/notfair/src/components/goal-checks-list.test.tsxindex ebacd651..b27ebbf6 100644--- a/notfair/src/components/goal-checks-list.test.tsx+++ b/notfair/src/components/goal-checks-list.test.tsx@@ -67,7 +67,7 @@ async function tripSentinel() {}describe("GoalChecksList", () => {- it("renders the manual tag and PR pill on the right rows", () => {+ it("renders compact trigger icons with full accessible labels and the PR pill", () => {render(<GoalChecksList{...baseProps}@@ -87,7 +87,10 @@ describe("GoalChecksList", () => {initialHasMore={false}/>,);- expect(screen.getByText("manually triggered")).toBeInTheDocument();+ const manualIcon = screen.getByRole("img", { name: "Manually triggered" });+ expect(manualIcon).toBeInTheDocument();+ expect(screen.getByRole("img", { name: "Heartbeat triggered" })).toBeInTheDocument();+ expect(screen.queryByText("manually triggered")).not.toBeInTheDocument();const pill = screen.getByRole("link", { name: "PR #67 · merged" });expect(pill).toHaveAttribute("href", "https://github.com/acme/site/pull/67");// hasMore=false → no sentinel, no observer registered.diff --git a/notfair/src/components/goal-checks-list.tsx b/notfair/src/components/goal-checks-list.tsxindex 0d279fc2..de3bee37 100644--- a/notfair/src/components/goal-checks-list.tsx+++ b/notfair/src/components/goal-checks-list.tsx@@ -2,7 +2,7 @@import Link from "next/link";import { useEffect, useRef, useState } from "react";-import { Loader2 } from "lucide-react";+import { HeartPulse, Loader2, Zap } from "lucide-react";import { loadMoreGoalChecksAction } from "@/server/actions/goals";import type { CheckFilter, CheckPr, CheckRow, CheckWrite } from "@/server/goals/checks";import { projectHref } from "@/lib/project-href";@@ -10,6 +10,12 @@ import { formatMetric } from "@/lib/format-metric";import { timeAgo } from "@/lib/time-ago";import { cn } from "@/lib/utils";import { Markdown } from "@/components/markdown";+import {+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from "@/components/ui/tooltip";/*** The goal rail's Checks diary. Server-renders the newest page; older@@ -105,7 +111,7 @@ export function GoalChecksList({if (rows.length === 0) return null;return (- <>+ <TooltipProvider delayDuration={250}><div className="mb-2 flex items-center gap-1" role="group" aria-label="Filter checks"><FilterButton active={filter === "all"} onClick={() => setFilter("all")}>All@@ -132,7 +138,7 @@ export function GoalChecksList({)}</div>)}- </>+ </TooltipProvider>);}@@ -189,9 +195,7 @@ function CheckItem({<div className="flex items-baseline justify-between gap-2"><span className="font-medium">Check {tick.tick_number}- {tick.trigger_kind === "manual" && (- <span className="ns-tag ml-1.5 align-middle">manually triggered</span>- )}+ <CheckTriggerIcon triggerKind={tick.trigger_kind} />{tick.metric_value !== null && (<span className="ml-1.5 font-normal tabular-nums text-[hsl(var(--notfair-ink-3))]">→ {formatMetric(tick.metric_value)}@@ -242,6 +246,41 @@ function CheckItem({);}+/** Quiet trigger provenance: icon at rest, full wording on hover/focus. */+function CheckTriggerIcon({+ triggerKind,+}: {+ triggerKind: CheckRow["trigger_kind"];+}) {+ const manual = triggerKind === "manual";+ if (!manual && triggerKind !== "heartbeat") return null;+ const label = manual ? "Manually triggered" : "Heartbeat triggered";+ const Icon = manual ? Zap : HeartPulse;++ return (+ <Tooltip>+ <TooltipTrigger asChild>+ <span+ role="img"+ tabIndex={0}+ aria-label={label}+ className={cn(+ "ml-1 inline-flex size-4 translate-y-[2px] items-center justify-center rounded-sm align-baseline outline-none focus-visible:ring-1 focus-visible:ring-ring",+ manual+ ? "text-[hsl(var(--notfair-warn))]"+ : "text-[hsl(var(--notfair-ink-4))]",+ )}+ >+ <Icon className={cn("size-3", manual && "fill-current")} aria-hidden />+ </span>+ </TooltipTrigger>+ <TooltipContent side="top" sideOffset={4}>+ {label}+ </TooltipContent>+ </Tooltip>+ );+}+/** Compact accent pill naming one kind of modification the check made* ("Campaign budget updated", "Keyword paused ×3"). */function CheckWriteBadge({ write }: { write: CheckWrite }) {diff --git a/notfair/src/components/goal-needs-you.test.tsx b/notfair/src/components/goal-needs-you.test.tsxindex ea6ee224..2d678112 100644--- a/notfair/src/components/goal-needs-you.test.tsx+++ b/notfair/src/components/goal-needs-you.test.tsx@@ -37,22 +37,36 @@ beforeEach(() => {describe("GoalNeedsYouDialog", () => {it("renders no trigger when there are no open asks", () => {- const { container } = render(<GoalNeedsYouDialog items={[]} />);+ const { container } = render(+ <GoalNeedsYouDialog items={[]} projectSlug="acme" agentSlug="meta-errors" />,+ );expect(container).toBeEmptyDOMElement();});it("shows the badge count and lists every ask on open", () => {- render(<GoalNeedsYouDialog items={ITEMS} />);+ render(+ <GoalNeedsYouDialog items={ITEMS} projectSlug="acme" agentSlug="meta-errors" />,+ );const trigger = screen.getByRole("button", { name: /needs you\s*2/i });fireEvent.click(trigger);expect(screen.getByText(/OPENAI_API_KEY/)).toBeInTheDocument();expect(screen.getByText(/raised 1h ago · check #43/)).toBeInTheDocument();expect(screen.getByText(/Meta app image-upload access/)).toBeInTheDocument();+ expect(screen.getByRole("link", { name: "Details for check #43" })).toHaveAttribute(+ "href",+ "/acme/goals/meta-errors/checks/tick-43",+ );+ expect(screen.getByRole("link", { name: "Details in goal chat" })).toHaveAttribute(+ "href",+ "/acme/goals/meta-errors",+ );});it("marks an ask handled and refreshes", async () => {markHandled.mockResolvedValue({ ok: true });- render(<GoalNeedsYouDialog items={ITEMS} />);+ render(+ <GoalNeedsYouDialog items={ITEMS} projectSlug="acme" agentSlug="meta-errors" />,+ );fireEvent.click(screen.getByRole("button", { name: /needs you\s*2/i }));fireEvent.click(screen.getAllByRole("button", { name: /mark handled/i })[0]!);await waitFor(() => expect(markHandled).toHaveBeenCalledWith("a1"));diff --git a/notfair/src/components/goal-needs-you.tsx b/notfair/src/components/goal-needs-you.tsxindex abbe756a..042b4554 100644--- a/notfair/src/components/goal-needs-you.tsx+++ b/notfair/src/components/goal-needs-you.tsx@@ -1,9 +1,10 @@"use client";+import Link from "next/link";import { useRouter } from "next/navigation";import { useState, useTransition } from "react";import { toast } from "sonner";-import { Check, TriangleAlert } from "lucide-react";+import { Check, MessageSquareText, TriangleAlert } from "lucide-react";import {Dialog,DialogContent,@@ -13,6 +14,7 @@ import {DialogTrigger,} from "@/components/ui/dialog";import { markUserActionHandledAction } from "@/server/actions/goals";+import { projectHref } from "@/lib/project-href";import { timeAgo } from "@/lib/time-ago";export type NeedsYouItem = {@@ -32,7 +34,15 @@ export type NeedsYouItem = {* proves the fix (or you mark one handled here, which the agent later* verifies — and re-escalates if it is still broken).*/-export function GoalNeedsYouDialog({ items }: { items: NeedsYouItem[] }) {+export function GoalNeedsYouDialog({+ items,+ projectSlug,+ agentSlug,+}: {+ items: NeedsYouItem[];+ projectSlug: string;+ agentSlug: string;+}) {const router = useRouter();const [open, setOpen] = useState(false);const [pending, startTransition] = useTransition();@@ -80,7 +90,8 @@ export function GoalNeedsYouDialog({ items }: { items: NeedsYouItem[] }) {The agent hit things only you can fix — credentials, apppermissions, account settings. It repeats each ask in everycheck until telemetry proves the fix. Marking one handled- closes the ask; it re-escalates if still broken.+ closes the ask; it re-escalates if still broken. Open Details+ to ask the agent about it in the conversation that raised it.</DialogDescription></DialogHeader><ul className="m-0 flex list-none flex-col gap-3 p-0">@@ -95,15 +106,34 @@ export function GoalNeedsYouDialog({ items }: { items: NeedsYouItem[] }) {raised {timeAgo(item.raised_at)}{item.tick_number !== null && ` · check #${item.tick_number}`}</span>- <button- type="button"- className="ns-btn ns-btn-ghost shrink-0 !px-2 !py-0.5 text-[11.5px]"- disabled={pending}- onClick={() => markHandled(item)}- >- <Check className="size-3" />- Mark handled- </button>+ <div className="flex shrink-0 items-center gap-1">+ <Link+ href={projectHref(+ projectSlug,+ item.tick_number === null+ ? `/goals/${agentSlug}`+ : `/goals/${agentSlug}/checks/tick-${item.tick_number}`,+ )}+ className="ns-btn ns-btn-ghost !px-2 !py-0.5 text-[11.5px]"+ aria-label={+ item.tick_number === null+ ? "Details in goal chat"+ : `Details for check #${item.tick_number}`+ }+ >+ <MessageSquareText className="size-3" />+ Details+ </Link>+ <button+ type="button"+ className="ns-btn ns-btn-ghost !px-2 !py-0.5 text-[11.5px]"+ disabled={pending}+ onClick={() => markHandled(item)}+ >+ <Check className="size-3" />+ Mark handled+ </button>+ </div></div></li>))}diff --git a/notfair/src/components/live-transcript.tsx b/notfair/src/components/live-transcript.tsxindex ed13c733..758d63ba 100644--- a/notfair/src/components/live-transcript.tsx+++ b/notfair/src/components/live-transcript.tsx@@ -16,7 +16,7 @@ import {} from "@/components/chat/messages";import {collapseEvents,- toolGroupKey,+ nextToolGroupKey,} from "@/components/chat/transcript-model";import { useChatStream } from "@/components/chat/use-chat-stream";import type { McpCatalogEntryLite } from "@/components/chat/tool-intent";@@ -245,7 +245,7 @@ export function LiveTranscript({</li>)}{pendingTools.length > 0 && (- <li key={toolGroupKey(pendingTools[0]!.toolCallId)}>+ <li key={nextToolGroupKey(rendered, pendingTools[0]!.toolCallId)}><ToolGroup tools={pendingTools} mcpCatalog={mcpCatalog} /></li>)}diff --git a/notfair/src/components/rail-section.test.tsx b/notfair/src/components/rail-section.test.tsxindex db3d2b49..1b564cd5 100644--- a/notfair/src/components/rail-section.test.tsx+++ b/notfair/src/components/rail-section.test.tsx@@ -7,7 +7,7 @@ import { RailSection } from "@/components/rail-section";describe("RailSection", () => {it("shows the body, title, and count by default", () => {render(- <RailSection title="Checks" count={12}>+ <RailSection title="Checks" count={12} meta="next check in 42m"><p>diary rows</p></RailSection>,);@@ -16,6 +16,7 @@ describe("RailSection", () => {"true",);expect(screen.getByText("(12)")).toBeInTheDocument();+ expect(screen.getByText("next check in 42m")).toBeInTheDocument();expect(screen.getByText("diary rows")).toBeVisible();});diff --git a/notfair/src/components/rail-section.tsx b/notfair/src/components/rail-section.tsxindex dcbecbd8..a5bf9da6 100644--- a/notfair/src/components/rail-section.tsx+++ b/notfair/src/components/rail-section.tsx@@ -12,11 +12,14 @@ import { cn } from "@/lib/utils";export function RailSection({title,count,+ meta,defaultOpen = true,children,}: {title: string;count?: number;+ /** Compact status shown in the section heading, before the chevron. */+ meta?: React.ReactNode;defaultOpen?: boolean;children: React.ReactNode;}) {@@ -35,12 +38,19 @@ export function RailSection({<span className="ml-1 font-normal tabular-nums">({count})</span>)}</span>- <ChevronDown- className={cn(- "size-3.5 shrink-0 text-[hsl(var(--notfair-ink-4))] transition-transform",- !open && "-rotate-90",+ <span className="flex shrink-0 items-center gap-1.5">+ {meta && (+ <span className="text-[10.5px] font-normal tracking-normal text-[hsl(var(--notfair-ink-4))] normal-case">+ {meta}+ </span>)}- />+ <ChevronDown+ className={cn(+ "size-3.5 shrink-0 text-[hsl(var(--notfair-ink-4))] transition-transform",+ !open && "-rotate-90",+ )}+ />+ </span></button><div hidden={!open}>{children}</div></section>