Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/web/src/components/delivery/BoardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import {
CardSigns,
laneTone,
PriorityPill,
QaReceiptCounts,
QaVotes,
TagList,
WaitingOn,
Expand Down Expand Up @@ -172,6 +173,7 @@ const CardFace = memo(function CardFace(props: {
<span className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5">
{showsKinds ? null : <WaitingOn card={card} />}
<QaVotes qa={card.qa} />
<QaReceiptCounts receipts={card.qaReceipts} />
<CardSigns card={card} />
</span>
<CardPeople card={card} />
Expand Down
22 changes: 20 additions & 2 deletions apps/web/src/components/delivery/TaskDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ import {
time,
WaitingOn,
} from "./taskParts";
import { TaskPipelineStrip } from "./TaskTeamActivity";
import { TaskAcceptanceReceipts, TaskSeatHandoffs } from "./TaskSeatResults";
import { TaskPipelineStrip, TaskTeamActivity } from "./TaskTeamActivity";
import { ThreadTaskQuestions } from "./ThreadTaskQuestions";

const TASK_ITEM = THREAD_DETAILS_ITEMS.find((item) => item.id === "task")!;
Expand Down Expand Up @@ -498,6 +499,19 @@ function TaskDetailsBody(props: { readonly board: BoardTask; readonly task: Task
)}
</TaskDisclosure>

{task.council?.seats.some(
(seat) => seat.threadId || seat.seatThread || seat.attestedModel || seat.actualModel,
) ? (
<TaskTeamActivity
environmentId={environmentId}
task={task}
conversations={board.seats}
flow={false}
conversationLabels={{ title: gt("Seats"), open: gt("Open conversation") }}
/>
) : null}
<TaskSeatHandoffs handoffs={task.handoffs} />

<TaskDisclosure
title={`What is asked, revision ${task.revision}`}
open={askedOpen}
Expand Down Expand Up @@ -529,7 +543,11 @@ function TaskDetailsBody(props: { readonly board: BoardTask; readonly task: Task
</section>
) : null}
<Listed title="Requirements" items={task.requirements} />
<Listed title="Acceptance criteria" items={task.acceptance} section="acceptance" />
{task.qaReceipts === null ? (
<Listed title={gt("Acceptance criteria")} items={task.acceptance} section="acceptance" />
) : (
<TaskAcceptanceReceipts acceptance={task.acceptance} receipts={task.qaReceipts} />
)}
{task.files.length > 0 ? (
<section>
<h3 className="pb-1 text-xs font-medium text-muted-foreground">
Expand Down
129 changes: 129 additions & 0 deletions apps/web/src/components/delivery/TaskSeatResults.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import { sha256 } from "@noble/hashes/sha2";
import { bytesToHex } from "@noble/hashes/utils";
import { useGT } from "gt-react";

import { isWebUrl } from "../../browser/webUrl";
import { repeatKeys, type TaskQaReceipt, type TaskSeatHandoff } from "../../lib/delivery";
import { Badge } from "../ui/badge";
import { Row } from "./taskParts";

export function TaskSeatHandoffs(props: { readonly handoffs: ReadonlyArray<TaskSeatHandoff> }) {
const gt = useGT();
if (props.handoffs.length === 0) return null;
const stages = { build: gt("Build"), review: gt("Review"), qa: gt("QA") };
return (
<section>
<h3 className="pb-1 text-xs font-medium text-muted-foreground">{gt("Seat hand-offs")}</h3>
{props.handoffs.map(({ stage, seat, state, reason }) => (
<Row key={stage} label={stages[stage]}>
{state === "handed" ? gt("Handed to {seat}", { seat }) : null}
{state === "delivered" ? gt("Delivered by {seat}", { seat }) : null}
{state === "fallen-back" ? (
<span className="wrap-anywhere">
{reason
? gt("Fell back to the pipeline ({reason})", { reason })
: gt("Fell back to the pipeline")}
</span>
) : null}
</Row>
))}
</section>
);
}

function EvidenceRef({ reference }: { readonly reference: string }) {
return isWebUrl(reference) ? (
<a href={reference} target="_blank" rel="noreferrer" className="text-primary underline">
{reference}
</a>
) : (
reference
);
}

function QaReceipt(props: { readonly receipt: TaskQaReceipt; readonly acceptanceHash: string }) {
const gt = useGT();
const { acceptance, evidence, independenceChecked, model, modelSource, seat, verdict } =
props.receipt;
const verdicts = { pass: gt("Pass"), fail: gt("Fail"), blocked: gt("Blocked") };
const variants = { pass: "success", fail: "destructive", blocked: "warning" } as const;
const sources = { attested: gt("Attested"), picked: gt("Picked"), requested: gt("Requested") };
return (
<li className="flex min-w-0 flex-col gap-1 rounded-md border border-border px-2 py-1.5 text-xs">
<div className="flex flex-wrap items-center gap-1.5">
<span className="font-medium wrap-anywhere">{seat}</span>
<Badge variant={variants[verdict]}>{verdicts[verdict]}</Badge>
</div>
{model || modelSource ? (
<p className="wrap-anywhere text-muted-foreground">
{model && modelSource
? gt("{model} ({source})", { model, source: sources[modelSource] })
: (model ?? (modelSource && sources[modelSource]))}
</p>
) : null}
{independenceChecked !== true ? (
<p className="text-warning-foreground">{gt("Not independence-checked")}</p>
) : null}
{acceptance.hash && acceptance.hash.toLowerCase() !== props.acceptanceHash ? (
<p className="text-warning-foreground">{gt("Filed for earlier acceptance text")}</p>
) : null}
{evidence.length > 0 ? (
<ul
className="list-disc pl-4 wrap-anywhere text-muted-foreground"
aria-label={gt("Evidence")}
>
{repeatKeys(evidence).map((key, index) => (
<li key={key}>
<EvidenceRef reference={evidence[index]!} />
</li>
))}
</ul>
) : null}
</li>
);
}

export function TaskAcceptanceReceipts(props: {
readonly acceptance: ReadonlyArray<string>;
readonly receipts: ReadonlyArray<TaskQaReceipt>;
}) {
const gt = useGT();
if (props.acceptance.length === 0) return null;
const byItem = new Map<number, TaskQaReceipt[]>();
for (const receipt of props.receipts) {
const index = receipt.acceptance.index;
const group = byItem.get(index);
if (group) group.push(receipt);
else byItem.set(index, [receipt]);
}
return (
<section data-task-section="acceptance">
<h3 className="pb-1 text-xs font-medium text-muted-foreground">
{gt("Acceptance criteria")}
</h3>
<ol className="flex list-decimal flex-col gap-3 pl-5 text-sm">
{repeatKeys(props.acceptance).map((key, index) => {
const value = props.acceptance[index]!;
const receipts = byItem.get(index);
const hash = receipts?.some((receipt) => receipt.acceptance.hash)
? bytesToHex(sha256(new TextEncoder().encode(value)).subarray(0, 8))
: "";
return (
<li key={key} className="wrap-anywhere">
{value}
{receipts ? (
<ul className="mt-1 flex flex-col gap-1">
{receipts.map((receipt) => (
<QaReceipt key={receipt.seat} receipt={receipt} acceptanceHash={hash} />
))}
</ul>
) : (
<p className="text-xs text-muted-foreground">{gt("No receipt")}</p>
)}
</li>
);
})}
</ol>
</section>
);
}
45 changes: 36 additions & 9 deletions apps/web/src/components/delivery/TaskTeamActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,21 @@ function SeatRow(props: {
readonly seat: CouncilSeat;
readonly catalog: ReturnType<typeof useSeatCatalog>;
readonly conversations?: SeatConversations | undefined;
readonly openConversationLabel?: string | undefined;
}) {
const { seat, catalog, conversations } = props;
const thread = conversations?.thread(seat.seat) ?? null;
const showOpenAction = thread !== null && props.openConversationLabel !== undefined;
const m = useMessages();
const status = seatStatus(seat.activity);
const entry = entryForHarness(catalog.entries, seat.harness);
const actualModel = seat.attestedModel?.model ?? seat.actualModel;
const harness =
props.openConversationLabel !== undefined
? (seat.attestedModel?.harness ?? seat.harness)
: seat.harness;
const entry = entryForHarness(catalog.entries, harness);
const provider = catalog.providers.find((item) => item.instanceId === entry?.instanceId);
const fallback = driverOfHarness(seat.harness);
const fallback = driverOfHarness(harness);
const driver = entry?.driverKind ?? (fallback ? ProviderDriverKind.make(fallback) : undefined);
const live = isOrchestrationV2WorkActive(status);
const timing = {
Expand All @@ -149,6 +156,11 @@ function SeatRow(props: {
? "unavailable"
: (seat.stage ?? threadRelationshipStatusLabel(status, m));
const latest = seat.live?.items.at(-1)?.text ?? null;
const seatName = (
<span className="min-w-0 flex-1 truncate text-left text-sm font-medium leading-4 text-foreground/85">
{seat.seat}
</span>
);
return (
<li
data-task-seat={seat.seat}
Expand All @@ -163,6 +175,7 @@ function SeatRow(props: {
size="sm"
variant="ghost"
part="row"
multiline={showOpenAction}
render={thread ? undefined : <div tabIndex={0} />}
aria-current={sameThread(thread, conversations?.current ?? null) ? "true" : undefined}
onClick={thread ? () => conversations?.open(thread) : undefined}
Expand All @@ -175,9 +188,16 @@ function SeatRow(props: {
providerEntries={catalog.entries}
status={status}
/>
<span className="min-w-0 flex-1 truncate text-left text-sm font-medium leading-4 text-foreground/85">
{seat.seat}
</span>
{showOpenAction ? (
<span className="flex min-w-0 flex-1 flex-col text-left">
{seatName}
<span className="whitespace-normal text-2xs leading-4 font-normal text-primary">
{props.openConversationLabel}
</span>
</span>
) : (
seatName
)}
<span className="sr-only">{seat.activity}</span>
<span
className={cn(
Expand All @@ -198,7 +218,7 @@ function SeatRow(props: {
<ThreadHoverCardPopup side="right">
<SubagentTooltipContent
title={seat.seat}
model={seat.actualModel ?? seat.requestedModel}
model={actualModel ?? seat.requestedModel}
providerInstanceId={entry?.instanceId ?? (seat.harness as ProviderInstanceId)}
origin="provider_native"
provider={provider}
Expand All @@ -213,7 +233,10 @@ function SeatRow(props: {
</Tooltip>
<div className="ps-9 pe-2.5 pb-1">
<span className="block text-3xs text-muted-foreground">
{harnessLabel(seat.harness)}, {seat.requestedModel ?? "its own model"}
{harnessLabel(harness)},{" "}
{props.openConversationLabel !== undefined && actualModel
? actualModel
: (seat.requestedModel ?? "its own model")}
{seat.reasoning ? `, ${seat.reasoning}` : ""}
{seat.access && seat.access !== "full" ? `, ${seat.access}` : ""}
</span>
Expand All @@ -237,6 +260,7 @@ export function TaskTeamActivity(props: {
readonly task: TaskView;
readonly conversations?: SeatConversations | undefined;
readonly flow?: boolean | undefined;
readonly conversationLabels?: { readonly title: string; readonly open: string } | undefined;
}) {
const { task } = props;
const catalog = useSeatCatalog(props.environmentId);
Expand All @@ -256,8 +280,10 @@ export function TaskTeamActivity(props: {
</ThreadDetailsSection>
)}
<ThreadDetailsSection
headingId={`task-team-${task.id}`}
title={running > 0 ? `${team} · ${running} running` : team}
headingId={`${props.conversationLabels ? "task-seats" : "task-team"}-${task.id}`}
title={
props.conversationLabels?.title ?? (running > 0 ? `${team} · ${running} running` : team)
}
data-task-roster
>
{task.council ? (
Expand All @@ -268,6 +294,7 @@ export function TaskTeamActivity(props: {
seat={seat}
catalog={catalog}
conversations={props.conversations}
openConversationLabel={props.conversationLabels?.open}
/>
))}
</ul>
Expand Down
36 changes: 36 additions & 0 deletions apps/web/src/components/delivery/taskParts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
SendIcon,
UserIcon,
} from "lucide-react";
import { useGT } from "gt-react";
import type { ReactNode } from "react";

import {
Expand Down Expand Up @@ -301,6 +302,41 @@ export function QaVotes(props: { readonly qa: DeliveryCard["qa"] }) {
);
}

export function QaReceiptCounts({ receipts }: { readonly receipts: DeliveryCard["qaReceipts"] }) {
const gt = useGT();
if (!receipts || receipts.count === 0) return null;
const { count, pass, fail, blocked } = receipts;
const summary = gt("QA receipts: {pass} pass, {fail} fail, {blocked} blocked", {
pass,
fail,
blocked,
});
return (
<Tooltip>
<TooltipTrigger
render={
<span
tabIndex={0}
className="inline-flex items-center gap-1 text-3xs text-muted-foreground"
aria-label={summary}
/>
}
>
<span>{gt("QA receipts ({count})", { count })}</span>
<span className="inline-flex items-center gap-0.5" aria-hidden>
<span className="size-2 rounded-full bg-success" />
{pass}
<span className="size-2 rounded-full bg-destructive" />
{fail}
<span className="size-2 rounded-full bg-warning" />
{blocked}
</span>
</TooltipTrigger>
<TooltipPopup side="top">{summary}</TooltipPopup>
</Tooltip>
);
}

/** Who holds the task now: the seats working on it, or who it waits for. */
export function CardPeople(props: { readonly card: DeliveryCard }) {
const { card } = props;
Expand Down
4 changes: 3 additions & 1 deletion apps/web/src/components/delivery/useTaskConversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
openSeatThread,
sameSeatView,
sameThread,
seatChildrenWithAttestations,
seatConversation,
seatOfThread,
steadySeatThread,
Expand Down Expand Up @@ -91,7 +92,8 @@ export function useTaskConversation(environmentId: EnvironmentId | null, task: T
const ref = conversation.kind === "thread" ? conversation.ref : null;
const environment = useEnvironment(ref?.environmentId ?? null);
const reachable = environment?.connection.phase === "connected";
const children = useQuietThreadProjection(ref)?.projection.subagents ?? NO_CHILDREN;
const projected = useQuietThreadProjection(ref)?.projection.subagents ?? NO_CHILDREN;
const children = seatChildrenWithAttestations(ref, projected, task?.council?.seats);
const { presentationById } = useEnvironments();
const ownConnection = (id: EnvironmentId) => {
const own = presentationById.get(id);
Expand Down
Loading
Loading