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): show which feedback the reject prompt carries (#20452)

Arvin Xu186354270113
diff --git a/apps/server/src/services/verify/__tests__/checkReviewOverlay.test.ts b/apps/server/src/services/verify/__tests__/checkReviewOverlay.test.ts
index 98bd9483d21..052b116ec4a 100644
--- a/apps/server/src/services/verify/__tests__/checkReviewOverlay.test.ts
+++ b/apps/server/src/services/verify/__tests__/checkReviewOverlay.test.ts
@@ -29,6 +29,23 @@ const timelineEntry = (resultId: string, roundIndex: number) => ({
const byId = (...rows: VerifyCheckResultItem[]) => new Map(rows.map((row) => [row.id, row]));
describe('buildCheckReviewOverlay', () => {
+ it('carries who decided, so a teammate’s reject is not credited to the reader', () => {
+ const rejected = result('r1', {
+ userDecision: 'rejected',
+ userDecisionDetail: {
+ comment: 'contrast',
+ decidedAt: '2026-07-16T01:00:00.000Z',
+ decidedBy: 'user-teammate',
+ },
+ });
+ const overlay = buildCheckReviewOverlay(
+ { timeline: [timelineEntry('r1', 1)] },
+ byId(rejected),
+ 1,
+ );
+ expect(overlay.reviews[0]).toMatchObject({ action: 'reject', decidedBy: 'user-teammate' });
+ });
+
it('returns no standing verdict when no result row carries a decision', () => {
const overlay = buildCheckReviewOverlay(
{ timeline: [timelineEntry('r1', 1)] },
diff --git a/apps/server/src/services/verify/acceptanceService.ts b/apps/server/src/services/verify/acceptanceService.ts
index 325e96c1550..4411e5a0de4 100644
--- a/apps/server/src/services/verify/acceptanceService.ts
+++ b/apps/server/src/services/verify/acceptanceService.ts
@@ -346,6 +346,8 @@ export interface AcceptanceCheckReviewEvent {
comment?: string;
/** When the decision was made (ISO 8601; falls back to the row's timestamps). */
createdAt: string;
+ /** Who decided (user id). Absent on legacy rows, which only the owner could write. */
+ decidedBy?: string;
/** Uploaded/pasted screenshots backing the reject (FKs to files). */
fileIds?: string[];
/** The result row the decision is stamped on. */
@@ -385,6 +387,7 @@ export const buildCheckReviewOverlay = (
annotations: detail?.annotations,
comment: detail?.comment,
createdAt: detail?.decidedAt ?? (result.completedAt ?? result.createdAt)?.toISOString() ?? '',
+ decidedBy: detail?.decidedBy,
fileIds: detail?.fileIds,
id: result.id,
// A carried-forward check is judged at the CURRENT round even though its
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.json
index 10f5dfe50c6..82abddf631f 100644
--- a/locales/en-US/verify.json
+++ b/locales/en-US/verify.json
@@ -230,7 +230,17 @@
"acceptance.proposal.title": "AI review · possibly unmet",
"acceptance.reject.description": "Send this delivery back for another repair round. Optionally add a reason to guide the fix.",
"acceptance.reject.descriptionCopy": "No agent is attached to this delivery. Rejecting copies the repair prompt, including any reason you add — paste it to any agent to start the next round.",
+ "acceptance.reject.included": "Includes {{count}} feedback item(s)",
+ "acceptance.reject.includedError": "Couldn't load comments to preview — the agent still reads every unresolved comment",
+ "acceptance.reject.includedHint": "The agent reads all of these, attachments included, along with your reason. Resolved comments are left out.",
+ "acceptance.reject.includedLoading": "Loading the feedback that goes along…",
+ "acceptance.reject.includedMine": "yours {{count}}",
+ "acceptance.reject.includedNone": "No other open feedback — only your reason goes along",
+ "acceptance.reject.includedOthers": "others {{count}}",
+ "acceptance.reject.includedUnattributed": "unattributed {{count}}",
"acceptance.reject.placeholder": "Reason (optional), e.g. add screenshot evidence for dark mode…",
+ "acceptance.reject.teammate": "Teammate",
+ "acceptance.reject.unattributed": "Unattributed note",
"acceptance.reportDrawer.close": "Close the round report",
"acceptance.requirementEmpty": "No acceptance goal recorded for this subject yet.",
"acceptance.requirementEmptyEditable": "No acceptance goal yet — click to add one.",
diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.json
index 98568c83220..583a49aaa93 100644
--- a/locales/zh-CN/verify.json
+++ b/locales/zh-CN/verify.json
@@ -230,7 +230,17 @@
"acceptance.proposal.title": "AI 复核 · 疑似未达成",
"acceptance.reject.description": "打回后将发起新一轮修复,完成后回到「待验收」。可补充打回原因,为修复提供参考。",
"acceptance.reject.descriptionCopy": "这份交付没有关联 agent。打回后会复制修改 prompt(附上你填写的原因),粘贴给任意 agent 即可开始下一轮。",
+ "acceptance.reject.included": "附带 {{count}} 条反馈",
+ "acceptance.reject.includedError": "评论读取失败,无法预览;agent 仍会读取所有未解决的评论",
+ "acceptance.reject.includedHint": "agent 会连同你填写的原因一起读取以下全部反馈(含附件截图);已解决的评论不会带上。",
+ "acceptance.reject.includedLoading": "正在读取将附带的反馈…",
+ "acceptance.reject.includedMine": "你 {{count}}",
+ "acceptance.reject.includedNone": "暂无其他待处理反馈,只会带上你填写的原因",
+ "acceptance.reject.includedOthers": "他人 {{count}}",
+ "acceptance.reject.includedUnattributed": "未署名 {{count}}",
"acceptance.reject.placeholder": "打回原因(可选),例如:深色模式需补截图证据……",
+ "acceptance.reject.teammate": "团队成员",
+ "acceptance.reject.unattributed": "未署名备注",
"acceptance.reportDrawer.close": "关闭该轮报告",
"acceptance.requirementEmpty": "尚未记录该对象的验收目标。",
"acceptance.requirementEmptyEditable": "尚未记录验收目标,点击填写。",
diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.ts
index 9e75ea433bc..defb39b18b3 100644
--- a/packages/locales/src/default/verify.ts
+++ b/packages/locales/src/default/verify.ts
@@ -398,6 +398,18 @@ export default {
'No agent is attached to this delivery. Rejecting copies the repair prompt, including any reason you add — paste it to any agent to start the next round.',
'acceptance.reject.description':
'Send this delivery back for another repair round. Optionally add a reason to guide the fix.',
+ 'acceptance.reject.included': 'Includes {{count}} feedback item(s)',
+ 'acceptance.reject.includedError':
+ "Couldn't load comments to preview — the agent still reads every unresolved comment",
+ 'acceptance.reject.includedHint':
+ 'The agent reads all of these, attachments included, along with your reason. Resolved comments are left out.',
+ 'acceptance.reject.includedLoading': 'Loading the feedback that goes along…',
+ 'acceptance.reject.includedMine': 'yours {{count}}',
+ 'acceptance.reject.includedNone': 'No other open feedback — only your reason goes along',
+ 'acceptance.reject.includedOthers': 'others {{count}}',
+ 'acceptance.reject.includedUnattributed': 'unattributed {{count}}',
+ 'acceptance.reject.teammate': 'Teammate',
+ 'acceptance.reject.unattributed': 'Unattributed note',
'acceptance.reject.placeholder': 'Reason (optional), e.g. add screenshot evidence for dark mode…',
'acceptance.reportDrawer.close': 'Close the round report',
'acceptance.review.accept': 'Accept',
diff --git a/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx b/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx
index b2be946b2f0..e188deeb423 100644
--- a/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx
+++ b/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx
@@ -240,6 +240,7 @@ const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {
// viewer's promise, not the server's gate — the copy path below
// opts out of dispatch explicitly.
dispatchAvailable: Boolean(data.origin?.topic),
+ acceptanceId: acceptance.id,
onConfirm: async (comment) => {
if (!data.origin?.topic) {
const rejected = await runAction(() =>
diff --git a/src/features/Acceptance/Viewer/Review/DecisionBar.test.ts b/src/features/Acceptance/Viewer/Review/DecisionBar.test.ts
index b36a8a0e1d1..15ee11476f1 100644
--- a/src/features/Acceptance/Viewer/Review/DecisionBar.test.ts
+++ b/src/features/Acceptance/Viewer/Review/DecisionBar.test.ts
@@ -13,6 +13,8 @@ vi.mock('i18next', async (importOriginal) => ({
...(await importOriginal<typeof I18next>()),
t: (key: string) => key,
}));
+// The live feedback preview reads SWR and the user store; its own test covers it.
+vi.mock('./RejectFeedbackPreview', () => ({ default: () => null }));
afterEach(cleanup);
describe('DecisionBar copy', () => {
@@ -82,7 +84,8 @@ it.each(['', ' ', ' Please add dark mode evidence '])(
...props,
feedbackCount: 0,
needsFixCount: 0,
- onRejectComment: () => openRejectModal({ dispatchAvailable: true, onConfirm }),
+ onRejectComment: () =>
+ openRejectModal({ acceptanceId: 'acc-1', dispatchAvailable: true, onConfirm }),
}),
);
@@ -107,7 +110,8 @@ it('without an authoring agent, the reject dialog copies the prompt instead of p
...props,
feedbackCount: 0,
needsFixCount: 0,
- onRejectComment: () => openRejectModal({ dispatchAvailable: false, onConfirm }),
+ onRejectComment: () =>
+ openRejectModal({ acceptanceId: 'acc-1', dispatchAvailable: false, onConfirm }),
}),
);
diff --git a/src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsx b/src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsx
new file mode 100644
index 00000000000..7f82e16b1ae
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsx
@@ -0,0 +1,240 @@
+'use client';
+
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Avatar, Text } from '@lobehub/ui/base-ui';
+import { createStaticStyles, cssVar, cx } from 'antd-style';
+import { ChevronDown, ChevronUp, CircleAlert, Loader2, MessagesSquare } from 'lucide-react';
+import { memo, useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useUserStore } from '@/store/user';
+import { userProfileSelectors } from '@/store/user/selectors';
+
+import { useAcceptanceComments } from '../Comments/hooks';
+import { AttachmentThumbs } from '../Evidence/attachments';
+import { useAcceptanceBundle } from '../useAcceptanceBundle';
+import {
+ collectRejectFeedback,
+ type RejectFeedbackItem,
+ rejectFeedbackPreviewState,
+} from './rejectFeedback';
+
+const styles = createStaticStyles(({ css }) => ({
+ avatarStack: css`
+ flex: none;
+
+ > * + * {
+ margin-inline-start: -6px;
+ box-shadow: 0 0 0 2px ${cssVar.colorBgElevated};
+ }
+ `,
+ box: css`
+ overflow: hidden;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadiusLG};
+ background: ${cssVar.colorFillQuaternary};
+ `,
+ body: css`
+ padding-block: 0 10px;
+ padding-inline: 12px;
+ `,
+ list: css`
+ overflow-y: auto;
+ max-height: 240px;
+ `,
+ row: css`
+ padding-block: 10px;
+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};
+
+ &:last-child {
+ border-block-end: none;
+ }
+ `,
+ summary: css`
+ padding-block: 10px;
+ padding-inline: 12px;
+ `,
+ toggle: css`
+ cursor: pointer;
+
+ &:hover {
+ background: ${cssVar.colorFillTertiary};
+ }
+ `,
+}));
+
+const useAuthorLabel = () => {
+ const { t } = useTranslation('verify');
+ return (author: RejectFeedbackItem['author']) =>
+ author.kind === 'unknown'
+ ? t('acceptance.reject.unattributed')
+ : author.name || t('acceptance.reject.teammate');
+};
+
+const AuthorAvatar = memo<{ author: RejectFeedbackItem['author']; label: string }>(
+ ({ author, label }) =>
+ author.kind === 'unknown' ? (
+ <Avatar avatar={<Icon icon={MessagesSquare} size={12} />} size={20} />
+ ) : (
+ // First character only — a two-character CJK name wraps in a small circle.
+ <Avatar avatar={author.avatar || label.slice(0, 1)} size={20} />
+ ),
+);
+
+AuthorAvatar.displayName = 'AcceptanceRejectAuthorAvatar';
+
+const FeedbackRow = memo<{ item: RejectFeedbackItem }>(({ item }) => {
+ const { t } = useTranslation('verify');
+ const authorLabel = useAuthorLabel()(item.author);
+ const metaBits = [
+ item.scope,
+ item.annotationCount
+ ? t('acceptance.feedback.annotations', { count: item.annotationCount })
+ : null,
+ ].filter(Boolean);
+
+ return (
+ <Flexbox horizontal className={styles.row} gap={8}>
+ <AuthorAvatar author={item.author} label={authorLabel} />
+ <Flexbox flex={1} gap={4} style={{ minWidth: 0 }}>
+ <Flexbox horizontal align={'baseline'} gap={6} style={{ minWidth: 0 }}>
+ <Text strong fontSize={12} style={{ flex: 'none' }}>
+ {authorLabel}
+ </Text>
+ {metaBits.length > 0 && (
+ <Text ellipsis fontSize={11} type={'secondary'}>
+ {metaBits.join(' · ')}
+ </Text>
+ )}
+ </Flexbox>
+ {item.text && (
+ <Text ellipsis={{ rows: 2 }} fontSize={12}>
+ {item.text}
+ </Text>
+ )}
+ <AttachmentThumbs attachments={item.attachments} />
+ </Flexbox>
+ </Flexbox>
+ );
+});
+
+FeedbackRow.displayName = 'AcceptanceRejectFeedbackRow';
+
+const Notice = memo<{ icon: typeof MessagesSquare; spin?: boolean; text: string }>(
+ ({ icon, spin, text }) => (
+ <Flexbox horizontal align={'center'} className={cx(styles.box, styles.summary)} gap={8}>
+ <Icon color={cssVar.colorTextTertiary} icon={icon} size={16} spin={spin} />
+ <Text fontSize={13} type={'secondary'}>
+ {text}
+ </Text>
+ </Flexbox>
+ ),
+);
+
+Notice.displayName = 'AcceptanceRejectFeedbackNotice';
+
+/**
+ * What the repair prompt carries besides the reason, read live — the dialog
+ * may open before the discussion has loaded, and a snapshot taken then would
+ * promise "nothing else goes along" while the agent still reads every comment.
+ */
+const RejectFeedbackPreview = memo<{ acceptanceId: string }>(({ acceptanceId }) => {
+ const { t } = useTranslation('verify');
+ const [open, setOpen] = useState(false);
+ const { data: bundle } = useAcceptanceBundle(acceptanceId, { poll: false });
+ const { error, isLoading, items: comments } = useAcceptanceComments(acceptanceId);
+ const viewerId = useUserStore(userProfileSelectors.userId);
+ const viewerName = useUserStore(userProfileSelectors.displayUserName);
+ const viewerAvatar = useUserStore(userProfileSelectors.userAvatar);
+ const authorLabel = useAuthorLabel();
+
+ const feedback = useMemo(
+ () =>
+ bundle
+ ? collectRejectFeedback({
+ bundle,
+ comments,
+ viewer: { avatar: viewerAvatar, id: viewerId, name: viewerName },
+ })
+ : [],
+ [bundle, comments, viewerAvatar, viewerId, viewerName],
+ );
+
+ const state = rejectFeedbackPreviewState({
+ bundleReady: Boolean(bundle),
+ commentsError: error,
+ commentsLoading: isLoading,
+ count: feedback.length,
+ });
+ if (state === 'loading')
+ return <Notice spin icon={Loader2} text={t('acceptance.reject.includedLoading')} />;
+ if (state === 'error')
+ return <Notice icon={CircleAlert} text={t('acceptance.reject.includedError')} />;
+ if (state === 'none')
+ return <Notice icon={MessagesSquare} text={t('acceptance.reject.includedNone')} />;
+
+ const counts = { mine: 0, other: 0, unknown: 0 };
+ for (const item of feedback) counts[item.author.kind] += 1;
+ const breakdown = [
+ counts.mine > 0 && t('acceptance.reject.includedMine', { count: counts.mine }),
+ counts.other > 0 && t('acceptance.reject.includedOthers', { count: counts.other }),
+ counts.unknown > 0 && t('acceptance.reject.includedUnattributed', { count: counts.unknown }),
+ ].filter(Boolean);
+ // Distinct faces behind the queued feedback, for the summary bar.
+ const faces = [
+ ...new Map(
+ feedback
+ .filter((item) => item.author.kind !== 'unknown')
+ .map((item) => [authorLabel(item.author), item.author]),
+ ).entries(),
+ ].slice(0, 3);
+ const toggle = () => setOpen((value) => !value);
+
+ return (
+ <Flexbox className={styles.box}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ aria-expanded={open}
+ className={cx(styles.summary, styles.toggle)}
+ gap={8}
+ role={'button'}
+ tabIndex={0}
+ onClick={toggle}
+ onKeyDown={(event) => {
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault();
+ toggle();
+ }
+ }}
+ >
+ <Icon icon={MessagesSquare} size={16} />
+ <Text strong fontSize={13} style={{ flex: 1, minWidth: 0 }}>
+ {[t('acceptance.reject.included', { count: feedback.length }), ...breakdown].join(' · ')}
+ </Text>
+ <Flexbox horizontal className={styles.avatarStack}>
+ {faces.map(([label, author]) => (
+ <AuthorAvatar author={author} key={label} label={label} />
+ ))}
+ </Flexbox>
+ <Icon icon={open ? ChevronUp : ChevronDown} size={14} />
+ </Flexbox>
+ {open && (
+ <Flexbox className={styles.body} gap={4}>
+ <Text fontSize={12} type={'secondary'}>
+ {t('acceptance.reject.includedHint')}
+ </Text>
+ <Flexbox className={styles.list}>
+ {feedback.map((item) => (
+ <FeedbackRow item={item} key={item.key} />
+ ))}
+ </Flexbox>
+ </Flexbox>
+ )}
+ </Flexbox>
+ );
+});
+
+RejectFeedbackPreview.displayName = 'AcceptanceRejectFeedbackPreview';
+
+export default RejectFeedbackPreview;
diff --git a/src/features/Acceptance/Viewer/Review/modals.tsx b/src/features/Acceptance/Viewer/Review/modals.tsx
index 2f5d2715fd0..c06590990ad 100644
--- a/src/features/Acceptance/Viewer/Review/modals.tsx
+++ b/src/features/Acceptance/Viewer/Review/modals.tsx
@@ -19,6 +19,7 @@ import {
AttachmentUploadButton,
useFeedbackAttachments,
} from '../Evidence/attachments';
+import RejectFeedbackPreview from './RejectFeedbackPreview';
const styles = createStaticStyles(({ css }) => ({
warning: css`
@@ -104,6 +105,9 @@ export const openAcceptModal = (options: AcceptContentProps): ModalInstance =>
});
interface RejectContentProps {
+ /** Previews the open feedback the repair agent reads alongside the reason, so
+ the reviewer knows whose comments and screenshots ride along. */
+ acceptanceId: string;
/** The rounds name an authoring agent — the server sends the reject back to
it. Without one the dialog promises no next round: it copies the prompt. */
dispatchAvailable: boolean;
@@ -111,7 +115,7 @@ interface RejectContentProps {
onConfirm: (comment: string) => Promise<boolean>;
}
-const RejectContent = memo<RejectContentProps>(({ dispatchAvailable, onConfirm }) => {
+const RejectContent = memo<RejectContentProps>(({ acceptanceId, dispatchAvailable, onConfirm }) => {
const { t: translate } = useTranslation('verify');
const { close } = useModalContext();
const [comment, setComment] = useState('');
@@ -129,6 +133,9 @@ const RejectContent = memo<RejectContentProps>(({ dispatchAvailable, onConfirm }
return (
<Flexbox gap={16}>
+ {/* What the repair prompt carries besides the reason leads the dialog —
+ otherwise nobody can tell whether teammates' notes go along. */}
+ <RejectFeedbackPreview acceptanceId={acceptanceId} />
<Text fontSize={13} type={'secondary'}>
{translate(
dispatchAvailable ? 'acceptance.reject.description' : 'acceptance.reject.descriptionCopy',
@@ -166,7 +173,7 @@ export const openRejectModal = (options: RejectContentProps): ModalInstance =>
maskClosable: true,
styles: frostedModalStyles,
title: t('acceptance.actions.reject', { ns: 'verify' }),
- width: 'min(90vw, 480px)',
+ width: 'min(90vw, 520px)',
});
interface GroupFeedbackContentProps {
diff --git a/src/features/Acceptance/Viewer/Review/rejectFeedback.test.ts b/src/features/Acceptance/Viewer/Review/rejectFeedback.test.ts
new file mode 100644
index 00000000000..721db079e0a
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Review/rejectFeedback.test.ts
@@ -0,0 +1,236 @@
+import type { AcceptanceCommentItem } from '@lobechat/types';
+import { describe, expect, it } from 'vitest';
+
+import { collectRejectFeedback, rejectFeedbackPreviewState } from './rejectFeedback';
+
+const tsuki = {
+ avatar: 'https://x/tsuki.png',
+ fullName: 'Tsuki',
+ id: 'user-2',
+ status: 'active' as const,
+ type: 'user' as const,
+ username: 'tsuki',
+};
+
+const comment = (overrides: Partial<AcceptanceCommentItem>): AcceptanceCommentItem =>
+ ({
+ acceptanceId: 'acc-1',
+ anchorType: 'acceptance',
+ attachments: [],
+ author: tsuki,
+ authorAgentId: null,
+ authorUserId: 'user-2',
+ canDelete: false,
+ clientId: 'c',
+ content: 'looks off',
+ contextRoundIndex: 1,
+ createdAt: new Date('2026-10-07T10:00:00Z'),
+ deletedAt: null,
+ editorData: null,
+ id: 'cm-1',
+ kind: 'comment',
+ parentCommentId: null,
+ reactions: [],
+ resolvedAt: null,
+ resolvedByUserId: null,
+ ...overrides,
+ }) as AcceptanceCommentItem;
+
+const reject = (id: string, overrides: Record<string, unknown> = {}) => ({
+ action: 'reject',
+ comment: `reject ${id}`,
+ createdAt: '2026-10-07T09:00:00.000Z',
+ id,
+ roundIndex: 1,
+ ...overrides,
+});
+
+const check = (id: string, seq: number, reviews: any[], userReview?: Record<string, unknown>) => ({
+ id,
+ reviews,
+ seq,
+ title: `Check ${seq}`,
+ userReview: userReview ?? (reviews.length ? { ...reviews.at(-1), stale: false } : undefined),
+});
+
+const bundle = (overrides: Record<string, unknown> = {}): any => ({
+ acceptance: { userId: 'user-1' },
+ author: { avatar: null, fullName: 'Arvin', id: 'user-1', username: 'arvin' },
+ checks: [],
+ flows: [],
+ rounds: [{ run: { id: 'run-1', roundIndex: 1 } }],
+ ...overrides,
+});
+
+const viewer = { avatar: 'https://x/arvin.png', id: 'user-1', name: 'Arvin' };
+
+describe('collectRejectFeedback', () => {
+ it('credits a check reject to whoever decided it, not to the reader', () => {
+ const items = collectRejectFeedback({
+ bundle: bundle({
+ checks: [
+ check('c1', 1, [reject('r1', { decidedBy: 'user-2' })]),
+ check('c2', 2, [reject('r2', { decidedBy: 'user-1' })]),
+ // Legacy row without decidedBy: only the owner could write it.
+ check('c3', 3, [reject('r3')]),
+ ],
+ }),
+ // Tsuki's profile is known from the discussion.
+ comments: [comment({ id: 'cm-1', resolvedAt: new Date() })],
+ viewer,
+ });
+
+ const byText = Object.fromEntries(items.map((item) => [item.text, item.author]));
+ expect(byText['reject r1']).toMatchObject({ kind: 'other', name: 'Tsuki' });
+ expect(byText['reject r2']).toMatchObject({ kind: 'mine', name: 'Arvin' });
+ expect(byText['reject r3']).toMatchObject({ kind: 'mine' });
+ });
+
+ it('names a teammate it has no profile for as unknown-named, never as the reader', () => {
+ const [item] = collectRejectFeedback({
+ bundle: bundle({ checks: [check('c1', 1, [reject('r1', { decidedBy: 'user-9' })])] }),
+ comments: [],
+ viewer,
+ });
+
+ expect(item.author).toEqual({ avatar: undefined, kind: 'other', name: undefined });
+ });
+
+ it('marks group notes unattributed — they record no author', () => {
+ const [item] = collectRejectFeedback({
+ bundle: bundle({
+ rounds: [
+ {
+ run: {
+ decisionDetail: {
+ groupFeedback: [
+ { category: 'Layout', comment: 'spacing', createdAt: '2026-10-07T09:00:00Z' },
+ ],
+ },
+ id: 'run-1',
+ roundIndex: 1,
+ },
+ },
+ ],
+ }),
+ comments: [],
+ viewer,
+ });
+
+ expect(item).toMatchObject({ author: { kind: 'unknown' }, scope: 'Layout', text: 'spacing' });
+ });
+
+ it('keeps only standing check rejects, as the CLI does', () => {
+ const items = collectRejectFeedback({
+ bundle: bundle({
+ checks: [
+ // Rejected, then accepted: the reject no longer stands.
+ check('c1', 1, [reject('r1'), { ...reject('r1b'), action: 'accept' }]),
+ // Consumed by a later round.
+ check('c2', 2, [reject('r2')], { action: 'reject', stale: true }),
+ ],
+ }),
+ comments: [],
+ viewer,
+ });
+
+ expect(items).toEqual([]);
+ });
+
+ it('includes the latest rejected attempt of the newest flow run, with its screenshots', () => {
+ const attempt = (id: string, review: string | null, overrides = {}) => ({
+ checkItemId: 'item-1',
+ checkResultId: `res-${id}`,
+ id,
+ nodeId: 'node-1',
+ review,
+ reviewAttachments: [{ id: 'f-1', name: 'shot.png', url: 'https://x/shot.png' }],
+ reviewComment: `attempt ${id}`,
+ reviewDetail: { decidedAt: '2026-10-07T09:00:00Z', decidedBy: 'user-1' },
+ sequence: 1,
+ ...overrides,
+ });
+ const items = collectRejectFeedback({
+ bundle: bundle({
+ // The flow's result rows also appear as check reviews; they must not double up.
+ checks: [check('c1', 1, [reject('res-a2')])],
+ flows: [
+ {
+ versions: [
+ {
+ id: 'v2',
+ nodes: [{ id: 'node-1', title: 'Checkout' }],
+ runs: [
+ {
+ attempts: [
+ attempt('a1', 'rejected'),
+ attempt('a2', 'rejected', { sequence: 2 }),
+ attempt('other', 'rejected', { checkItemId: 'item-2', sequence: 3 }),
+ ],
+ id: 'run-new',
+ },
+ { attempts: [attempt('old', 'rejected')], id: 'run-old' },
+ ],
+ },
+ ],
+ },
+ ],
+ }),
+ comments: [],
+ viewer,
+ });
+
+ expect(items.map((item) => item.text).sort()).toEqual(['attempt a2', 'attempt other']);
+ const a2 = items.find((item) => item.text === 'attempt a2')!;
+ expect(a2).toMatchObject({ author: { kind: 'mine' }, scope: 'Checkout · #2' });
+ expect(a2.attachments).toHaveLength(1);
+ });
+
+ it('previews teammates’ open comments with screenshots and leaves out what the CLI drops', () => {
+ const items = collectRejectFeedback({
+ bundle: bundle({ checks: [check('chk-1', 3, [])] }),
+ comments: [
+ comment({
+ attachments: [{ id: 'f-1', name: 'shot.png', url: 'https://x/shot.png' }] as any,
+ checkItemId: 'chk-1',
+ evidenceId: 'ev-1',
+ rect: { height: 0.1, width: 0.1, x: 0, y: 0 },
+ }),
+ comment({ id: 'root', resolvedAt: new Date() }),
+ comment({ content: 'reply in a resolved thread', id: 'reply', parentCommentId: 'root' }),
+ comment({ deletedAt: new Date(), id: 'gone' }),
+ comment({ id: 'ok', kind: 'approval' }),
+ ],
+ viewer,
+ });
+
+ expect(items).toHaveLength(1);
+ expect(items[0]).toMatchObject({
+ annotationCount: 1,
+ author: { avatar: 'https://x/tsuki.png', kind: 'other', name: 'Tsuki' },
+ scope: 'C3 Check 3',
+ text: 'looks off',
+ });
+ expect(items[0].attachments).toHaveLength(1);
+ });
+});
+
+describe('rejectFeedbackPreviewState', () => {
+ // Regression: the dialog snapshotted the still-empty comment list and told the
+ // reviewer nothing else goes along while the agent would read every comment.
+ it('never claims an empty set while comments are loading or failed', () => {
+ const base = { bundleReady: true, commentsLoading: false, count: 0 };
+ expect(rejectFeedbackPreviewState({ ...base, commentsLoading: true })).toBe('loading');
+ expect(rejectFeedbackPreviewState({ ...base, bundleReady: false })).toBe('loading');
+ expect(rejectFeedbackPreviewState({ ...base, commentsError: new Error('boom') })).toBe('error');
+ expect(
+ rejectFeedbackPreviewState({ ...base, commentsError: new Error('boom'), count: 2 }),
+ ).toBe('error');
+ });
+
+ it('reports none only once the discussion has loaded', () => {
+ const base = { bundleReady: true, commentsLoading: false };
+ expect(rejectFeedbackPreviewState({ ...base, count: 0 })).toBe('none');
+ expect(rejectFeedbackPreviewState({ ...base, count: 3 })).toBe('ready');
+ });
+});
diff --git a/src/features/Acceptance/Viewer/Review/rejectFeedback.ts b/src/features/Acceptance/Viewer/Review/rejectFeedback.ts
new file mode 100644
index 00000000000..90eaa81be6b
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Review/rejectFeedback.ts
@@ -0,0 +1,209 @@
+import type { AcceptanceAttachment, AcceptanceCommentItem } from '@lobechat/types';
+
+import type { AcceptanceBundle } from '@/services/verify';
+
+/**
+ * Who wrote one piece of feedback.
+ *
+ * `unknown` is a real state, not a fallback: group notes record no author, and
+ * claiming them for the reader would tell a teammate's note as their own.
+ */
+export interface RejectFeedbackAuthor {
+ avatar?: string;
+ kind: 'mine' | 'other' | 'unknown';
+ /** Unset when the writer is known to be someone else but has no profile here. */
+ name?: string;
+}
+
+/** One piece of feedback the repair agent will read alongside the reject reason. */
+export interface RejectFeedbackItem {
+ annotationCount?: number;
+ attachments?: AcceptanceAttachment[];
+ author: RejectFeedbackAuthor;
+ createdAt: string;
+ key: string;
+ /** Where it hangs: `C3 title`, a group label, or a flow step. */
+ scope?: string;
+ text: string;
+}
+
+type BundleSource = Pick<AcceptanceBundle, 'acceptance' | 'author' | 'checks' | 'flows' | 'rounds'>;
+
+interface CollectRejectFeedbackParams {
+ bundle: BundleSource;
+ comments: AcceptanceCommentItem[];
+ viewer: { avatar?: string; id?: string; name: string };
+}
+
+interface Profile {
+ avatar?: string;
+ name: string;
+}
+
+/**
+ * What the reject's repair prompt actually hands over. The prompt points the
+ * agent at `lh acceptance feedback --actionable`, so the dialog previews the
+ * same set, with the same predicates, instead of leaving the reviewer to guess
+ * whether a teammate's comment or screenshot rides along. Keep each branch in
+ * step with that command (apps/cli/src/commands/verifyAcceptance.ts and
+ * acceptanceCommentFeedback.ts).
+ */
+export const collectRejectFeedback = ({
+ bundle,
+ comments,
+ viewer,
+}: CollectRejectFeedbackParams): RejectFeedbackItem[] => {
+ const { acceptance, checks, flows = [], rounds } = bundle;
+ const currentRoundIndex = rounds.at(-1)?.run.roundIndex ?? 0;
+
+ // Names for user ids, from whatever this page already knows: the owner and
+ // everyone in the discussion.
+ const profiles = new Map<string, Profile>();
+ if (bundle.author)
+ profiles.set(bundle.author.id, {
+ avatar: bundle.author.avatar || undefined,
+ name: bundle.author.fullName || bundle.author.username || '',
+ });
+ for (const item of comments) {
+ if (item.authorUserId && item.author.type === 'user')
+ profiles.set(item.authorUserId, {
+ avatar: item.author.avatar || undefined,
+ name: item.author.fullName || item.author.username || '',
+ });
+ }
+
+ /** A decision's writer; decisions without `decidedBy` predate it and were the owner's. */
+ const decider = (decidedBy: string | null | undefined): RejectFeedbackAuthor => {
+ const userId = decidedBy || acceptance.userId;
+ if (viewer.id && userId === viewer.id)
+ return { avatar: viewer.avatar || undefined, kind: 'mine', name: viewer.name };
+ const profile = profiles.get(userId);
+ return { avatar: profile?.avatar, kind: 'other', name: profile?.name || undefined };
+ };
+
+ const items: RejectFeedbackItem[] = [];
+
+ const flowResultIds = new Set(
+ flows.flatMap((flow) =>
+ flow.versions.flatMap((version) =>
+ version.runs.flatMap((run) => run.attempts.map((attempt) => attempt.checkResultId)),
+ ),
+ ),
+ );
+
+ // Check rejects: only the one standing as the check's latest, unconsumed verdict.
+ for (const check of checks) {
+ const latest = check.reviews.at(-1);
+ const standing =
+ check.userReview?.action === 'reject' &&
+ !check.userReview.stale &&
+ latest?.action === 'reject';
+ if (!latest || !standing || flowResultIds.has(latest.id)) continue;
+ items.push({
+ annotationCount: latest.annotations?.length || undefined,
+ attachments: latest.attachments,
+ author: decider(latest.decidedBy),
+ createdAt: latest.createdAt,
+ key: `check-${latest.id}`,
+ scope: `C${check.seq} ${check.title}`,
+ text: latest.comment ?? '',
+ });
+ }
+
+ // Flow rejects: the latest attempt per check, in the newest version's newest run.
+ for (const flow of flows) {
+ const version = flow.versions[0];
+ const run = version?.runs[0];
+ if (!version || !run) continue;
+ const latestAttempt = new Map(run.attempts.map((attempt) => [attempt.checkItemId, attempt.id]));
+ for (const attempt of run.attempts) {
+ if (attempt.review !== 'rejected' || latestAttempt.get(attempt.checkItemId) !== attempt.id)
+ continue;
+ const node = version.nodes.find((entry) => entry.id === attempt.nodeId);
+ items.push({
+ annotationCount: attempt.reviewDetail?.annotations?.length || undefined,
+ attachments: attempt.reviewAttachments,
+ author: decider(attempt.reviewDetail?.decidedBy),
+ createdAt: attempt.reviewDetail?.decidedAt ?? '',
+ key: `flow-${attempt.id}`,
+ scope: `${node?.title ?? ''} · #${attempt.sequence}`,
+ text: attempt.reviewComment ?? '',
+ });
+ }
+ }
+
+ // Round-level reasons and group notes addressed to the current round.
+ for (const round of rounds) {
+ const roundIndex = round.run.roundIndex ?? 0;
+ if (roundIndex < currentRoundIndex) continue;
+ const detail = round.run.decisionDetail;
+ if (round.run.userDecision === 'reject' && detail?.comment?.trim())
+ items.push({
+ author: decider(detail.decidedBy),
+ createdAt: detail.decidedAt ?? '',
+ key: `decision-${round.run.id}`,
+ text: detail.comment,
+ });
+ for (const [index, entry] of (detail?.groupFeedback ?? []).entries()) {
+ items.push({
+ attachments: entry.attachments,
+ author: { kind: 'unknown' },
+ createdAt: entry.createdAt,
+ key: `group-${round.run.id}-${index}`,
+ scope: entry.category || undefined,
+ text: entry.comment,
+ });
+ }
+ }
+
+ // Discussion: every comment in a thread nobody has resolved.
+ const commentsById = new Map(comments.map((item) => [item.id, item]));
+ const checksById = new Map(checks.map((check) => [check.id, check]));
+ for (const item of comments) {
+ if (item.kind !== 'comment' || item.deletedAt) continue;
+ const root = item.parentCommentId ? commentsById.get(item.parentCommentId) : item;
+ if (!root || root.resolvedAt) continue;
+ const check = root.checkItemId ? checksById.get(root.checkItemId) : undefined;
+ const mine =
+ Boolean(viewer.id) && item.author.type !== 'agent' && item.authorUserId === viewer.id;
+ items.push({
+ annotationCount: !item.parentCommentId && root.rect ? 1 : undefined,
+ attachments: item.attachments,
+ author: {
+ avatar: item.author.avatar || undefined,
+ kind: mine ? 'mine' : 'other',
+ // Same fallback as the discussion's comment cards.
+ name: item.author.fullName || item.author.username || '—',
+ },
+ createdAt: new Date(item.createdAt).toISOString(),
+ key: `comment-${item.id}`,
+ scope: check ? `C${check.seq} ${check.title}` : undefined,
+ text: item.content,
+ });
+ }
+
+ return items.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
+};
+
+export type RejectFeedbackPreviewState = 'error' | 'loading' | 'none' | 'ready';
+
+/**
+ * Which face the preview shows. "Nothing else goes along" is a claim, so it is
+ * only made once the discussion has actually loaded — a still-empty or failed
+ * comment list must never read as an empty set, since the agent will fetch it.
+ */
+export const rejectFeedbackPreviewState = ({
+ bundleReady,
+ commentsError,
+ commentsLoading,
+ count,
+}: {
+ bundleReady: boolean;
+ commentsError?: unknown;
+ commentsLoading: boolean;
+ count: number;
+}): RejectFeedbackPreviewState => {
+ if (!bundleReady || commentsLoading) return 'loading';
+ if (commentsError) return 'error';
+ return count > 0 ? 'ready' : 'none';
+};