Open-source SEO, GEO, and marketing skills for AI agents.
feat(goals): watch a running check live from the Checks list
Yuting Zhong18d6c2254aa0
diff --git a/notfair/src/app/(app)/[project]/goals/[agent]/page.tsx b/notfair/src/app/(app)/[project]/goals/[agent]/page.tsxindex ddce4b6d..5fc8ca8a 100644--- a/notfair/src/app/(app)/[project]/goals/[agent]/page.tsx+++ b/notfair/src/app/(app)/[project]/goals/[agent]/page.tsx@@ -450,12 +450,15 @@ function TickItem({: tick.summary ?? "(no summary)"}</Markdown></div>- {tick.session_id && tick.status !== "running" && (+ {/* Running agent checks are watchable live: the session attaches at+ turn start and the check page's transcript polls as it streams.+ No-op checks never carry a session and stay unlinked. */}+ {(tick.session_id || tick.status === "running") && (<Linkhref={projectHref(slug, `/goals/${agentSlug}/checks/${threadLabel}`)}className="ns-link text-[10.5px]">- details ›+ {tick.status === "running" ? "watch live ›" : "details ›"}</Link>)}</li>diff --git a/notfair/src/server/goals/tick.ts b/notfair/src/server/goals/tick.tsindex c767d529..3dd77440 100644--- a/notfair/src/server/goals/tick.ts+++ b/notfair/src/server/goals/tick.ts@@ -405,15 +405,18 @@ async function runGoalTickInner(});try {- const { sessionId, summary } = await streamAgentTurn({+ const { summary } = await streamAgentTurn({projectSlug: project.slug,harnessAdapter: project.harness_adapter,agentId: goal.agent_id,sessionLabel: `tick-${tickNumber}`,message,source: "goal-tick",+ // Attach as soon as the session exists — not after the turn — so a+ // running check is clickable in the UI and a failed one keeps its+ // partial transcript reachable.+ onSession: (sessionId) => attachTickSession(tick.id, sessionId),});- attachTickSession(tick.id, sessionId);finishGoalTick(tick.id, "done", summary);} catch (err) {const messageText = err instanceof Error ? err.message : String(err);@@ -445,6 +448,8 @@ export async function streamAgentTurn(input: {sessionLabel: string;message: string;source: string;+ /** Fires with the session id before the turn streams (attach points). */+ onSession?: (sessionId: string) => void;}): Promise<{ sessionId: string; summary: string | null }> {const adapter = requireAdapter(input.harnessAdapter);const session = getOrCreateSession({@@ -453,6 +458,7 @@ export async function streamAgentTurn(input: {label: input.sessionLabel,harness_adapter: input.harnessAdapter,});+ input.onSession?.(session.id);appendTranscriptEvent(session.id, "user", { text: input.message, source: input.source });let finalText: string | null = null;