Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(acceptance): sidebar row menu + round-5 review UI polish (#17310)

Arvin Xube10439cc331
diff --git a/apps/server/src/routers/lambda/acceptance.ts b/apps/server/src/routers/lambda/acceptance.ts
index b15ce3fa6a5..f6610e68c74 100644
--- a/apps/server/src/routers/lambda/acceptance.ts
+++ b/apps/server/src/routers/lambda/acceptance.ts
@@ -500,4 +500,82 @@ export const acceptanceRouter = router({
return ctx.acceptanceService.reject(acceptance.id, input.comment);
}),
+
+ /**
+ * Rename the acceptance in the caller's list — a display-title override kept
+ * on the aggregate's metadata. The subject's own title (the source topic /
+ * task / document) is left untouched, so renaming the sidebar entry never
+ * mutates the origin conversation.
+ */
+ rename: acceptanceWriteProcedure
+ .input(z.object({ id: z.string(), title: z.string().trim().min(1).max(200) }))
+ .mutation(async ({ ctx, input }) => {
+ const acceptance = await resolveAcceptance(ctx, input.id);
+ assertWorkspaceRowManageable(ctx, acceptance.userId, 'acceptance');
+
+ return ctx.acceptanceService.acceptanceModel.update(acceptance.id, {
+ metadata: { ...acceptance.metadata, title: input.title },
+ });
+ }),
+
+ /**
+ * Manually move the acceptance's user-facing lifecycle state from the list —
+ * an owner override (mark accepted / rejected, or reopen for another look).
+ *
+ * accept / reject go through the SERVICE, never a bare status write: the
+ * service applies `requireDecidableAcceptance` (a premature `accepted` is
+ * sticky in recomputeStatus and could never be corrected by a later verifier
+ * result) and stamps the decision on the current round. Reopen is only
+ * meaningful for an already-decided aggregate — a still-running round must
+ * not be forced back to a decision-pending state by hand.
+ */
+ updateStatus: acceptanceWriteProcedure
+ .input(z.object({ id: z.string(), status: z.enum(['delivered', 'accepted', 'rejected']) }))
+ .mutation(async ({ ctx, input }) => {
+ const acceptance = await resolveAcceptance(ctx, input.id);
+ assertWorkspaceRowManageable(ctx, acceptance.userId, 'acceptance');
+
+ try {
+ if (input.status === 'accepted') {
+ await ctx.acceptanceService.accept(acceptance.id);
+ } else if (input.status === 'rejected') {
+ await ctx.acceptanceService.reject(
+ acceptance.id,
+ 'Rejected from the acceptance list — needs another round.',
+ );
+ } else {
+ // Reopen (→ delivered): only a decided aggregate can be re-opened; a
+ // live round recomputes its own status and must not be clobbered.
+ if (acceptance.status !== 'accepted' && acceptance.status !== 'rejected') {
+ throw new TRPCError({
+ code: 'BAD_REQUEST',
+ message: `Only a decided acceptance can be reopened (status: ${acceptance.status})`,
+ });
+ }
+ await ctx.acceptanceService.acceptanceModel.updateStatus(acceptance.id, 'delivered');
+ }
+ } catch (error) {
+ if (error instanceof TRPCError) throw error;
+ throw new TRPCError({
+ code: 'BAD_REQUEST',
+ message: error instanceof Error ? error.message : 'Failed to update status',
+ });
+ }
+ return { success: true };
+ }),
+
+ /**
+ * Delete the acceptance aggregate. Its chained verify runs detach
+ * (acceptance_id → null via the FK's `set null`) rather than cascade-delete,
+ * so the individual round reports stay reachable; only the grouping goes.
+ */
+ remove: acceptanceWriteProcedure
+ .input(z.object({ id: z.string() }))
+ .mutation(async ({ ctx, input }) => {
+ const acceptance = await resolveAcceptance(ctx, input.id);
+ assertWorkspaceRowManageable(ctx, acceptance.userId, 'acceptance');
+
+ await ctx.acceptanceService.acceptanceModel.delete(acceptance.id);
+ return { success: true };
+ }),
});
diff --git a/apps/server/src/services/verify/acceptanceService.ts b/apps/server/src/services/verify/acceptanceService.ts
index 78446f50df6..973de13f34b 100644
--- a/apps/server/src/services/verify/acceptanceService.ts
+++ b/apps/server/src/services/verify/acceptanceService.ts
@@ -689,17 +689,23 @@ export class AcceptanceService {
/** Best-effort subject header info for the bundle (title may be gone). */
resolveSubject = async (acceptance: AcceptanceItem): Promise<AcceptanceSubjectSummary> => {
- let title: string | null = null;
- try {
- title =
- (
- await this.findSubject(
- acceptance.subjectType as AcceptanceSubjectType,
- acceptance.subjectId,
- )
- )?.title ?? null;
- } catch (error) {
- log('resolveSubject failed (non-fatal): %O', error);
+ // A user rename wins over the subject's own title — the sidebar entry is
+ // renamed without touching the source topic/task/document.
+ const override = acceptance.metadata?.title;
+ let title: string | null =
+ typeof override === 'string' && override.trim() ? override.trim() : null;
+ if (!title) {
+ try {
+ title =
+ (
+ await this.findSubject(
+ acceptance.subjectType as AcceptanceSubjectType,
+ acceptance.subjectId,
+ )
+ )?.title ?? null;
+ } catch (error) {
+ log('resolveSubject failed (non-fatal): %O', error);
+ }
}
return {
id: acceptance.subjectId,
@@ -708,15 +714,53 @@ export class AcceptanceService {
};
};
+ /**
+ * The latest round's total-check count per acceptance — a cheap glance for the
+ * list panel (two batched reads, never a per-row union recompute). The signed-
+ * off/accepted count would need the cross-round union per row, which is far too
+ * heavy for a list, so the panel shows the total and leans on the row's status
+ * glyph for the decision state.
+ */
+ private latestCheckCounts = async (acceptanceIds: string[]): Promise<Map<string, number>> => {
+ const out = new Map<string, number>();
+ if (acceptanceIds.length === 0) return out;
+
+ const runs = await this.db.query.verifyRuns.findMany({
+ columns: { acceptanceId: true, id: true, roundIndex: true },
+ where: (run, { inArray }) => inArray(run.acceptanceId, acceptanceIds),
+ });
+ const latest = new Map<string, { id: string; round: number }>();
+ for (const run of runs) {
+ if (!run.acceptanceId) continue;
+ const round = run.roundIndex ?? 0;
+ const cur = latest.get(run.acceptanceId);
+ if (!cur || round > cur.round) latest.set(run.acceptanceId, { id: run.id, round });
+ }
+
+ const reports = await this.reportModel.findByRuns([...latest.values()].map((v) => v.id));
+ const totalByRun = new Map(reports.map((report) => [report.verifyRunId, report.totalChecks]));
+ for (const [acceptanceId, { id: runId }] of latest) {
+ const total = totalByRun.get(runId);
+ if (total != null) out.set(acceptanceId, total);
+ }
+ return out;
+ };
+
/**
* Recent aggregates with their subject headers — the list-panel payload.
* Titles resolve in parallel per row (bounded by the list limit); a deleted
- * subject degrades to a null title instead of dropping the row.
+ * subject degrades to a null title instead of dropping the row. Each row also
+ * carries the latest round's check count for the panel's at-a-glance line.
*/
listWithSubjects = async (limit = 50) => {
const rows = await this.acceptanceModel.query(limit);
+ const checkCounts = await this.latestCheckCounts(rows.map((row) => row.id));
return Promise.all(
- rows.map(async (row) => ({ ...row, subject: await this.resolveSubject(row) })),
+ rows.map(async (row) => ({
+ ...row,
+ checkCount: checkCounts.get(row.id) ?? null,
+ subject: await this.resolveSubject(row),
+ })),
);
};
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.json
index 4150c4daa54..71e634d6ce8 100644
--- a/locales/en-US/verify.json
+++ b/locales/en-US/verify.json
@@ -22,6 +22,7 @@
"acceptance.bar.copied": "Copied — paste it to any agent to start the repair.",
"acceptance.bar.copyReview": "Copy review prompt",
"acceptance.bar.feedback": "Feedback {{count}}",
+ "acceptance.bar.needsFix": "All reviewed — {{count}} to fix",
"acceptance.bar.progress": "Confirmed {{done}} / {{total}} checks — {{rest}} awaiting your review",
"acceptance.bar.progressDone": "All {{total}} checks confirmed — ready to accept",
"acceptance.bar.progressZero": "{{total}} checks awaiting your review",
@@ -79,12 +80,13 @@
"acceptance.group.uncategorized": "Other requirements",
"acceptance.history.jump": "Round {{round}} — click to locate it in the ledger",
"acceptance.latestSummary": "Latest report summary",
+ "acceptance.ledger.accepted": "Accepted",
+ "acceptance.ledger.acceptedStats": "{{accepted}}/{{total}} accepted",
+ "acceptance.ledger.awaitingStats": "{{total}} awaiting review",
"acceptance.ledger.collapse": "Collapse the round ledger",
- "acceptance.ledger.count": "{{count}} round(s)",
- "acceptance.ledger.description": "Each round is one full verification run; the main list is the cross-round merge. Trace the full history here.",
"acceptance.ledger.expand": "Expand the round ledger",
"acceptance.ledger.latest": "Latest",
- "acceptance.ledger.stats": "{{passed}}/{{total}} passed",
+ "acceptance.ledger.pending": "Awaiting review",
"acceptance.ledger.title": "Round ledger",
"acceptance.ledger.viewReport": "View round report",
"acceptance.origin.agentFallback": "Agent",
@@ -149,10 +151,27 @@
"acceptance.verdict.inProgress": "Acceptance in progress",
"acceptance.verdict.latestAt": "last verified {{time}}",
"acceptance.viewFullReport": "View full report",
+ "acceptance.workspace.actions.delete": "Delete",
+ "acceptance.workspace.actions.markAccepted": "Mark as accepted",
+ "acceptance.workspace.actions.markRejected": "Mark as rejected",
+ "acceptance.workspace.actions.more": "More actions",
+ "acceptance.workspace.actions.rename": "Rename",
+ "acceptance.workspace.actions.reopen": "Reopen for review",
+ "acceptance.workspace.actions.status": "Change status",
+ "acceptance.workspace.checkCount": "{{count}} checks",
+ "acceptance.workspace.deleteConfirmDescription": "Delete the acceptance “{{title}}”? Its verification rounds are kept — they detach into standalone reports.",
+ "acceptance.workspace.deleteConfirmTitle": "Delete acceptance",
+ "acceptance.workspace.deleteError": "Failed to delete acceptance",
+ "acceptance.workspace.deleteSuccess": "Acceptance deleted",
"acceptance.workspace.emptyDetail.description": "Pick an acceptance on the left to review its checks, rounds and evidence.",
"acceptance.workspace.emptyDetail.title": "Select an acceptance",
"acceptance.workspace.listEmpty": "Ingest a verification report with the CLI and its acceptance will show up here.",
"acceptance.workspace.listEmptyTitle": "No acceptances yet",
+ "acceptance.workspace.renameEmpty": "The title cannot be empty",
+ "acceptance.workspace.renameError": "Failed to rename",
+ "acceptance.workspace.renameSuccess": "Renamed",
+ "acceptance.workspace.statusError": "Failed to update status",
+ "acceptance.workspace.statusSuccess": "Status updated",
"acceptance.workspace.title": "Acceptances",
"badge.errored": "Check could not run",
"badge.failed": "Check failed",
diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.json
index 5dc99dac3ef..f4b7907884d 100644
--- a/locales/zh-CN/verify.json
+++ b/locales/zh-CN/verify.json
@@ -22,6 +22,7 @@
"acceptance.bar.copied": "已复制,粘贴给任意 agent 即可开始修复。",
"acceptance.bar.copyReview": "复制 review 建议",
"acceptance.bar.feedback": "反馈 {{count}}",
+ "acceptance.bar.needsFix": "已全部评审 · {{count}} 项待修复",
"acceptance.bar.progress": "已完成 {{done}} / {{total}} 项验证项,剩余 {{rest}} 项等待你的验收",
"acceptance.bar.progressDone": "{{total}} 项验证项已全部确认,可以接受交付",
"acceptance.bar.progressZero": "共 {{total}} 项等待你的验收",
@@ -79,12 +80,13 @@
"acceptance.group.uncategorized": "其他需求",
"acceptance.history.jump": "第 {{round}} 轮——点击在轮次审计中定位",
"acceptance.latestSummary": "最新报告摘要",
+ "acceptance.ledger.accepted": "已验收",
+ "acceptance.ledger.acceptedStats": "{{accepted}}/{{total}} 已验收",
+ "acceptance.ledger.awaitingStats": "{{total}} 项等待验收",
"acceptance.ledger.collapse": "收起轮次审计",
- "acceptance.ledger.count": "{{count}} 轮",
- "acceptance.ledger.description": "每轮是一次完整验证(verify run),左侧清单是跨轮归并后的最终态;完整执行史在这里追查。",
"acceptance.ledger.expand": "展开轮次审计",
"acceptance.ledger.latest": "最新",
- "acceptance.ledger.stats": "{{passed}}/{{total}} 通过",
+ "acceptance.ledger.pending": "待验收",
"acceptance.ledger.title": "轮次审计",
"acceptance.ledger.viewReport": "查看该轮报告",
"acceptance.origin.agentFallback": "智能体",
@@ -149,10 +151,27 @@
"acceptance.verdict.inProgress": "验收进行中",
"acceptance.verdict.latestAt": "最近验证 {{time}}",
"acceptance.viewFullReport": "查看完整报告",
+ "acceptance.workspace.actions.delete": "删除",
+ "acceptance.workspace.actions.markAccepted": "标记为已验收",
+ "acceptance.workspace.actions.markRejected": "标记为已打回",
+ "acceptance.workspace.actions.more": "更多操作",
+ "acceptance.workspace.actions.rename": "重命名",
+ "acceptance.workspace.actions.reopen": "重新打开验收",
+ "acceptance.workspace.actions.status": "修改状态",
+ "acceptance.workspace.checkCount": "{{count}} 项验收项",
+ "acceptance.workspace.deleteConfirmDescription": "确定删除验收「{{title}}」吗?各轮验证记录会保留,并拆分为独立的报告。",
+ "acceptance.workspace.deleteConfirmTitle": "删除验收",
+ "acceptance.workspace.deleteError": "删除验收失败",
+ "acceptance.workspace.deleteSuccess": "验收已删除",
"acceptance.workspace.emptyDetail.description": "在左侧选择一条验收记录,查看它的检查项、轮次与证据。",
"acceptance.workspace.emptyDetail.title": "选择一条验收",
"acceptance.workspace.listEmpty": "用 CLI ingest 一份验证报告后,对应的验收会出现在这里。",
"acceptance.workspace.listEmptyTitle": "还没有验收记录",
+ "acceptance.workspace.renameEmpty": "标题不能为空",
+ "acceptance.workspace.renameError": "重命名失败",
+ "acceptance.workspace.renameSuccess": "已重命名",
+ "acceptance.workspace.statusError": "状态更新失败",
+ "acceptance.workspace.statusSuccess": "状态已更新",
"acceptance.workspace.title": "验收",
"badge.errored": "检查无法运行",
"badge.failed": "检查未通过",
diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.ts
index fa69f533a0a..7ea1d69087a 100644
--- a/packages/locales/src/default/verify.ts
+++ b/packages/locales/src/default/verify.ts
@@ -29,6 +29,7 @@ export default {
'acceptance.bar.copied': 'Copied — paste it to any agent to start the repair.',
'acceptance.bar.copyReview': 'Copy review prompt',
'acceptance.bar.feedback': 'Feedback {{count}}',
+ 'acceptance.bar.needsFix': 'All reviewed — {{count}} to fix',
'acceptance.bar.progress':
'Confirmed {{done}} / {{total}} checks — {{rest}} awaiting your review',
'acceptance.bar.progressDone': 'All {{total}} checks confirmed — ready to accept',
@@ -93,13 +94,13 @@ export default {
'acceptance.group.uncategorized': 'Other requirements',
'acceptance.history.jump': 'Round {{round}} — click to locate it in the ledger',
'acceptance.latestSummary': 'Latest report summary',
+ 'acceptance.ledger.accepted': 'Accepted',
+ 'acceptance.ledger.acceptedStats': '{{accepted}}/{{total}} accepted',
+ 'acceptance.ledger.awaitingStats': '{{total}} awaiting review',
'acceptance.ledger.collapse': 'Collapse the round ledger',
- 'acceptance.ledger.count': '{{count}} round(s)',
- 'acceptance.ledger.description':
- 'Each round is one full verification run; the main list is the cross-round merge. Trace the full history here.',
'acceptance.ledger.expand': 'Expand the round ledger',
'acceptance.ledger.latest': 'Latest',
- 'acceptance.ledger.stats': '{{passed}}/{{total}} passed',
+ 'acceptance.ledger.pending': 'Awaiting review',
'acceptance.ledger.title': 'Round ledger',
'acceptance.ledger.viewReport': 'View round report',
'acceptance.origin.agentFallback': 'Agent',
@@ -169,12 +170,30 @@ export default {
'acceptance.verdict.inProgress': 'Acceptance in progress',
'acceptance.verdict.latestAt': 'last verified {{time}}',
'acceptance.viewFullReport': 'View full report',
+ 'acceptance.workspace.actions.delete': 'Delete',
+ 'acceptance.workspace.actions.markAccepted': 'Mark as accepted',
+ 'acceptance.workspace.actions.markRejected': 'Mark as rejected',
+ 'acceptance.workspace.actions.more': 'More actions',
+ 'acceptance.workspace.actions.rename': 'Rename',
+ 'acceptance.workspace.actions.reopen': 'Reopen for review',
+ 'acceptance.workspace.actions.status': 'Change status',
+ 'acceptance.workspace.checkCount': '{{count}} checks',
+ 'acceptance.workspace.deleteConfirmDescription':
+ 'Delete the acceptance “{{title}}”? Its verification rounds are kept — they detach into standalone reports.',
+ 'acceptance.workspace.deleteConfirmTitle': 'Delete acceptance',
+ 'acceptance.workspace.deleteError': 'Failed to delete acceptance',
+ 'acceptance.workspace.deleteSuccess': 'Acceptance deleted',
'acceptance.workspace.emptyDetail.description':
'Pick an acceptance on the left to review its checks, rounds and evidence.',
'acceptance.workspace.emptyDetail.title': 'Select an acceptance',
'acceptance.workspace.listEmpty':
'Ingest a verification report with the CLI and its acceptance will show up here.',
'acceptance.workspace.listEmptyTitle': 'No acceptances yet',
+ 'acceptance.workspace.renameEmpty': 'The title cannot be empty',
+ 'acceptance.workspace.renameError': 'Failed to rename',
+ 'acceptance.workspace.renameSuccess': 'Renamed',
+ 'acceptance.workspace.statusError': 'Failed to update status',
+ 'acceptance.workspace.statusSuccess': 'Status updated',
'acceptance.workspace.title': 'Acceptances',
'report.actions.copyLink': 'Copy link',
'report.actions.copyLinkSuccess': 'Link copied',
diff --git a/packages/types/src/verify.ts b/packages/types/src/verify.ts
index 8008bdc1b15..7a901892dbb 100644
--- a/packages/types/src/verify.ts
+++ b/packages/types/src/verify.ts
@@ -141,6 +141,8 @@ export type VerifyRunGroupFeedbackEntry = Omit<AcceptanceGroupFeedback, 'roundIn
/** Generic acceptance extension bag for cross-subject state we have not modeled yet. */
export interface AcceptanceMetadata {
[key: string]: unknown;
+ /** User-set display-title override for the acceptance (sidebar rename). */
+ title?: string;
}
/**
diff --git a/src/features/Verify/Acceptance/CheckRejectModal.tsx b/src/features/Verify/Acceptance/CheckRejectModal.tsx
index 8b2bd8e335f..ee73242e0bc 100644
--- a/src/features/Verify/Acceptance/CheckRejectModal.tsx
+++ b/src/features/Verify/Acceptance/CheckRejectModal.tsx
@@ -93,9 +93,12 @@ const styles = createStaticStyles(({ css }) => ({
thumbActive: css`
border-color: ${cssVar.colorPrimary};
`,
- /** The fullscreen zoom stage — its native scrolling doubles as panning. */
+ /** The fullscreen zoom stage — its native scrolling doubles as panning.
+ Flex + the inner frame's `margin: auto` keeps the image centered when it
+ fits the stage, and scrolls from the edges once it grows past it. */
viewport: css`
overflow: auto;
+ display: flex;
flex: 1;
min-width: 0;
@@ -104,6 +107,11 @@ const styles = createStaticStyles(({ css }) => ({
background: ${cssVar.colorFillQuaternary};
`,
+ /** The centered image frame inside the stage — `margin: auto` absorbs the
+ free space on both axes (centering) and collapses to 0 on overflow. */
+ viewportInner: css`
+ margin: auto;
+ `,
/** The zoom pill floats bottom-center over the stage — controls live with
the thing they control, not in a detached toolbar row. */
zoomBar: css`
@@ -425,16 +433,18 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
onChange={(event) => setComment(event.target.value)}
onPaste={handlePaste}
/>
- {/* One row hugging the input — the thumbnails and the picker
- belong to the note they back, not to the modal footer. */}
- <Flexbox horizontal align={'center'} gap={8} wrap={'wrap'}>
+ {/* The picker sits on its own row right under the input; the
+ thumbnails stack BELOW it. Keeping them on separate rows means
+ the button never shifts as screenshots pile up — its position
+ is fixed, independent of the attachment count. */}
+ <Flexbox align={'flex-start'} gap={8}>
+ <AttachmentUploadButton disabled={loading} onFiles={uploadFiles} />
<AttachmentStrip
attachments={attachments}
disabled={loading}
uploading={uploading}
onRemove={remove}
/>
- <AttachmentUploadButton disabled={loading} onFiles={uploadFiles} />
</Flexbox>
</Flexbox>
</Flexbox>
@@ -492,16 +502,18 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
{thumbnails}
<div className={styles.fullscreenBody} style={{ position: 'relative' }}>
<div className={styles.viewport} ref={viewportRef}>
- <AnnotationCanvas
- annotations={activeAnnotations}
- src={activeEvidence.fileUrl}
- imageWidth={
- // -2 keeps the frame's own border inside the viewport at
- // fit zoom, so no phantom horizontal scrollbar.
- viewportWidth ? Math.max(viewportWidth * zoom - 2, 0) : undefined
- }
- {...canvasHandlers}
- />
+ <div className={styles.viewportInner}>
+ <AnnotationCanvas
+ annotations={activeAnnotations}
+ src={activeEvidence.fileUrl}
+ imageWidth={
+ // -2 keeps the frame's own border inside the viewport at
+ // fit zoom, so no phantom horizontal scrollbar.
+ viewportWidth ? Math.max(viewportWidth * zoom - 2, 0) : undefined
+ }
+ {...canvasHandlers}
+ />
+ </div>
</div>
<div className={styles.zoomBar}>
<ActionIcon
diff --git a/src/features/Verify/Acceptance/DecisionBar.tsx b/src/features/Verify/Acceptance/DecisionBar.tsx
index 0daff29facd..e12a20f739e 100644
--- a/src/features/Verify/Acceptance/DecisionBar.tsx
+++ b/src/features/Verify/Acceptance/DecisionBar.tsx
@@ -3,7 +3,7 @@
import { Flexbox, Icon, Text } from '@lobehub/ui';
import { Button } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
-import { BadgeCheck, ListTodo, Loader2, RotateCcw } from 'lucide-react';
+import { BadgeCheck, CircleAlert, ListTodo, Loader2, RefreshCw, RotateCcw } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -16,7 +16,7 @@ const styles = createStaticStyles(({ css }) => ({
inset-block-end: 16px;
display: flex;
- gap: 14px;
+ gap: 10px;
align-items: center;
padding-block: 12px;
@@ -27,16 +27,6 @@ const styles = createStaticStyles(({ css }) => ({
background: ${cssVar.colorBgElevated};
box-shadow: ${cssVar.boxShadowSecondary};
`,
- glyph: css`
- display: flex;
- flex: none;
- align-items: center;
- justify-content: center;
-
- width: 36px;
- height: 36px;
- border-radius: 50%;
- `,
}));
type BarState = 'accepted' | 'live' | 'rejected' | 'settled';
@@ -47,8 +37,8 @@ type BarState = 'accepted' | 'live' | 'rejected' | 'settled';
* rendered by the bar as the BadgeCheck disc, not here.
*/
const ProgressRing = memo<{ done: number; total: number }>(({ done, total }) => {
- const size = 36;
- const stroke = 3.5;
+ const size = 20;
+ const stroke = 2;
const radius = (size - stroke) / 2;
const circumference = 2 * Math.PI * radius;
const ratio = total > 0 ? Math.min(done / total, 1) : 0;
@@ -111,6 +101,8 @@ interface DecisionBarProps {
acceptedCount: number;
/** Active (not-yet-consumed) feedback recorded this round. */
feedbackCount: number;
+ /** Checks the user reviewed as needing a fix (待修复) — decided, not pending. */
+ needsFixCount: number;
onAccept: () => void;
/** Copy the hardcoded repair prompt for pasting to any agent. */
onCopyReview: () => void;
@@ -120,6 +112,9 @@ interface DecisionBarProps {
/** Dispatch the repair prompt straight into the origin agent conversation. */
onRerun: () => void;
pending: boolean;
+ /** A live round that is a dispatched repair — coloured as an in-progress task
+ (warning), not a neutral verify, to match the system's task-process cue. */
+ repairing?: boolean;
/** The origin conversation is known — the rerun dispatch has a target. */
rerunAvailable: boolean;
rerunPending: boolean;
@@ -142,12 +137,14 @@ const DecisionBar = memo<DecisionBarProps>(
({
acceptedCount,
feedbackCount,
+ needsFixCount,
onAccept,
onCopyReview,
onOpenFeedback,
onRejectComment,
onRerun,
pending,
+ repairing,
rerunAvailable,
rerunPending,
state,
@@ -158,33 +155,45 @@ const DecisionBar = memo<DecisionBarProps>(
const { t } = useTranslation('verify');
const stateMeta = {
- accepted: { bg: cssVar.colorSuccessBg, color: cssVar.colorSuccess, icon: BadgeCheck },
- live: { bg: cssVar.colorInfoBg, color: cssVar.colorInfo, icon: Loader2 },
- rejected: { bg: cssVar.colorErrorBg, color: cssVar.colorError, icon: RotateCcw },
+ accepted: { color: cssVar.colorSuccess, icon: BadgeCheck },
+ // A repair round is an in-progress TASK — warn-coloured refresh, matching
+ // the task-process cue; a plain verify stays neutral info.
+ live: repairing
+ ? { color: cssVar.colorWarning, icon: RefreshCw }
+ : { color: cssVar.colorInfo, icon: Loader2 },
+ rejected: { color: cssVar.colorError, icon: RotateCcw },
settled: null,
}[state];
const allConfirmed = totalCount > 0 && acceptedCount >= totalCount;
const hasFeedback = feedbackCount > 0;
+ // The dial tracks DECIDED checks (accepted + 待修复), so a fully-reviewed
+ // union reads as done even when some checks still need a fix.
+ const decidedCount = acceptedCount + needsFixCount;
+ // Every check reviewed, but some need a fix — a review outcome, not a
+ // success and not "still awaiting". Reads as an attention mark, never the
+ // near-complete progress dial that made the state look like an all-clear.
+ const settledNeedsFix =
+ state === 'settled' && !allConfirmed && decidedCount >= totalCount && needsFixCount > 0;
return (
<div className={styles.bar}>
- {stateMeta || allConfirmed ? (
- // A fully signed-off review earns the badge, not a maxed-out dial —
- // the same mark the accepted state carries.
- <div
- className={styles.glyph}
- style={{ background: stateMeta?.bg ?? cssVar.colorSuccessBg }}
- >
- <Icon
- color={stateMeta?.color ?? cssVar.colorSuccess}
- icon={stateMeta?.icon ?? BadgeCheck}
- size={18}
- spin={state === 'live'}
- />
- </div>
+ {stateMeta ? (
+ // accepted / live / rejected — a plain coloured status mark.
+ <Icon
+ color={stateMeta.color}
+ icon={stateMeta.icon}
+ size={22}
+ spin={state === 'live'}
+ style={{ flex: 'none' }}
+ />
+ ) : allConfirmed ? (
+ // Every check signed off — the same clean badge the accepted state carries.
+ <Icon color={cssVar.colorSuccess} icon={BadgeCheck} size={22} style={{ flex: 'none' }} />
+ ) : settledNeedsFix ? (
+ <Icon color={cssVar.colorWarning} icon={CircleAlert} size={22} style={{ flex: 'none' }} />
) : (
- <ProgressRing done={acceptedCount} total={totalCount} />
+ <ProgressRing done={decidedCount} total={totalCount} />
)}
<Flexbox gap={2} style={{ flex: 1, minWidth: 0 }}>
<Text ellipsis strong style={{ fontSize: 14 }}>
diff --git a/src/features/Verify/Acceptance/FeedbackDrawer.tsx b/src/features/Verify/Acceptance/FeedbackDrawer.tsx
index cee61f99350..9eddb445f58 100644
--- a/src/features/Verify/Acceptance/FeedbackDrawer.tsx
+++ b/src/features/Verify/Acceptance/FeedbackDrawer.tsx
@@ -27,7 +27,7 @@ const styles = createStaticStyles(({ css }) => ({
The drawer is an audit trail; rows read as entries in a ledger. Roomy
vertical rhythm: cramped rows made the trail read as one dense block. */
row: css`
- padding-block: 14px;
+ padding-block: 20px;
padding-inline: 8px;
border-block-end: 1px solid ${cssVar.colorBorderSecondary};
border-radius: ${cssVar.borderRadius};
@@ -96,7 +96,7 @@ const EntryRow = memo<{
return (
<Flexbox
className={cx(styles.row, entry.checkId && styles.clickable)}
- gap={6}
+ gap={8}
style={entry.stale ? { opacity: 0.55 } : undefined}
onClick={entry.checkId ? () => onJumpToCheck(entry.checkId!) : undefined}
>
diff --git a/src/features/Verify/Acceptance/LedgerPanel.tsx b/src/features/Verify/Acceptance/LedgerPanel.tsx
index dbaab253f5e..7586093af95 100644
--- a/src/features/Verify/Acceptance/LedgerPanel.tsx
+++ b/src/features/Verify/Acceptance/LedgerPanel.tsx
@@ -6,13 +6,12 @@ import dayjs from 'dayjs';
import {
CheckCircle2,
ChevronRight,
+ Circle,
CircleAlert,
FileClock,
- HelpCircle,
Loader2,
PanelRightClose,
- Wrench,
- XCircle,
+ RefreshCw,
} from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -21,7 +20,24 @@ import type { AcceptanceBundle } from '@/services/verify';
export type AcceptanceRound = AcceptanceBundle['rounds'][number];
+/** Per-round acceptance tally (how many of the round's own checks the user signed off). */
+export interface RoundReview {
+ accepted: number;
+ total: number;
+}
+
const styles = createStaticStyles(({ css }) => ({
+ countBadge: css`
+ padding-block: 1px;
+ padding-inline: 7px;
+ border-radius: 99px;
+
+ font-size: 12px;
+ font-variant-numeric: tabular-nums;
+ color: ${cssVar.colorTextSecondary};
+
+ background: ${cssVar.colorFillTertiary};
+ `,
round: css`
padding-block: 10px;
padding-inline: 12px;
@@ -56,21 +72,20 @@ const styles = createStaticStyles(({ css }) => ({
`,
}));
-const STATUS_META: Record<string, { color: string; icon: typeof CheckCircle2 }> = {
+/** Only the still-running states keep a machine indicator; a settled round is
+ reframed as an ACCEPTANCE state (已验收 / 待验收), not a verification verdict. */
+const RUNNING_META: Record<string, { color: string; icon: typeof CheckCircle2 }> = {
errored: { color: cssVar.colorWarning, icon: CircleAlert },
- failed: { color: cssVar.colorError, icon: XCircle },
- passed: { color: cssVar.colorSuccess, icon: CheckCircle2 },
- repairing: { color: cssVar.colorInfo, icon: Wrench },
- uncertain: { color: cssVar.colorWarning, icon: HelpCircle },
+ repairing: { color: cssVar.colorWarning, icon: RefreshCw },
verifying: { color: cssVar.colorInfo, icon: Loader2 },
};
-/** The round's settled state for the ledger — report verdict beats a null rollup. */
-const roundStatus = (round: AcceptanceRound): string => {
+/** Is the round still executing (so it has no settled result to accept yet)? */
+const isRunningRound = (round: AcceptanceRound): boolean => {
const status = round.run.status;
- if (status === 'passed' || status === 'failed' || status === 'errored') return status;
- if (status === 'repairing' || status === 'verifying') return status;
- return round.report?.verdict ?? (round.report ? 'passed' : 'verifying');
+ if (status === 'verifying' || status === 'repairing' || status === 'errored') return true;
+ // No report yet and no terminal status → still spinning up.
+ return !round.report && status !== 'passed' && status !== 'failed';
};
interface LedgerPanelProps {
@@ -80,16 +95,19 @@ interface LedgerPanelProps {
highlight: number | null;
onCollapse: () => void;
onOpenReport: (round: AcceptanceRound) => void;
+ /** Per-round acceptance tally, keyed by round index (the round's own checks). */
+ reviewByRound: Map<number, RoundReview>;
rounds: AcceptanceRound[];
}
/**
- * The execution history, demoted to an audit side panel (P-13): each round is a
- * full verify run; the main list is the cross-round merge. Newest round first —
- * the latest attempt is the one under judgment.
+ * The execution history, demoted to an audit side panel (P-13). Each row is a
+ * round; the state it reports is the user's ACCEPTANCE progress on that round's
+ * checks (已验收 / 待验收), not the raw verification verdict — the panel speaks
+ * the same acceptance language as the checklist.
*/
const LedgerPanel = memo<LedgerPanelProps>(
- ({ hideCollapse, highlight, onCollapse, onOpenReport, rounds }) => {
+ ({ hideCollapse, highlight, onCollapse, onOpenReport, reviewByRound, rounds }) => {
const { t } = useTranslation('verify');
const latestIndex = rounds.at(-1)?.run.roundIndex;
@@ -100,9 +118,7 @@ const LedgerPanel = memo<LedgerPanelProps>(
<Text strong style={{ fontSize: 13 }}>
{t('acceptance.ledger.title')}
</Text>
- <Text fontSize={12} type={'secondary'}>
- {t('acceptance.ledger.count', { count: rounds.length })}
- </Text>
+ <span className={styles.countBadge}>{rounds.length}</span>
<Flexbox flex={1} />
{!hideCollapse && (
<ActionIcon
@@ -113,20 +129,38 @@ const LedgerPanel = memo<LedgerPanelProps>(
/>
)}
</Flexbox>
- <Text fontSize={12} type={'secondary'}>
- {t('acceptance.ledger.description')}
- </Text>
{[...rounds].reverse().map((round) => {
- const status = roundStatus(round);
- const meta = STATUS_META[status] ?? STATUS_META.verifying;
+ const running = isRunningRound(round);
+ const runStatus = round.run.status ?? 'verifying';
+ const runningMeta = running ? (RUNNING_META[runStatus] ?? RUNNING_META.verifying) : null;
+ const rv =
+ round.run.roundIndex != null ? reviewByRound.get(round.run.roundIndex) : undefined;
+ const total = rv?.total ?? 0;
+ const accepted = rv?.accepted ?? 0;
+ const allAccepted = total > 0 && accepted >= total;
+
+ const stateColor = runningMeta
+ ? runningMeta.color
+ : allAccepted
+ ? cssVar.colorSuccess
+ : cssVar.colorTextTertiary;
+ const stateIcon = runningMeta ? runningMeta.icon : allAccepted ? CheckCircle2 : Circle;
+ const stateLabel = runningMeta
+ ? t(`acceptance.roundStatus.${runStatus}` as 'acceptance.roundStatus.verifying', {
+ defaultValue: runStatus,
+ })
+ : allAccepted
+ ? t('acceptance.ledger.accepted')
+ : t('acceptance.ledger.pending');
+
+ // Acceptance-framed stats: how many of THIS round's checks are signed
+ // off (accepted/total), or all still awaiting.
const stats =
- round.report?.totalChecks != null
- ? t('acceptance.ledger.stats', {
- passed: round.report.passedChecks ?? 0,
- total: round.report.totalChecks,
- })
- : null;
- const commit = (round.run.context as { commit?: string } | null)?.commit;
+ running || total === 0
+ ? null
+ : accepted > 0
+ ? t('acceptance.ledger.acceptedStats', { accepted, total })
+ : t('acceptance.ledger.awaitingStats', { total });
const openable = Boolean(round.report);
@@ -156,10 +190,10 @@ const LedgerPanel = memo<LedgerPanelProps>(
horizontal
align={'center'}
gap={4}
- style={{ color: meta.color, fontSize: 12 }}
+ style={{ color: stateColor, fontSize: 12 }}
>
- <Icon icon={meta.icon} size={13} />
- {t(`acceptance.roundStatus.${status}`, { defaultValue: status })}
+ <Icon icon={stateIcon} size={13} spin={running} />
+ {stateLabel}
</Flexbox>
<Flexbox flex={1} />
<Text fontSize={12} type={'secondary'}>
@@ -179,9 +213,9 @@ const LedgerPanel = memo<LedgerPanelProps>(
{round.run.title}
</Text>
)}
- {(stats || commit) && (
+ {stats && (
<Text fontSize={12} type={'secondary'}>
- {[stats, commit?.slice(0, 10)].filter(Boolean).join(' · ')}
+ {stats}
</Text>
)}
</Flexbox>
diff --git a/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsx b/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsx
index 57b6e989625..4f0d99370c2 100644
--- a/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsx
+++ b/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsx
@@ -2,6 +2,7 @@
import type { AcceptanceStatus } from '@lobechat/types';
import {
+ ActionIcon,
Center,
DraggablePanel,
DraggablePanelContainer,
@@ -11,26 +12,39 @@ import {
Icon,
Text,
} from '@lobehub/ui';
+import type { DropdownItem } from '@lobehub/ui/base-ui';
+import { confirmModal, DropdownMenu } from '@lobehub/ui/base-ui';
+import { App } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
import dayjs from 'dayjs';
import isEqual from 'fast-deep-equal';
import {
BadgeCheck,
+ CircleCheck,
CircleDashed,
CircleHelp,
CircleX,
LoaderCircle,
+ MoreHorizontal,
PanelLeftClose,
+ Pencil,
+ RefreshCw,
+ RotateCcw,
ScrollText,
Search,
+ Trash2,
TriangleAlert,
} from 'lucide-react';
-import { memo, useState } from 'react';
+import { memo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate, useParams } from 'react-router';
import NavItem from '@/features/NavPanel/components/NavItem';
import { SkeletonList } from '@/features/NavPanel/components/SkeletonList';
+import { mutate as globalMutate } from '@/libs/swr';
+import { verifyKeys } from '@/libs/swr/keys';
+import type { AcceptanceListItem } from '@/services/verify';
+import { verifyService } from '@/services/verify';
import { useGlobalStore } from '@/store/global';
import { systemStatusSelectors } from '@/store/global/selectors';
@@ -158,6 +172,29 @@ const styles = createStaticStyles(({ css }) => ({
font-size: 12px;
color: ${cssVar.colorTextTertiary};
`,
+ editRow: css`
+ padding-block: 4px;
+ padding-inline: 4px;
+ `,
+ itemTitleInput: css`
+ width: 100%;
+ min-width: 0;
+ height: 24px;
+ padding-inline: 6px;
+ border: 1px solid ${cssVar.colorBorder};
+ border-radius: 4px;
+
+ font-size: 13px;
+ color: ${cssVar.colorText};
+
+ background: ${cssVar.colorBgContainer};
+ outline: none;
+
+ &:focus {
+ border-color: ${cssVar.colorPrimary};
+ box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBg};
+ }
+ `,
emptyState: css`
height: 100%;
min-height: 240px;
@@ -184,7 +221,7 @@ const styles = createStaticStyles(({ css }) => ({
`,
}));
-type Glyph = 'awaiting' | 'bad' | 'unsure' | 'running' | 'accepted';
+type Glyph = 'awaiting' | 'bad' | 'unsure' | 'running' | 'repairing' | 'accepted';
const RUNNING_STATUSES = new Set<AcceptanceStatus>([
'pending',
@@ -194,6 +231,9 @@ const RUNNING_STATUSES = new Set<AcceptanceStatus>([
]);
const glyphOf = (status: AcceptanceStatus): Glyph => {
+ // A repair round is an in-progress TASK, distinct from a neutral verify —
+ // warn-coloured, matching the system's task-process cue.
+ if (status === 'repairing') return 'repairing';
if (RUNNING_STATUSES.has(status)) return 'running';
if (status === 'accepted') return 'accepted';
if (status === 'rejected') return 'bad';
@@ -201,6 +241,8 @@ const glyphOf = (status: AcceptanceStatus): Glyph => {
return 'awaiting';
};
+const SPINNING_GLYPHS = new Set<Glyph>(['running', 'repairing']);
+
// Mirrors the detail header's verdict pill: a delivered-but-undecided
// aggregate reads as "acceptance in progress", never as a green all-clear
// the user hasn't given.
@@ -208,6 +250,7 @@ const glyphMeta: Record<Glyph, { color: string; icon: typeof BadgeCheck }> = {
accepted: { color: cssVar.colorSuccess, icon: BadgeCheck },
awaiting: { color: cssVar.colorInfo, icon: CircleDashed },
bad: { color: cssVar.colorError, icon: CircleX },
+ repairing: { color: cssVar.colorWarning, icon: RefreshCw },
running: { color: cssVar.colorInfo, icon: LoaderCircle },
unsure: { color: cssVar.colorWarning, icon: CircleHelp },
};
@@ -218,6 +261,229 @@ const relativeTime = (value?: Date | string | null) => {
return dayjs().diff(d, 'day') < 7 ? d.fromNow() : d.format('MMM D');
};
+/**
+ * One acceptance row: the status glyph + title + a hover `…` menu (rename in
+ * place, override the decision status, delete). Mirrors the verify workspace's
+ * ReportListItem so the two lists manage their entries the same way.
+ */
+const AcceptanceRow = memo<{
+ active: boolean;
+ item: AcceptanceListItem;
+ onChanged: () => Promise<unknown> | unknown;
+}>(({ active, item, onChanged }) => {
+ const { t } = useTranslation(['verify', 'common']);
+ const { message } = App.useApp();
+ const navigate = useNavigate();
+ const [editing, setEditing] = useState(false);
+ const [mutating, setMutating] = useState(false);
+ const isSavingRef = useRef(false);
+
+ const glyph = glyphOf(item.status as AcceptanceStatus);
+ const meta = glyphMeta[glyph];
+ const title = item.subject.title || item.subjectId;
+ const [draftTitle, setDraftTitle] = useState(title);
+
+ // A rename/status/delete must not leave a stale glyph or header behind — the
+ // list and the open detail both read the same aggregate.
+ const refresh = () =>
+ Promise.all([onChanged(), globalMutate(verifyKeys.acceptanceBundle(item.id))]);
+
+ const startRename = () => {
+ setDraftTitle(title);
+ setEditing(true);
+ };
+
+ const cancelRename = () => {
+ if (isSavingRef.current) return;
+ setDraftTitle(title);
+ setEditing(false);
+ };
+
+ const commitRename = async () => {
+ if (isSavingRef.current) return;
+ const next = draftTitle.trim();
+ if (!next) {
+ message.error(t('verify:acceptance.workspace.renameEmpty'));
+ setDraftTitle(title);
+ setEditing(false);
+ return;
+ }
+ if (next === title) {
+ setEditing(false);
+ return;
+ }
+ isSavingRef.current = true;
+ setMutating(true);
+ try {
+ await verifyService.renameAcceptance(item.id, next);
+ await refresh();
+ message.success(t('verify:acceptance.workspace.renameSuccess'));
+ setEditing(false);
+ } catch (error) {
+ console.error('[acceptance:rename]', error);
+ message.error(t('verify:acceptance.workspace.renameError'));
+ } finally {
+ isSavingRef.current = false;
+ setMutating(false);
+ }
+ };
+
+ const changeStatus = async (status: 'accepted' | 'delivered' | 'rejected') => {
+ setMutating(true);
+ try {
+ await verifyService.updateAcceptanceStatus(item.id, status);
+ await refresh();
+ message.success(t('verify:acceptance.workspace.statusSuccess'));
+ } catch (error) {
+ console.error('[acceptance:status]', error);
+ message.error(t('verify:acceptance.workspace.statusError'));
+ } finally {
+ setMutating(false);
+ }
+ };
+
+ const removeAcceptance = () => {
+ confirmModal({
+ cancelText: t('common:cancel'),
+ content: t('verify:acceptance.workspace.deleteConfirmDescription', { title }),
+ okButtonProps: { danger: true },
+ okText: t('common:delete'),
+ onOk: async () => {
+ setMutating(true);
+ try {
+ await verifyService.deleteAcceptance(item.id);
+ if (active) navigate('/acceptance', { replace: true });
+ await onChanged();
+ message.success(t('verify:acceptance.workspace.deleteSuccess'));
+ } catch (error) {
+ console.error('[acceptance:delete]', error);
+ message.error(t('verify:acceptance.workspace.deleteError'));
+ } finally {
+ setMutating(false);
+ }
+ },
+ title: t('verify:acceptance.workspace.deleteConfirmTitle'),
+ });
+ };
+
+ // The status action follows the CURRENT state — an awaiting delivery can be
+ // accepted; an already-decided one can be reopened; a still-running round
+ // offers nothing (accept/reject need a settled round, matching the server
+ // guard). Never "reopen" an acceptance that was never decided.
+ const statusItems: DropdownItem[] =
+ item.status === 'delivered' || item.status === 'errored'
+ ? [
+ {
+ icon: <Icon icon={CircleCheck} />,
+ key: 'accept',
+ label: t('verify:acceptance.workspace.actions.markAccepted'),
+ onClick: () => void changeStatus('accepted'),
+ },
+ ]
+ : item.status === 'accepted' || item.status === 'rejected'
+ ? [
+ {
+ icon: <Icon icon={RotateCcw} />,
+ key: 'reopen',
+ label: t('verify:acceptance.workspace.actions.reopen'),
+ onClick: () => void changeStatus('delivered'),
+ },
+ ]
+ : [];
+
+ const menuItems: DropdownItem[] = [
+ {
+ icon: <Icon icon={Pencil} />,
+ key: 'rename',
+ label: t('verify:acceptance.workspace.actions.rename'),
+ onClick: startRename,
+ },
+ ...statusItems,
+ ...(statusItems.length > 0 ? [{ type: 'divider' as const }] : []),
+ {
+ danger: true,
+ icon: <Icon icon={Trash2} />,
+ key: 'delete',
+ label: t('verify:acceptance.workspace.actions.delete'),
+ onClick: removeAcceptance,
+ },
+ ];
+
+ // Rename swaps the whole row for an inline input.
+ if (editing) {
+ return (
+ <div className={styles.editRow}>
+ <input
+ autoFocus
+ className={styles.itemTitleInput}
+ value={draftTitle}
+ onBlur={() => void commitRename()}
+ onChange={(e) => setDraftTitle(e.target.value)}
+ onFocus={(e) => e.currentTarget.select()}
+ onKeyDown={(e) => {
+ e.stopPropagation();
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ void commitRename();
+ }
+ if (e.key === 'Escape') {
+ e.preventDefault();
+ cancelRename();
+ }
+ }}
+ />
+ </div>
+ );
+ }
+
+ return (
+ <NavItem
+ active={active}
+ key={item.id}
+ style={mutating ? { opacity: 0.62, pointerEvents: 'none' } : undefined}
+ title={title}
+ titleColor={cssVar.colorText}
+ actions={
+ <DropdownMenu
+ iconSpaceMode={'group'}
+ items={menuItems}
+ placement={'bottomRight'}
+ popupProps={{ style: { minWidth: 160 } }}
+ >
+ <ActionIcon
+ icon={MoreHorizontal}
+ size={'small'}
+ title={t('verify:acceptance.workspace.actions.more')}
+ />
+ </DropdownMenu>
+ }
+ description={
+ <Flexbox horizontal className={styles.itemSub} gap={8}>
+ {/* The status glyph already carries the lifecycle state, so the
+ second line shows the check count instead of a redundant label. */}
+ <span>
+ {item.checkCount != null
+ ? t('acceptance.workspace.checkCount', { count: item.checkCount })
+ : t(`acceptance.status.${item.status}` as any)}
+ </span>
+ <span>{relativeTime(item.updatedAt ?? item.createdAt)}</span>
+ </Flexbox>
+ }
+ icon={
+ <Icon
+ className={SPINNING_GLYPHS.has(glyph) ? styles.spin : undefined}
+ icon={meta.icon}
+ size={16}
+ style={{ color: meta.color }}
+ />
+ }
+ onClick={() => navigate(`/acceptance/${item.id}`)}
+ />
+ );
+});
+
+AcceptanceRow.displayName = 'AcceptanceRow';
+
/**
* Master list of the caller's acceptance aggregates — the acceptance twin of
* the verify workspace's ReportListPanel, sharing its visual language and the
@@ -225,7 +491,6 @@ const relativeTime = (value?: Date | string | null) => {
*/
const AcceptanceListPanel = memo<ReportPanelExpand>(({ expand, isNarrow, setExpand }) => {
const { t } = useTranslation('verify');
- const navigate = useNavigate();
const { acceptanceId } = useParams<{ acceptanceId: string }>();
const { data, error, isLoading, mutate } = useAcceptanceList(true);
@@ -333,35 +598,14 @@ const AcceptanceListPanel = memo<ReportPanelExpand>(({ expand, isNarrow, setExpa
)
) : (
<div className={styles.list}>
- {filtered.map((item) => {
- const glyph = glyphOf(item.status as AcceptanceStatus);
- const meta = glyphMeta[glyph];
- const title = item.subject.title || item.subjectId;
-
- return (
- <NavItem
- active={item.id === acceptanceId}
- key={item.id}
- title={title}
- titleColor={cssVar.colorText}
- description={
- <Flexbox horizontal className={styles.itemSub} gap={8}>
- <span>{t(`acceptance.status.${item.status}` as any)}</span>
- <span>{relativeTime(item.updatedAt ?? item.createdAt)}</span>
- </Flexbox>
- }
- icon={
- <Icon
- className={glyph === 'running' ? styles.spin : undefined}
- icon={meta.icon}
- size={16}
- style={{ color: meta.color }}
- />
- }
- onClick={() => navigate(`/acceptance/${item.id}`)}
- />
- );
- })}
+ {filtered.map((item) => (
+ <AcceptanceRow
+ active={item.id === acceptanceId}
+ item={item}
+ key={item.id}
+ onChanged={mutate}
+ />
+ ))}
</div>
)}
</Flexbox>
diff --git a/src/features/Verify/Acceptance/index.tsx b/src/features/Verify/Acceptance/index.tsx
index 5d47c1fbdb7..e9797df4dcb 100644
--- a/src/features/Verify/Acceptance/index.tsx
+++ b/src/features/Verify/Acceptance/index.tsx
@@ -29,12 +29,13 @@ import {
Loader2,
MessagesSquare,
PanelRightOpen,
+ RefreshCw,
RotateCcw,
SquareArrowOutUpRight,
} from 'lucide-react';
import { memo, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { useParams } from 'react-router';
+import { useParams, useSearchParams } from 'react-router';
import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
import AgentProfilePopup from '@/features/AgentProfileCard/AgentProfilePopup';
@@ -67,11 +68,11 @@ import { openAcceptModal, openRejectModal } from './modals';
* nobody has to hand-summarize review notes into an instruction.
*/
const buildRepairPrompt = (acceptanceId: string) =>
- `请用 LobeHub CLI 读取验收 ${acceptanceId} 的最新 review 反馈:
+ `Use the LobeHub CLI to read the latest review feedback for acceptance ${acceptanceId}:
lh acceptance feedback ${acceptanceId} --actionable
-输出的条目(含各检查项的评论、截图圈选标注与附件)就是本轮要处理的全部反馈。请逐条修改代码;完成后重新执行验证,并把新一轮验证结果 ingest 回同一个 acceptance(复用既有检查项 id,语义有变化的用 supersedes 迭代)。`;
+Every entry it prints (per-check comments, circled-region annotations on the evidence screenshots, and attachments) is the full set of feedback to handle this round. Fix the code item by item; then re-run verification and ingest the new result back into the SAME acceptance (reuse the existing check ids, and use supersedes for any check whose meaning changed). Keep the final report in the same language the previous rounds used.`;
const styles = createStaticStyles(({ css }) => ({
banner: css`
@@ -199,7 +200,33 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
// get the one-line compact toolbar.
const compactToolbar = isEmbedded || isNarrowViewport;
- const [filter, setFilter] = useState<CheckFilter>('all');
+ // The checklist filter survives a refresh via a `?filter=` query param — but
+ // only on the standalone acceptance page. The portal embed rides the chat
+ // URL, so it keeps the filter in local state instead of hijacking that query.
+ const [searchParams, setSearchParams] = useSearchParams();
+ const [localFilter, setLocalFilter] = useState<CheckFilter>('all');
+ const urlFilterRaw = searchParams.get('filter');
+ const urlFilter: CheckFilter = (['all', 'pending', 'needsFix', 'accepted'] as const).includes(
+ urlFilterRaw as CheckFilter,
+ )
+ ? (urlFilterRaw as CheckFilter)
+ : 'all';
+ const filter = isEmbedded ? localFilter : urlFilter;
+ const setFilter = (next: CheckFilter) => {
+ if (isEmbedded) {
+ setLocalFilter(next);
+ return;
+ }
+ setSearchParams(
+ (prev) => {
+ const params = new URLSearchParams(prev);
+ if (next === 'all') params.delete('filter');
+ else params.set('filter', next);
+ return params;
+ },
+ { replace: true },
+ );
+ };
const [roundFilter, setRoundFilter] = useState<number | null>(null);
const [expanded, setExpanded] = useState<Set<string>>(() => new Set());
const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(() => new Set());
@@ -330,41 +357,52 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
icon: typeof BadgeCheck;
label: string;
spin?: boolean;
- } = LIVE_STATUSES.has(acceptance.status)
- ? {
- bg: cssVar.colorInfoBg,
- color: cssVar.colorInfo,
- icon: Loader2,
- label: t(`acceptance.status.${acceptance.status}`),
- spin: true,
- }
- : acceptance.status === 'accepted'
+ } =
+ acceptance.status === 'repairing'
? {
- bg: cssVar.colorSuccessBg,
- color: cssVar.colorSuccess,
- icon: BadgeCheck,
- label: t('acceptance.status.accepted'),
+ // A repair round is an in-progress TASK — warn-coloured spinning
+ // refresh, matching the system's task-process cue, not a neutral verify.
+ bg: cssVar.colorWarningBg,
+ color: cssVar.colorWarning,
+ icon: RefreshCw,
+ label: t('acceptance.status.repairing'),
+ spin: true,
}
- : acceptance.status === 'rejected'
+ : LIVE_STATUSES.has(acceptance.status)
? {
- bg: cssVar.colorErrorBg,
- color: cssVar.colorError,
- icon: RotateCcw,
- label: t('acceptance.status.rejected'),
+ bg: cssVar.colorInfoBg,
+ color: cssVar.colorInfo,
+ icon: Loader2,
+ label: t(`acceptance.status.${acceptance.status}`),
+ spin: true,
}
- : acceptance.status === 'errored'
+ : acceptance.status === 'accepted'
? {
- bg: cssVar.colorWarningBg,
- color: cssVar.colorWarning,
- icon: HelpCircle,
- label: t('acceptance.status.errored'),
+ bg: cssVar.colorSuccessBg,
+ color: cssVar.colorSuccess,
+ icon: BadgeCheck,
+ label: t('acceptance.status.accepted'),
}
- : {
- bg: cssVar.colorInfoBg,
- color: cssVar.colorInfo,
- icon: CircleDashed,
- label: t('acceptance.verdict.inProgress'),
- };
+ : acceptance.status === 'rejected'
+ ? {
+ bg: cssVar.colorErrorBg,
+ color: cssVar.colorError,
+ icon: RotateCcw,
+ label: t('acceptance.status.rejected'),
+ }
+ : acceptance.status === 'errored'
+ ? {
+ bg: cssVar.colorWarningBg,
+ color: cssVar.colorWarning,
+ icon: HelpCircle,
+ label: t('acceptance.status.errored'),
+ }
+ : {
+ bg: cssVar.colorInfoBg,
+ color: cssVar.colorInfo,
+ icon: CircleDashed,
+ label: t('acceptance.verdict.inProgress'),
+ };
const runAction = async (action: () => Promise<unknown>) => {
try {
@@ -415,14 +453,35 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
: acceptance.status === 'rejected'
? ('rejected' as const)
: ('settled' as const);
- // Review progress — the bar's dial and wording follow how much of the union
- // the user has personally signed off, not the verifier's pass tally.
+ // Review progress — the bar's dial and wording track the user's own decisions,
+ // split the SAME way as the checklist chips (已验收 / 待修复 / 未验收) so the two
+ // never disagree. A rejected check is DECIDED (it belongs to 待修复), not
+ // "awaiting your acceptance" — only the untouched 未验收 checks are pending.
const reviewableChecks = checks.filter((check) => check.result);
const reviewTotal = reviewableChecks.length;
- const reviewDone = reviewableChecks.filter(
- (check) => userReviewState(check) === 'accepted',
+ const acceptedCount = reviewableChecks.filter(
+ (check) => checkFilterState(check) === 'accepted',
+ ).length;
+ const needsFixCount = reviewableChecks.filter(
+ (check) => checkFilterState(check) === 'needsFix',
).length;
- const allConfirmed = reviewTotal > 0 && reviewDone >= reviewTotal;
+ const pendingCount = reviewTotal - acceptedCount - needsFixCount; // 未验收 (undecided)
+ const decidedCount = acceptedCount + needsFixCount;
+ // Per-round acceptance tally for the ledger: each reviewable check belongs to
+ // the round its current result came from, so the ledger can show that round's
+ // own 已验收 / 待验收 progress instead of a raw verification verdict.
+ const reviewByRound = (() => {
+ const map = new Map<number, { accepted: number; total: number }>();
+ for (const check of reviewableChecks) {
+ const round = check.resultRound;
+ if (round === undefined || round === null) continue;
+ const cur = map.get(round) ?? { accepted: 0, total: 0 };
+ cur.total += 1;
+ if (checkFilterState(check) === 'accepted') cur.accepted += 1;
+ map.set(round, cur);
+ }
+ return map;
+ })();
const barTexts = {
accepted: {
statusText: t('acceptance.banner.accepted', {
@@ -440,26 +499,36 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
statusText: t('acceptance.banner.rejected'),
subText: currentRound?.run.decisionDetail?.comment ?? t('acceptance.banner.rejectedHint'),
},
- settled: allConfirmed
- ? {
- // The done line stands alone — a grey stats echo under it reads as
- // an unresolved caveat (review feedback).
- statusText: t('acceptance.bar.progressDone', { total: reviewTotal }),
- subText: undefined,
- }
- : reviewDone === 0
- ? {
+ // The status line stands alone in every settled state — a grey stats echo
+ // (`N 通过 · …`) under it read as an unresolved caveat and just added noise.
+ settled:
+ decidedCount === 0
+ ? // Nothing reviewed yet — a clean "not started" prompt (no "已完成 0/…").
+ {
statusText: t('acceptance.bar.progressZero', { total: reviewTotal }),
- subText: `${countsText} · ${t('acceptance.banner.decisionHint')}`,
+ subText: undefined,
}
- : {
- statusText: t('acceptance.bar.progress', {
- done: reviewDone,
- rest: reviewTotal - reviewDone,
- total: reviewTotal,
- }),
- subText: `${countsText} · ${t('acceptance.banner.decisionHint')}`,
- },
+ : pendingCount === 0
+ ? needsFixCount === 0
+ ? // Every check accepted — ready to accept the delivery.
+ {
+ statusText: t('acceptance.bar.progressDone', { total: reviewTotal }),
+ subText: undefined,
+ }
+ : // Fully reviewed, but some checks need a fix — NOT "awaiting acceptance".
+ {
+ statusText: t('acceptance.bar.needsFix', { count: needsFixCount }),
+ subText: undefined,
+ }
+ : // Mid-review — the remainder is the UNDECIDED (未验收) count, not total-accepted.
+ {
+ statusText: t('acceptance.bar.progress', {
+ done: decidedCount,
+ rest: pendingCount,
+ total: reviewTotal,
+ }),
+ subText: undefined,
+ },
}[barState];
// Every feedback event, flattened for the clearing list: per-check rejects
@@ -524,8 +593,13 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
// agent, not just the origin conversation.
const handleCopyReview = async () => {
await copyToClipboard(repairPrompt);
- // Bottom-center — right above the action bar the click came from.
- toast.success({ placement: 'bottom', title: t('acceptance.bar.copied') });
+ // Bottom-center, lifted clear of the sticky decision bar so it floats ABOVE
+ // the action row the click came from (not overlapping it).
+ toast.success({
+ placement: 'bottom',
+ style: { marginBlockEnd: 88 },
+ title: t('acceptance.bar.copied'),
+ });
};
// Dispatch the repair prompt straight into the origin conversation — the
@@ -544,7 +618,11 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
await verifyService.markAcceptanceRepairing(acceptance.id);
await mutate();
void globalMutate(verifyKeys.acceptances());
- toast.success({ placement: 'bottom', title: t('acceptance.bar.rerunSent') });
+ toast.success({
+ placement: 'bottom',
+ style: { marginBlockEnd: 88 },
+ title: t('acceptance.bar.rerunSent'),
+ });
} catch (cause) {
toast.error(cause instanceof Error ? cause.message : t('acceptance.actionError'));
} finally {
@@ -878,9 +956,11 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
queueing feedback are the author's calls, never a visitor's. */}
{isOwner && (
<DecisionBar
- acceptedCount={reviewDone}
+ acceptedCount={acceptedCount}
feedbackCount={activeFeedbackCount}
+ needsFixCount={needsFixCount}
pending={pending}
+ repairing={acceptance.status === 'repairing'}
rerunAvailable={Boolean(origin?.topic)}
rerunPending={rerunPending}
state={barState}
@@ -909,10 +989,13 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
handle: opening happens from the page-corner toggle, closing from the
ledger's own header action. On narrow viewports it opens as a masked
drawer over the report — dismissable by tapping outside — instead of
- shrinking the report into an unreadable column. */}
+ shrinking the report into an unreadable column. The panel's own
+ fold icon is the close affordance (same as wide mode), so the Drawer's
+ built-in close button is suppressed — one collapse handle, not two. */}
{isNarrowViewport ? (
<Drawer
noHeader
+ closable={false}
containerMaxWidth={'100%'}
open={ledgerExpand}
placement={'right'}
@@ -921,8 +1004,8 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
onClose={() => setLedgerExpand(false)}
>
<LedgerPanel
- hideCollapse
highlight={highlightRound}
+ reviewByRound={reviewByRound}
rounds={rounds}
onCollapse={() => setLedgerExpand(false)}
onOpenReport={setReportRound}
@@ -940,6 +1023,7 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
<Flexbox style={{ height: '100%', overflow: 'auto' }}>
<LedgerPanel
highlight={highlightRound}
+ reviewByRound={reviewByRound}
rounds={rounds}
onCollapse={() => setLedgerExpand(false)}
onOpenReport={setReportRound}
diff --git a/src/services/verify.ts b/src/services/verify.ts
index ac93849e95b..b7ed6723f5a 100644
--- a/src/services/verify.ts
+++ b/src/services/verify.ts
@@ -190,6 +190,17 @@ export class VerifyService {
/** Stamp the aggregate `repairing` after the send-back dispatch. */
markAcceptanceRepairing = (id: string) => lambdaClient.acceptance.markRepairing.mutate({ id });
+ /** Rename the acceptance's sidebar entry (a metadata title override). */
+ renameAcceptance = (id: string, title: string) =>
+ lambdaClient.acceptance.rename.mutate({ id, title });
+
+ /** Owner override of the acceptance's decision state from the list. */
+ updateAcceptanceStatus = (id: string, status: 'accepted' | 'delivered' | 'rejected') =>
+ lambdaClient.acceptance.updateStatus.mutate({ id, status });
+
+ /** Delete the acceptance aggregate (its round reports detach, not delete). */
+ deleteAcceptance = (id: string) => lambdaClient.acceptance.remove.mutate({ id });
+
// ---- per-run plan ----
getVerifyState = (operationId: string): Promise<VerifyStateResponse | null> =>
lambdaClient.verify.getVerifyState.query({