Skip to content

Commit 24851b9

Browse files
authored
Improve the evals "run status" section (#4400)
1 parent 62a09a2 commit 24851b9

File tree

16 files changed

+121
-94
lines changed

16 files changed

+121
-94
lines changed

apps/web-evals/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"lint": "next lint",
77
"check-types": "tsc -b",
8-
"dev": "scripts/check-services.sh && next dev --turbopack",
8+
"dev": "scripts/check-services.sh && next dev",
99
"format": "prettier --write src",
1010
"build": "next build",
1111
"start": "next start"

apps/web-evals/src/lib/server/exercises.ts renamed to apps/web-evals/src/actions/exercises.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import { fileURLToPath } from "url"
66

77
import { type ExerciseLanguage, exerciseLanguages } from "@roo-code/evals"
88

9-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
9+
const __dirname = path.dirname(fileURLToPath(import.meta.url)) // <repo>/apps/web-evals/src/actions
10+
11+
const EXERCISES_BASE_PATH = path.resolve(__dirname, "../../../../../evals")
1012

1113
export const listDirectories = async (relativePath: string) => {
1214
try {
@@ -19,9 +21,6 @@ export const listDirectories = async (relativePath: string) => {
1921
}
2022
}
2123

22-
// __dirname = <repo>/evals/apps/web/src/lib/server
23-
const EXERCISES_BASE_PATH = path.resolve(__dirname, "../../../../../../evals")
24-
2524
export const getExercises = async () => {
2625
const result = await Promise.all(
2726
exerciseLanguages.map(async (language) => {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"use server"
2+
3+
import { redisClient } from "@/lib/server/redis"
4+
5+
export const getHeartbeat = async (runId: number) => {
6+
const redis = await redisClient()
7+
return redis.get(`heartbeat:${runId}`)
8+
}

apps/web-evals/src/lib/server/runners.ts renamed to apps/web-evals/src/actions/runners.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use server"
22

3-
import { redisClient } from "./redis"
3+
import { redisClient } from "@/lib/server/redis"
44

55
export const getRunners = async (runId: number) => {
66
const redis = await redisClient()
File renamed without changes.
File renamed without changes.

apps/web-evals/src/app/home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Ellipsis, Rocket } from "lucide-react"
77

88
import type { Run, TaskMetrics } from "@roo-code/evals"
99

10-
import { deleteRun } from "@/lib/server/runs"
10+
import { deleteRun } from "@/actions/runs"
1111
import { formatCurrency, formatDuration, formatTokens, formatToolUsageSuccessRate } from "@/lib/formatters"
1212
import {
1313
Button,

apps/web-evals/src/app/runs/[id]/connection-status.tsx

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"use client"
2+
3+
import type { RunStatus as _RunStatus } from "@/hooks/use-run-status"
4+
import { cn } from "@/lib/utils"
5+
6+
export const RunStatus = ({ runStatus: { sseStatus, heartbeat, runners = [] } }: { runStatus: _RunStatus }) => (
7+
<div>
8+
<div className="flex items-center gap-2">
9+
<div className="flex items-center gap-2">
10+
<div>Task Stream:</div>
11+
<div className="font-mono text-sm text-muted-foreground">{sseStatus}</div>
12+
</div>
13+
<div className="relative">
14+
<div
15+
className={cn("absolute size-2.5 rounded-full opacity-50 animate-ping", {
16+
"bg-green-500": sseStatus === "connected",
17+
"bg-amber-500": sseStatus === "waiting",
18+
"bg-rose-500": sseStatus === "error",
19+
})}
20+
/>
21+
<div
22+
className={cn("size-2.5 rounded-full", {
23+
"bg-green-500": sseStatus === "connected",
24+
"bg-amber-500": sseStatus === "waiting",
25+
"bg-rose-500": sseStatus === "error",
26+
})}
27+
/>
28+
</div>
29+
</div>
30+
<div className="flex items-center gap-2">
31+
<div className="flex items-center gap-2">
32+
<div>Task Controller:</div>
33+
<div className="font-mono text-sm text-muted-foreground">{heartbeat ?? "dead"}</div>
34+
</div>
35+
<div className="relative">
36+
<div
37+
className={cn("absolute size-2.5 rounded-full opacity-50 animate-ping", {
38+
"bg-green-500": !!heartbeat,
39+
"bg-rose-500": !heartbeat,
40+
})}
41+
/>
42+
<div
43+
className={cn("size-2.5 rounded-full", {
44+
"bg-green-500": !!heartbeat,
45+
"bg-rose-500": !heartbeat,
46+
})}
47+
/>
48+
</div>
49+
</div>
50+
<div className="flex items-center gap-2">
51+
<div>Task Runners:</div>
52+
{runners.length > 0 && <div className="font-mono text-sm text-muted-foreground">{runners?.join(", ")}</div>}
53+
</div>
54+
</div>
55+
)

apps/web-evals/src/app/runs/[id]/run.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ import { useRunStatus } from "@/hooks/use-run-status"
1010
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui"
1111

1212
import { TaskStatus } from "./task-status"
13-
import { ConnectionStatus } from "./connection-status"
13+
import { RunStatus } from "./run-status"
1414

1515
type TaskMetrics = Pick<_TaskMetrics, "tokensIn" | "tokensOut" | "tokensContext" | "duration" | "cost">
1616

1717
export function Run({ run }: { run: Run }) {
18-
const { tasks, status, tokenUsage, usageUpdatedAt } = useRunStatus(run)
18+
const runStatus = useRunStatus(run)
19+
const { tasks, tokenUsage, usageUpdatedAt } = runStatus
1920

2021
const taskMetrics: Record<number, TaskMetrics> = useMemo(() => {
2122
const metrics: Record<number, TaskMetrics> = {}
@@ -45,10 +46,10 @@ export function Run({ run }: { run: Run }) {
4546
<div>
4647
<div className="mb-2">
4748
<div>
48-
<div>{run.model}</div>
49+
<div className="font-mono">{run.model}</div>
4950
{run.description && <div className="text-sm text-muted-foreground">{run.description}</div>}
5051
</div>
51-
{!run.taskMetricsId && <ConnectionStatus status={status} runId={run.id} />}
52+
{!run.taskMetricsId && <RunStatus runStatus={runStatus} />}
5253
</div>
5354
{!tasks ? (
5455
<LoaderCircle className="size-4 animate-spin" />

0 commit comments

Comments
 (0)