Q161: the home page measures accepted work, not sessions that merely ended

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-09 03:02:04 -04:00
1 parent c9117fe46d
commit 58871fbaed
15 files changed
+183 -17

No files matched your search

+2 -2
View File
@@ -54,6 +54,8 @@ export const zh: Record<string, string> = {
"Cancel run": "取消运行",
"Show older runs": "显示更早的运行",
"Target date": "目标日期",
"Work accepted (7 days)": "工作验收(近 7 天)",
"{accepted} done · {returned} sent back · sessions: {ok} ended, {failed} failed": "{accepted} 项完成 · {returned} 项退回 · 会话:{ok} 次结束,{failed} 次失败",
"no target date": "未设目标日期",
"overdue": "已逾期",
"These are all the runs.": "已显示全部运行。",
@@ -126,7 +128,6 @@ export const zh: Record<string, string> = {
"This model follows instructions and calls tools.": "该模型能遵循指令并调用工具。",
"This model cannot do agent work here: {detail}": "该模型无法在此完成 Agent 工作:{detail}",
"{n} in the last 7 days": "近 7 天 {n}",
"Success rate (7 days)": "成功率(近 7 天)",
"{n} tokens in the last 7 days": "近 7 天 {n} token",
"{n} tokens in the last 7 days · {count} calls without usage": "近 7 天 {n} token · {count} 次调用未报告用量",
"Spent this month": "本月已花费",
@@ -660,7 +661,6 @@ export const zh: Record<string, string> = {
"{n} task": "{n} 个任务",
"{n} tasks": "{n} 个任务",
"{n} this week": "本周 {n} 次",
"{ok} ok · {failed} failed": "{ok} 成功 · {failed} 失败",
"{passed}/{total} passed": "{passed}/{total} 通过",
"{pending} pending · {approved} approved this week": "{pending} 待处理 · 本周已批准 {approved}",
"{percent}% of cap": "上限的 {percent}%",
+2 -2
View File
@@ -15,7 +15,7 @@ import type {
TaskRunRecord,
} from "../../../shared/domain";
import { NewTaskDialog } from "./NewTaskDialog";
import { AgentWorkloadChart, CostTrendChart, RunActivityChart, SuccessRateChart } from "./home/DashboardCharts";
import { AcceptanceChart, AgentWorkloadChart, CostTrendChart, RunActivityChart } from "./home/DashboardCharts";
import type { PageProps } from "./types";
import { activeOrgId, formatRelative, formatTime, money, requireActiveEmployee, requireActiveOrganization, requireUsageStats } from "./types";
import { t } from "../i18n/i18n";
@@ -75,7 +75,7 @@ export function HomePage({ snapshot, actions, navigate }: PageProps) {
<div style={METRICS}>
<AgentWorkloadChart agents={agents} tasks={businessTasks} />
<RunActivityChart days={usageStats.days} />
<SuccessRateChart days={usageStats.days} />
<AcceptanceChart days={usageStats.days} />
<CostTrendChart days={usageStats.days} />
</div>
@@ -97,16 +97,19 @@ export function RunActivityChart({ days }: { days: UsageDays }) {
);
}
export function SuccessRateChart({ days }: { days: UsageDays }) {
/** Of the work judged this week, how much was accepted (done) rather than sent back; session outcomes are shown apart, as what they are. */
export function AcceptanceChart({ days }: { days: UsageDays }) {
const accepted = days.reduce((sum, day) => sum + day.acceptedTasks, 0);
const returned = days.reduce((sum, day) => sum + day.returnedTasks, 0);
const completed = days.reduce((sum, day) => sum + day.completedRuns, 0);
const failed = days.reduce((sum, day) => sum + day.failedRuns, 0);
const total = completed + failed;
const rate = total > 0 ? Math.round((completed / total) * 100) : 0;
const judged = accepted + returned;
const rate = judged > 0 ? Math.round((accepted / judged) * 100) : 0;
const circumference = 2 * Math.PI * 42;
const offset = circumference - (rate / 100) * circumference;
return (
<ChartCard title={t("Success rate (7 days)")} readout={t("{ok} ok · {failed} failed", { ok: completed, failed })}>
<ChartCard title={t("Work accepted (7 days)")} readout={t("{accepted} done · {returned} sent back · sessions: {ok} ended, {failed} failed", { accepted, returned, ok: completed, failed })}>
<svg viewBox="0 0 100 100" style={{ width: 96, height: 96, margin: "4px auto", display: "block" }}>
<circle cx="50" cy="50" r="42" fill="none" stroke="var(--panel-3)" strokeWidth="8" />
<circle
@@ -115,7 +118,7 @@ export function SuccessRateChart({ days }: { days: UsageDays }) {
strokeLinecap="round" transform="rotate(-90 50 50)"
style={{ transition: "stroke-dashoffset var(--motion-slow) var(--ease-out)" }}
/>
<text x="50" y="50" textAnchor="middle" dominantBaseline="central" fontSize="20" fontWeight="600" fill="var(--text-1)">{rate}%</text>
<text x="50" y="50" textAnchor="middle" dominantBaseline="central" fontSize="20" fontWeight="600" fill="var(--text-1)">{judged > 0 ? `${rate}%` : "—"}</text>
</svg>
</ChartCard>
);