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: improve acceptance delivery navigation (#17575)

Arvin Xu9321eb196557
diff --git a/.agents/acceptance/common-mistakes.md b/.agents/acceptance/common-mistakes.md
index 6e3146d827e..ee5370041ac 100644
--- a/.agents/acceptance/common-mistakes.md
+++ b/.agents/acceptance/common-mistakes.md
@@ -96,6 +96,33 @@ that exists on only one side) or read `settings.json` directly; to publish
without clobbering a localhost login, log in to prod under an isolated
`LOBEHUB_CLI_HOME` and keep that variable set for the ingest.
+### L-D4 — Pinning a composer open while leaving its collapse affordance visible
+
+**Wrong approach:** configure a host surface to default its shared composer open,
+but continue rendering the shared component's Collapse action.
+
+**Why it fails:** the host promises a permanently available input while the UI
+still advertises the opposite state transition; clicking it restores the very
+extra step the host-specific design removed.
+
+**Correct approach:** make collapse capability an explicit host option. A pinned
+composer hides the Collapse action, while drawer or overlay hosts retain their
+existing collapsible behavior; verify both host contracts independently.
+
+### L-D5 — Mapping an annotation to copy without checking control boundaries
+
+**Wrong approach:** infer that a circled footer region refers to “Copy review
+prompt” when the region spans adjacent actions, then replace that label with “Fix”.
+
+**Why it fails:** the copy action and the dispatch action have different intent;
+changing the wrong control removes useful transport wording while leaving the
+requested primary action unchanged.
+
+**Correct approach:** map normalized annotation coordinates onto the actual
+screenshot dimensions and inspect every control inside the region. Preserve “Copy
+review prompt” and apply “Fix” to “Send back & rerun”; regression-test both labels
+together and visually verify their side-by-side rendering.
+
## Environment safety
### L-S1 — Acquiring Electron auth through OAuth
diff --git a/.agents/acceptance/probe-mock-patterns.md b/.agents/acceptance/probe-mock-patterns.md
index c71a3982895..80dfaf77c55 100644
--- a/.agents/acceptance/probe-mock-patterns.md
+++ b/.agents/acceptance/probe-mock-patterns.md
@@ -97,6 +97,19 @@ Client and server agent runtimes can produce the same visible result. Prove the
runtime with a server-only artifact: operation row, queue step, or enabled
main/server log namespace. Renderer state alone is not sufficient.
+### Locale regression tests and desktop resource scanning
+
+**Situation:** a locale-copy change needs a focused regression assertion while
+the Electron dev renderer imports locale resources from the default resource tree.
+
+**Doesn't work:** placing `*.test.ts` beside files in
+`packages/locales/src/default/`. The desktop resource scan can include that module
+in the renderer graph, which makes Vite optimize and execute `vitest` in the app.
+
+**Works:** keep the assertion under the consuming feature's test directory and
+import the locale resource there. Restart the isolated Electron instance after a
+bad scan because the optimized dependency graph can remain poisoned.
+
## Detailed references
- [Probe field notes](./references/probe-field-notes.md) — all historical
diff --git a/.agents/skills/agent-testing/SKILL.md b/.agents/skills/agent-testing/SKILL.md
index 246252e6c54..55c8468896b 100644
--- a/.agents/skills/agent-testing/SKILL.md
+++ b/.agents/skills/agent-testing/SKILL.md
@@ -544,6 +544,13 @@ env -u LOBEHUB_SERVER -u LOBE_API_KEY -u LOBEHUB_CLI_API_KEY -u LOBEHUB_CLI_HOME
and reuse the exact stable check id so the next result lands on the same row.
- For a semantic replacement, create a new id with `supersedes: ['old-id']`.
A fresh id without `supersedes` creates an unrelated parallel check.
+- **`supersedes` is persistent plan lineage, not a one-round migration flag.**
+ Every later round that reuses the successor id MUST repeat its complete
+ `supersedes` list. The Acceptance union reads the latest plan snapshot for an
+ id; omitting the list later can resurrect the replaced check as a parallel row.
+ Before ingest, compare the new plan with `acceptance view`: if a reused id has
+ ever declared `supersedes`, carry that declaration forward unchanged (including
+ the full chain) unless the business meaning is explicitly being replaced again.
- Treat `stale: true` feedback as history already consumed by a newer round.
#### Every verification run is an immutable snapshot
diff --git a/.agents/skills/agent-testing/references/plan.md b/.agents/skills/agent-testing/references/plan.md
index 99b7ad0c60c..51155bd3e22 100644
--- a/.agents/skills/agent-testing/references/plan.md
+++ b/.agents/skills/agent-testing/references/plan.md
@@ -84,6 +84,15 @@ On a follow-up round, seed the plan from
and annotations into the expected outcome, and reuse their exact stable ids.
- Plan all remaining checks from their current state, again reusing stable ids.
A semantic replacement requires a new id plus `supersedes: ['old-id']`.
+- Treat `supersedes` as persistent lineage. When a later round reuses a successor
+ id, copy its complete historical `supersedes` list into the new plan again.
+ Never assume an earlier round made the relationship permanent: the Acceptance
+ union uses the latest plan snapshot for that id, so a later omission can split
+ the successor and replaced check back into parallel rows.
+- Before publish, compare every reused plan id against `acceptance view`. If its
+ latest or historical plan declared `supersedes`, fail the preflight until the
+ new plan carries the same complete list (unless this round deliberately creates
+ another semantic replacement and declares that new chain explicitly).
## Confirmation behavior
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.json
index c84fdee35de..d8dac454e04 100644
--- a/locales/en-US/verify.json
+++ b/locales/en-US/verify.json
@@ -27,7 +27,7 @@
"acceptance.bar.progressDone": "All {{total}} checks confirmed — ready to accept",
"acceptance.bar.progressZero": "{{total}} checks awaiting your review",
"acceptance.bar.rejectComment": "Reject with comment",
- "acceptance.bar.rerun": "Send back & rerun",
+ "acceptance.bar.rerun": "Fix",
"acceptance.bar.rerunDrafted": "Drafted into your composer — review and send it.",
"acceptance.bar.rerunSent": "Sent to the origin conversation — the repair round is starting.",
"acceptance.checks.allAccepted.desc": "Nice work — every acceptance check has been signed off.",
@@ -68,6 +68,8 @@
"acceptance.filter.needsFix": "Needs fix {{count}}",
"acceptance.filter.pending": "To review {{count}}",
"acceptance.filter.roundAll": "All rounds",
+ "acceptance.focus.back": "Back to overview",
+ "acceptance.focus.evidenceHint": "Review the acceptance criterion, evidence, and feedback for this check.",
"acceptance.goalCollapse": "Collapse the acceptance goal",
"acceptance.goalEdit": "Edit the acceptance goal",
"acceptance.goalExpand": "Expand the acceptance goal",
@@ -93,13 +95,14 @@
"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.expand": "Expand the round ledger",
+ "acceptance.ledger.collapse": "Collapse runs",
+ "acceptance.ledger.expand": "Expand runs",
"acceptance.ledger.latest": "Latest",
"acceptance.ledger.pending": "Awaiting review",
- "acceptance.ledger.title": "Round ledger",
+ "acceptance.ledger.title": "Runs",
"acceptance.ledger.viewReport": "View round report",
"acceptance.origin.agentFallback": "Agent",
+ "acceptance.origin.backToRuns": "Back to runs",
"acceptance.origin.openTopic": "Open topic",
"acceptance.reject.description": "Your reason becomes input for the next repair round; this is not a passive comment.",
"acceptance.reject.placeholder": "Describe what must change before this delivery can be accepted.",
@@ -219,7 +222,7 @@
"acceptance.workspace.renameSuccess": "Renamed",
"acceptance.workspace.statusError": "Failed to update status",
"acceptance.workspace.statusSuccess": "Status updated",
- "acceptance.workspace.title": "Acceptances",
+ "acceptance.workspace.title": "Acceptance",
"badge.errored": "Check could not run",
"badge.failed": "Check failed",
"badge.passed": "Check passed",
diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.json
index 80afba138bd..0255b7295d3 100644
--- a/locales/zh-CN/verify.json
+++ b/locales/zh-CN/verify.json
@@ -68,6 +68,8 @@
"acceptance.filter.needsFix": "待修复 {{count}}",
"acceptance.filter.pending": "未验收 {{count}}",
"acceptance.filter.roundAll": "全部轮次",
+ "acceptance.focus.back": "返回验收概览",
+ "acceptance.focus.evidenceHint": "集中检查该项的验收标准、证据和反馈。",
"acceptance.goalCollapse": "收起验收目标",
"acceptance.goalEdit": "编辑验收目标",
"acceptance.goalExpand": "展开验收目标",
@@ -93,13 +95,14 @@
"acceptance.ledger.accepted": "已验收",
"acceptance.ledger.acceptedStats": "{{accepted}}/{{total}} 已验收",
"acceptance.ledger.awaitingStats": "{{total}} 项等待验收",
- "acceptance.ledger.collapse": "收起轮次审计",
- "acceptance.ledger.expand": "展开轮次审计",
+ "acceptance.ledger.collapse": "收起运行记录",
+ "acceptance.ledger.expand": "展开运行记录",
"acceptance.ledger.latest": "最新",
"acceptance.ledger.pending": "待验收",
- "acceptance.ledger.title": "轮次审计",
+ "acceptance.ledger.title": "运行记录",
"acceptance.ledger.viewReport": "查看该轮报告",
"acceptance.origin.agentFallback": "智能体",
+ "acceptance.origin.backToRuns": "返回运行记录",
"acceptance.origin.openTopic": "打开话题",
"acceptance.reject.description": "打回不是留言:你的意见将作为输入,发起新一轮修复,完成后回到「待验收」。",
"acceptance.reject.placeholder": "说明打回原因,例如:深色模式需补截图证据……",
@@ -219,7 +222,7 @@
"acceptance.workspace.renameSuccess": "已重命名",
"acceptance.workspace.statusError": "状态更新失败",
"acceptance.workspace.statusSuccess": "状态已更新",
- "acceptance.workspace.title": "验收",
+ "acceptance.workspace.title": "Acceptance",
"badge.errored": "检查无法运行",
"badge.failed": "检查未通过",
"badge.passed": "检查通过",
diff --git a/packages/database/src/models/__tests__/messages/message.query.test.ts b/packages/database/src/models/__tests__/messages/message.query.test.ts
index 6ad44526404..18f525dbd69 100644
--- a/packages/database/src/models/__tests__/messages/message.query.test.ts
+++ b/packages/database/src/models/__tests__/messages/message.query.test.ts
@@ -1249,11 +1249,14 @@ describe('MessageModel Query Tests', () => {
expect(result2[0].id).toBe('msg-page-1');
});
- it('should work with agentId and topicId filters combined', async () => {
+ it('should use topicId as the conversation boundary across agents', async () => {
await serverDB.transaction(async (trx) => {
await trx.insert(sessions).values([{ id: 'agent-session', userId }]);
- await trx.insert(agents).values([{ id: 'agent1', userId, title: 'Agent 1' }]);
+ await trx.insert(agents).values([
+ { id: 'agent1', userId, title: 'Agent 1' },
+ { id: 'agent2', userId, title: 'Agent 2' },
+ ]);
await trx
.insert(agentsToSessions)
@@ -1283,14 +1286,23 @@ describe('MessageModel Query Tests', () => {
content: 'message in topic2',
createdAt: new Date('2023-01-02'),
},
+ {
+ agentId: 'agent2',
+ content: 'cross-agent reply in topic1',
+ createdAt: new Date('2023-01-03'),
+ id: 'msg-topic1-agent2',
+ role: 'assistant',
+ topicId: 'topic1',
+ userId,
+ },
]);
});
- // Query with agentId and topicId
+ // agentId identifies the active/owning agent, but a concrete topic is
+ // the conversation boundary and includes delegated agent replies.
const result = await messageModel.query({ agentId: 'agent1', topicId: 'topic1' });
- expect(result).toHaveLength(1);
- expect(result[0].id).toBe('msg-topic1');
+ expect(result.map((message) => message.id)).toEqual(['msg-topic1', 'msg-topic1-agent2']);
});
it('should only lookup agentsToSessions for current user', async () => {
diff --git a/packages/database/src/models/message.ts b/packages/database/src/models/message.ts
index 40462804336..e5383f1e77b 100644
--- a/packages/database/src/models/message.ts
+++ b/packages/database/src/models/message.ts
@@ -469,10 +469,16 @@ export class MessageModel {
return messageItems;
}
- // Standard query with session/topic/group filters
+ // A concrete topic is the conversation boundary and may legitimately
+ // contain messages from multiple agents (for example callAgent replies).
+ // Inbox queries have no topic, so they still require agent/session scope.
+ const conversationCondition = topicId
+ ? this.matchTopic(topicId)
+ : and(agentCondition ?? this.matchSession(sessionId), this.matchTopic(topicId));
+
+ // Standard query with conversation/topic/group filters
const whereCondition = and(
- agentCondition ?? this.matchSession(sessionId),
- this.matchTopic(topicId),
+ conversationCondition,
this.matchGroup(groupId),
this.matchThread(threadId),
);
diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.ts
index 81284f95fdf..be0d3bdc750 100644
--- a/packages/locales/src/default/verify.ts
+++ b/packages/locales/src/default/verify.ts
@@ -35,7 +35,7 @@ export default {
'acceptance.bar.progressDone': 'All {{total}} checks confirmed — ready to accept',
'acceptance.bar.progressZero': '{{total}} checks awaiting your review',
'acceptance.bar.rejectComment': 'Reject with comment',
- 'acceptance.bar.rerun': 'Send back & rerun',
+ 'acceptance.bar.rerun': 'Fix',
'acceptance.bar.rerunDrafted': 'Drafted into your composer — review and send it.',
'acceptance.bar.rerunSent': 'Sent to the origin conversation — the repair round is starting.',
'acceptance.checks.allAccepted.desc': 'Nice work — every acceptance check has been signed off.',
@@ -80,6 +80,9 @@ export default {
'acceptance.filter.needsFix': 'Needs fix {{count}}',
'acceptance.filter.pending': 'To review {{count}}',
'acceptance.filter.roundAll': 'All rounds',
+ 'acceptance.focus.back': 'Back to overview',
+ 'acceptance.focus.evidenceHint':
+ 'Review the acceptance criterion, evidence, and feedback for this check.',
'acceptance.goalCollapse': 'Collapse the acceptance goal',
'acceptance.goalEdit': 'Edit the acceptance goal',
'acceptance.goalExpand': 'Expand the acceptance goal',
@@ -107,13 +110,14 @@ export default {
'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.expand': 'Expand the round ledger',
+ 'acceptance.ledger.collapse': 'Collapse runs',
+ 'acceptance.ledger.expand': 'Expand runs',
'acceptance.ledger.latest': 'Latest',
'acceptance.ledger.pending': 'Awaiting review',
- 'acceptance.ledger.title': 'Round ledger',
+ 'acceptance.ledger.title': 'Runs',
'acceptance.ledger.viewReport': 'View round report',
'acceptance.origin.agentFallback': 'Agent',
+ 'acceptance.origin.backToRuns': 'Back to runs',
'acceptance.origin.openTopic': 'Open topic',
'acceptance.reject.description':
'Your reason becomes input for the next repair round; this is not a passive comment.',
@@ -244,7 +248,7 @@ export default {
'acceptance.workspace.renameSuccess': 'Renamed',
'acceptance.workspace.statusError': 'Failed to update status',
'acceptance.workspace.statusSuccess': 'Status updated',
- 'acceptance.workspace.title': 'Acceptances',
+ 'acceptance.workspace.title': 'Acceptance',
'report.actions.copyLink': 'Copy link',
'report.actions.copyLinkSuccess': 'Link copied',
'report.actions.openInBrowser': 'Open in browser',
diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx
index e224c7b183e..5f919205df8 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx
@@ -17,141 +17,154 @@ import {
} from '@/features/EditorCanvas/editorAttachments';
import { useEnterToSend } from '@/hooks/useEnterToSend';
-const FeedbackInput = memo(() => {
- const { t } = useTranslation('chat');
- const editor = useEditor();
- const sendMessage = useConversationStore((s) => s.sendMessage);
- const [submitting, setSubmitting] = useState(false);
- const [hasContent, setHasContent] = useState(false);
- const [hasAttachments, setHasAttachments] = useState(false);
- const [expanded, setExpanded] = useState(false);
- const shouldSendOnEnter = useEnterToSend();
- // Task follow-ups send into the shared agent's topic — view-only members
- // can watch the run but get no reply composer.
- const { canUseResource } = useConversationResourceAccess();
+interface FeedbackInputProps {
+ /** Acceptance's in-flow topic rail starts with the composer visible. The
+ floating Topic drawer keeps its compact, opt-in default. */
+ defaultExpanded?: boolean;
+ /** Hide the collapse affordance when the hosting surface intentionally pins
+ the composer open, as Acceptance's in-flow right rail does. */
+ disableCollapse?: boolean;
+}
- const canSubmit = hasContent || hasAttachments;
+const FeedbackInput = memo<FeedbackInputProps>(
+ ({ defaultExpanded = false, disableCollapse = false }) => {
+ const { t } = useTranslation('chat');
+ const editor = useEditor();
+ const sendMessage = useConversationStore((s) => s.sendMessage);
+ const [submitting, setSubmitting] = useState(false);
+ const [hasContent, setHasContent] = useState(false);
+ const [hasAttachments, setHasAttachments] = useState(false);
+ const [expanded, setExpanded] = useState(defaultExpanded);
+ const shouldSendOnEnter = useEnterToSend();
+ // Task follow-ups send into the shared agent's topic — view-only members
+ // can watch the run but get no reply composer.
+ const { canUseResource } = useConversationResourceAccess();
- useEffect(() => {
- if (expanded) editor?.focus?.();
- }, [expanded, editor]);
+ const canSubmit = hasContent || hasAttachments;
- const handleContentChange = useCallback(() => {
- const lexicalEditor = editor?.getLexicalEditor?.();
- if (!lexicalEditor) return;
- lexicalEditor.getEditorState().read(() => {
- const text = $getRoot().getTextContent().trim();
- setHasContent(text.length > 0);
- });
- setHasAttachments(getAttachmentFileIdsFromEditor(editor).length > 0);
- }, [editor]);
+ useEffect(() => {
+ if (expanded) editor?.focus?.();
+ }, [expanded, editor]);
- const handleAttach = useCallback(
- (files: File[]) => {
- insertFilesIntoEditor(editor, files);
- },
- [editor],
- );
+ const handleContentChange = useCallback(() => {
+ const lexicalEditor = editor?.getLexicalEditor?.();
+ if (!lexicalEditor) return;
+ lexicalEditor.getEditorState().read(() => {
+ const text = $getRoot().getTextContent().trim();
+ setHasContent(text.length > 0);
+ });
+ setHasAttachments(getAttachmentFileIdsFromEditor(editor).length > 0);
+ }, [editor]);
- const handleSubmit = useCallback(async () => {
- if (submitting) return;
- const editorData = editor?.getDocument?.('json') as Record<string, any> | undefined;
- const markdown = String(editor?.getDocument?.('markdown') ?? '').trim();
- const hasFiles = getAttachmentFileIdsFromEditor(editor).length > 0;
- if (!markdown && !hasFiles) return;
+ const handleAttach = useCallback(
+ (files: File[]) => {
+ insertFilesIntoEditor(editor, files);
+ },
+ [editor],
+ );
- // Clear the editor synchronously BEFORE await so the input feels
- // responsive — sendMessage's optimistic-update pipeline keeps a copy
- // of the captured markdown / editorData for rendering. Keep the
- // ChatInput expanded after send: once the user has opened the reply
- // composer, treat it as the new resting state for this drawer session.
- editor?.cleanDocument?.();
- setHasContent(false);
- setHasAttachments(false);
+ const handleSubmit = useCallback(async () => {
+ if (submitting) return;
+ const editorData = editor?.getDocument?.('json') as Record<string, any> | undefined;
+ const markdown = String(editor?.getDocument?.('markdown') ?? '').trim();
+ const hasFiles = getAttachmentFileIdsFromEditor(editor).length > 0;
+ if (!markdown && !hasFiles) return;
- setSubmitting(true);
- try {
- // sendMessage is bound to this drawer's ConversationProvider context
- // (agentId + topicId + isolatedTopic), so the message continues this
- // topic's conversation. Files attached inline in the editor travel as
- // part of editorData / markdown — no separate files array needed.
- // Force the gateway runtime so the follow-up runs on the same
- // server-side path as the original `runTask` that spawned this topic,
- // regardless of the user's global local/cloud preference.
- await sendMessage({ editorData, forceRuntime: 'gateway', message: markdown });
- } finally {
- setSubmitting(false);
- }
- }, [editor, sendMessage, submitting]);
+ // Clear the editor synchronously BEFORE await so the input feels
+ // responsive — sendMessage's optimistic-update pipeline keeps a copy
+ // of the captured markdown / editorData for rendering. Keep the
+ // ChatInput expanded after send: once the user has opened the reply
+ // composer, treat it as the new resting state for this drawer session.
+ editor?.cleanDocument?.();
+ setHasContent(false);
+ setHasAttachments(false);
+
+ setSubmitting(true);
+ try {
+ // sendMessage is bound to this drawer's ConversationProvider context
+ // (agentId + topicId + isolatedTopic), so the message continues this
+ // topic's conversation. Files attached inline in the editor travel as
+ // part of editorData / markdown — no separate files array needed.
+ // Force the gateway runtime so the follow-up runs on the same
+ // server-side path as the original `runTask` that spawned this topic,
+ // regardless of the user's global local/cloud preference.
+ await sendMessage({ editorData, forceRuntime: 'gateway', message: markdown });
+ } finally {
+ setSubmitting(false);
+ }
+ }, [editor, sendMessage, submitting]);
+
+ if (!canUseResource) return <OpStatusTray seamless />;
- if (!canUseResource) return <OpStatusTray seamless />;
+ // Surface the live running-op status flush above the reply affordance (seamless
+ // inline row that renders nothing when idle), so the user can watch the agent
+ // work without expanding the composer.
+ if (!expanded) {
+ return (
+ <Flexbox gap={8}>
+ <OpStatusTray seamless />
+ <Button block icon={MessageCirclePlus} type={'fill'} onClick={() => setExpanded(true)}>
+ {t('taskDetail.sendFollowUp')}
+ </Button>
+ </Flexbox>
+ );
+ }
- // Surface the live running-op status flush above the reply affordance (seamless
- // inline row that renders nothing when idle), so the user can watch the agent
- // work without expanding the composer.
- if (!expanded) {
return (
<Flexbox gap={8}>
<OpStatusTray seamless />
- <Button block icon={MessageCirclePlus} type={'fill'} onClick={() => setExpanded(true)}>
- {t('taskDetail.sendFollowUp')}
- </Button>
+ <ChatInput
+ maxHeight={240}
+ minHeight={64}
+ footer={
+ <ChatInputActionBar
+ style={{ paddingInline: 8 }}
+ left={
+ <Flexbox horizontal align={'center'} gap={2}>
+ {!disableCollapse && (
+ <Button
+ icon={ChevronDownIcon}
+ size={'small'}
+ type={'text'}
+ onClick={() => setExpanded(false)}
+ >
+ {t('taskDetail.collapseReply')}
+ </Button>
+ )}
+ <AttachmentUploadButton onFiles={handleAttach} />
+ </Flexbox>
+ }
+ right={
+ <SendButton
+ disabled={!canSubmit && !submitting}
+ loading={submitting}
+ shape={'round'}
+ title={t('taskDetail.replyInThread')}
+ type={'primary'}
+ onClick={handleSubmit}
+ />
+ }
+ />
+ }
+ >
+ <EditorCanvas
+ editor={editor}
+ floatingToolbar={false}
+ placeholder={t('taskDetail.replyPlaceholder')}
+ style={{ paddingBlock: 0 }}
+ onContentChange={handleContentChange}
+ onPressEnter={({ event }) => {
+ if (shouldSendOnEnter(event)) {
+ handleSubmit();
+ return true;
+ }
+ }}
+ />
+ </ChatInput>
</Flexbox>
);
- }
-
- return (
- <Flexbox gap={8}>
- <OpStatusTray seamless />
- <ChatInput
- maxHeight={240}
- minHeight={64}
- footer={
- <ChatInputActionBar
- style={{ paddingInline: 8 }}
- left={
- <Flexbox horizontal align={'center'} gap={2}>
- <Button
- icon={ChevronDownIcon}
- size={'small'}
- type={'text'}
- onClick={() => setExpanded(false)}
- >
- {t('taskDetail.collapseReply')}
- </Button>
- <AttachmentUploadButton onFiles={handleAttach} />
- </Flexbox>
- }
- right={
- <SendButton
- disabled={!canSubmit && !submitting}
- loading={submitting}
- shape={'round'}
- title={t('taskDetail.replyInThread')}
- type={'primary'}
- onClick={handleSubmit}
- />
- }
- />
- }
- >
- <EditorCanvas
- editor={editor}
- floatingToolbar={false}
- placeholder={t('taskDetail.replyPlaceholder')}
- style={{ paddingBlock: 0 }}
- onContentChange={handleContentChange}
- onPressEnter={({ event }) => {
- if (shouldSendOnEnter(event)) {
- handleSubmit();
- return true;
- }
- }}
- />
- </ChatInput>
- </Flexbox>
- );
-});
+ },
+);
FeedbackInput.displayName = 'FeedbackInput';
diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx
index 0f90e12e9c2..479a95ad09c 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx
@@ -217,7 +217,19 @@ vi.mock('../TopicStatusIcon', () => ({
}));
vi.mock('./FeedbackInput', () => ({
- default: () => <div data-testid="feedback-input" />,
+ default: ({
+ defaultExpanded,
+ disableCollapse,
+ }: {
+ defaultExpanded?: boolean;
+ disableCollapse?: boolean;
+ }) => (
+ <div
+ data-default-expanded={String(Boolean(defaultExpanded))}
+ data-disable-collapse={String(Boolean(disableCollapse))}
+ data-testid="feedback-input"
+ />
+ ),
}));
describe('TopicChatDrawer', () => {
@@ -236,6 +248,13 @@ describe('TopicChatDrawer', () => {
expect(mocks.agentState.useHydrateAgentConfig).toHaveBeenCalledWith(true, 'agt_assignee');
});
+ it('keeps the floating drawer reply input collapsed by default', () => {
+ const { getByTestId } = render(<TopicChatDrawer />);
+
+ expect(getByTestId('feedback-input')).toHaveAttribute('data-default-expanded', 'false');
+ expect(getByTestId('feedback-input')).toHaveAttribute('data-disable-collapse', 'false');
+ });
+
it('disables topic sharing for workspace viewers', () => {
mocks.permission.allowed = false;
mocks.serverConfigState.serverConfig.enableBusinessFeatures = true;
diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx
index b6319c2ddba..0cb2388d4b2 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx
@@ -30,73 +30,80 @@ import FeedbackInput from './FeedbackInput';
const SHARE_ICON_SIZE = { blockSize: 32, size: 16 } as const;
-interface TopicChatDrawerBodyProps {
+export interface TopicChatDrawerBodyProps {
agentId: string;
+ defaultInputExpanded?: boolean;
+ disableInputCollapse?: boolean;
topicId: string;
}
-const TopicChatDrawerBody = memo<TopicChatDrawerBodyProps>(({ agentId, topicId }) => {
- const isLogin = useUserStore(authSelectors.isLogin);
- const useHydrateAgentConfig = useAgentStore((s) => s.useHydrateAgentConfig);
-
- useHydrateAgentConfig(isLogin, agentId);
-
- const context = useMemo<ConversationContext>(
- () => ({
- agentId,
- isolatedTopic: true,
- scope: 'main',
- topicId,
- }),
- [agentId, topicId],
- );
-
- const chatKey = messageMapKey(context);
- const messages = useChatStore((s) => s.dbMessagesMap[chatKey]);
- const replaceMessages = useChatStore((s) => s.replaceMessages);
- const operationState = useOperationState(context);
-
- const runningOperation = useTaskStore(
- (s) => taskActivitySelectors.activeDrawerTopicActivity(s)?.runningOperation,
- );
- useGatewayReconnect(topicId, runningOperation);
-
- const itemContent = useCallback(
- (index: number, id: string) => (
- <MessageItem
- disableEditing
- defaultWorkflowExpandLevel="full"
- id={id}
- index={index}
- key={id}
- />
- ),
- [],
- );
-
- return (
- <ConversationProvider
- context={context}
- hasInitMessages={!!messages}
- messages={messages}
- operationState={operationState}
- onMessagesChange={(msgs, ctx) => {
- replaceMessages(msgs, { context: ctx });
- }}
- >
- <TaskCardScopeProvider value={true}>
- <Flexbox height={'100%'} style={{ overflow: 'hidden' }}>
- <Flexbox flex={1} style={{ minHeight: 0, overflow: 'hidden' }}>
- <ChatList disableActionsBar itemContent={itemContent} />
+export const TopicChatDrawerBody = memo<TopicChatDrawerBodyProps>(
+ ({ agentId, defaultInputExpanded, disableInputCollapse, topicId }) => {
+ const isLogin = useUserStore(authSelectors.isLogin);
+ const useHydrateAgentConfig = useAgentStore((s) => s.useHydrateAgentConfig);
+
+ useHydrateAgentConfig(isLogin, agentId);
+
+ const context = useMemo<ConversationContext>(
+ () => ({
+ agentId,
+ isolatedTopic: true,
+ scope: 'main',
+ topicId,
+ }),
+ [agentId, topicId],
+ );
+
+ const chatKey = messageMapKey(context);
+ const messages = useChatStore((s) => s.dbMessagesMap[chatKey]);
+ const replaceMessages = useChatStore((s) => s.replaceMessages);
+ const operationState = useOperationState(context);
+
+ const runningOperation = useTaskStore(
+ (s) => taskActivitySelectors.activeDrawerTopicActivity(s)?.runningOperation,
+ );
+ useGatewayReconnect(topicId, runningOperation);
+
+ const itemContent = useCallback(
+ (index: number, id: string) => (
+ <MessageItem
+ disableEditing
+ defaultWorkflowExpandLevel="full"
+ id={id}
+ index={index}
+ key={id}
+ />
+ ),
+ [],
+ );
+
+ return (
+ <ConversationProvider
+ context={context}
+ hasInitMessages={!!messages}
+ messages={messages}
+ operationState={operationState}
+ onMessagesChange={(msgs, ctx) => {
+ replaceMessages(msgs, { context: ctx });
+ }}
+ >
+ <TaskCardScopeProvider value={true}>
+ <Flexbox height={'100%'} style={{ overflow: 'hidden' }}>
+ <Flexbox flex={1} style={{ minHeight: 0, overflow: 'hidden' }}>
+ <ChatList disableActionsBar itemContent={itemContent} />
+ </Flexbox>
+ <Flexbox paddingBlock={'0 12px'} paddingInline={12} style={{ flexShrink: 0 }}>
+ <FeedbackInput
+ defaultExpanded={defaultInputExpanded}
+ disableCollapse={disableInputCollapse}
+ />
+ </Flexbox>
</Flexbox>
- <Flexbox paddingBlock={'0 12px'} paddingInline={12} style={{ flexShrink: 0 }}>
- <FeedbackInput />
- </Flexbox>
- </Flexbox>
- </TaskCardScopeProvider>
- </ConversationProvider>
- );
-});
+ </TaskCardScopeProvider>
+ </ConversationProvider>
+ );
+ },
+);
TopicChatDrawerBody.displayName = 'TopicChatDrawerBody';
diff --git a/src/features/Verify/Acceptance/CheckList.tsx b/src/features/Verify/Acceptance/CheckList.tsx
index c49db941e54..ed268db4367 100644
--- a/src/features/Verify/Acceptance/CheckList.tsx
+++ b/src/features/Verify/Acceptance/CheckList.tsx
@@ -700,362 +700,416 @@ const IterationTimeline = memo<{
const CheckRow = memo<{
canReview: boolean;
check: AcceptanceCheck;
+ detailMode?: boolean;
expanded: boolean;
+ onOpen?: () => void;
onReview: (input: CheckReviewInput) => Promise<boolean>;
onRound: (round: number) => void;
onToggle: () => void;
reviewPending: boolean;
-}>(({ canReview, check, expanded, onReview, onRound, onToggle, reviewPending }) => {
- const { t } = useTranslation('verify');
- // The judging narrative stays collapsed: level one is title + evidence.
- const [historyOpen, setHistoryOpen] = useState(false);
- const [seqCopied, setSeqCopied] = useState(false);
- const [accepting, setAccepting] = useState(false);
- const meta = STATE_META[check.state];
- const counts = evidenceCounts(check.evidence);
-
- const reviewState = userReviewState(check);
- // The decision is stamped on the check's result row — a never-executed
- // check has no evidence to judge, so it exposes no review actions.
- const reviewable = canReview && Boolean(check.result);
- const activeReview =
- check.userReview && !check.userReview.stale
- ? check.reviews.at(-1) // the standing verdict is always the newest entry
- : undefined;
- const historyReviews = check.reviews.filter((entry) => entry !== activeReview);
- const evidenceById = collectEvidenceById(check);
- const hasHistory = check.revisions > 1 || historyReviews.length > 0;
-
- const openReject = () =>
- openCheckRejectModal({
- checkTitle: `C${check.seq} · ${check.title}`,
- draftKey: check.id,
- evidence: check.evidence
- .filter((item) => isVisual(item))
- .map((item) => ({ fileUrl: item.fileUrl!, id: item.id })),
- onConfirm: ({ annotations, comment, fileIds }) =>
- onReview({
- action: 'reject',
- annotations: annotations.length > 0 ? annotations : undefined,
- checkItemIds: [check.id],
- comment: comment || undefined,
- fileIds: fileIds.length > 0 ? fileIds : undefined,
- }),
- });
-
- // Accepting settles the check — the row folds itself away once the write
- // lands, so the reviewer's eye moves on to what still needs judgment.
- const handleAccept = async (event: { stopPropagation: () => void }) => {
- event.stopPropagation();
- setAccepting(true);
- const ok = await onReview({ action: 'accept', checkItemIds: [check.id] });
- setAccepting(false);
- if (ok && expanded) onToggle();
- };
-
- // The user's standing verdict owns the head slot: a reject replaces the
- // verifier's mark outright (that check IS sent back, whatever the verifier
- // said); passed + user-accepted merges into the double-check receipt.
- const headIcon =
- reviewState === 'rejected'
- ? MessageSquareX
- : check.state === 'passed' && reviewState === 'accepted'
- ? CheckCheck
- : meta.icon;
- const headColor = reviewState === 'rejected' ? cssVar.colorError : meta.color;
-
- const headIconNode = (
- <Icon color={headColor} icon={headIcon} size={16} style={{ flex: 'none' }} />
- );
+}>(
+ ({
+ canReview,
+ check,
+ detailMode,
+ expanded,
+ onOpen,
+ onReview,
+ onRound,
+ onToggle,
+ reviewPending,
+ }) => {
+ const { t } = useTranslation('verify');
+ // The judging narrative stays collapsed: level one is title + evidence.
+ const [historyOpen, setHistoryOpen] = useState(false);
+ const [seqCopied, setSeqCopied] = useState(false);
+ const [accepting, setAccepting] = useState(false);
+ const meta = STATE_META[check.state];
+ const counts = evidenceCounts(check.evidence);
+
+ const reviewState = userReviewState(check);
+ // The decision is stamped on the check's result row — a never-executed
+ // check has no evidence to judge, so it exposes no review actions.
+ const reviewable = canReview && Boolean(check.result);
+ const activeReview =
+ check.userReview && !check.userReview.stale
+ ? check.reviews.at(-1) // the standing verdict is always the newest entry
+ : undefined;
+ const historyReviews = check.reviews.filter((entry) => entry !== activeReview);
+ const evidenceById = collectEvidenceById(check);
+ const hasHistory = check.revisions > 1 || historyReviews.length > 0;
+
+ const openReject = () =>
+ openCheckRejectModal({
+ checkTitle: `C${check.seq} · ${check.title}`,
+ draftKey: check.id,
+ evidence: check.evidence
+ .filter((item) => isVisual(item))
+ .map((item) => ({ fileUrl: item.fileUrl!, id: item.id })),
+ onConfirm: ({ annotations, comment, fileIds }) =>
+ onReview({
+ action: 'reject',
+ annotations: annotations.length > 0 ? annotations : undefined,
+ checkItemIds: [check.id],
+ comment: comment || undefined,
+ fileIds: fileIds.length > 0 ? fileIds : undefined,
+ }),
+ });
+
+ // Accepting settles the check — the row folds itself away once the write
+ // lands, so the reviewer's eye moves on to what still needs judgment.
+ const handleAccept = async (event: { stopPropagation: () => void }) => {
+ event.stopPropagation();
+ setAccepting(true);
+ const ok = await onReview({ action: 'accept', checkItemIds: [check.id] });
+ setAccepting(false);
+ if (ok && expanded) onToggle();
+ };
+
+ // The user's standing verdict owns the head slot: a reject replaces the
+ // verifier's mark outright (that check IS sent back, whatever the verifier
+ // said); passed + user-accepted merges into the double-check receipt.
+ const headIcon =
+ reviewState === 'rejected'
+ ? MessageSquareX
+ : check.state === 'passed' && reviewState === 'accepted'
+ ? CheckCheck
+ : meta.icon;
+ const headColor = reviewState === 'rejected' ? cssVar.colorError : meta.color;
+
+ const headIconNode = (
+ <Icon color={headColor} icon={headIcon} size={16} style={{ flex: 'none' }} />
+ );
- return (
- <Flexbox className={styles.row} data-check-row={check.id}>
- <Flexbox
- horizontal
- align={'center'}
- className={styles.rowHeader}
- data-expanded={expanded ? '' : undefined}
- gap={10}
- onClick={onToggle}
- >
- {reviewState === 'rejected' ? (
- <Tooltip title={t('acceptance.review.rejectedHint')}>{headIconNode}</Tooltip>
- ) : (
- headIconNode
- )}
- <Tooltip title={seqCopied ? t('acceptance.checks.copied') : t('acceptance.checks.copySeq')}>
- <span
- className={cx(styles.seqChip, styles.seqChipClickable)}
- onClick={(event) => {
- event.stopPropagation();
- void copyToClipboard(`C${check.seq}`);
- setSeqCopied(true);
- setTimeout(() => setSeqCopied(false), 1500);
- }}
- >
- C{check.seq}
- </span>
- </Tooltip>
- <Flexbox
- horizontal
- align={'center'}
- flex={1}
- gap={8}
- style={{ minWidth: 0 }}
- wrap={expanded ? 'wrap' : 'nowrap'}
- >
- <Text
- className={expanded ? undefined : styles.titleEllipsis}
- style={{ fontSize: 13, minWidth: 0 }}
+ return (
+ <Flexbox className={detailMode ? undefined : styles.row} data-check-row={check.id}>
+ {!detailMode && (
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.rowHeader}
+ data-expanded={expanded ? '' : undefined}
+ gap={10}
+ onClick={onOpen ?? onToggle}
>
- {check.title}
- </Text>
- {!check.required && (
- <Tooltip title={t('acceptance.checks.notRequiredHint')}>
- <Tag size={'small'}>{t('acceptance.checks.notRequired')}</Tag>
- </Tooltip>
- )}
- {/* The verdict pair travels WITH the title, not adrift at the row's
- far right: the claim you judge and the judgement you give land in
- one glance, so a long checklist needs no eye round-trip across the
- row (and no mis-click onto a neighbour's buttons). */}
- {reviewable && reviewState === 'pending' && (
- <Flexbox
- horizontal
- align={'center'}
- className={cx(styles.rowActions, 'acceptance-row-actions')}
- gap={2}
- style={{
- // The accept spinner must stay visible after the pointer leaves.
- ...(accepting ? { opacity: 1 } : undefined),
- flex: 'none',
- }}
+ {reviewState === 'rejected' ? (
+ <Tooltip title={t('acceptance.review.rejectedHint')}>{headIconNode}</Tooltip>
+ ) : (
+ headIconNode
+ )}
+ <Tooltip
+ title={seqCopied ? t('acceptance.checks.copied') : t('acceptance.checks.copySeq')}
>
- <ActionIcon
- disabled={reviewPending && !accepting}
- icon={Check}
- loading={accepting}
- size={'small'}
- title={t('acceptance.review.accept')}
- onClick={handleAccept}
- />
- <ActionIcon
- disabled={reviewPending}
- icon={MessageSquareX}
- size={'small'}
- title={t('acceptance.review.reject')}
+ <span
+ className={cx(styles.seqChip, styles.seqChipClickable)}
onClick={(event) => {
event.stopPropagation();
- openReject();
+ void copyToClipboard(`C${check.seq}`);
+ setSeqCopied(true);
+ setTimeout(() => setSeqCopied(false), 1500);
}}
- />
- </Flexbox>
- )}
- </Flexbox>
- <Flexbox horizontal align={'center'} gap={6}>
- {/* An accept on a NON-passed verdict can't merge into the head icon
- (the failed/uncertain mark must stay visible) — mark it here. */}
- {reviewState === 'accepted' && check.state !== 'passed' && (
- <Tooltip
- title={t('acceptance.review.acceptedNote', {
- time: dayjs(check.userReview!.createdAt).format('MM-DD HH:mm'),
- })}
- >
- <Icon color={cssVar.colorTextQuaternary} icon={BadgeCheck} size={14} />
+ >
+ C{check.seq}
+ </span>
</Tooltip>
- )}
- {EVIDENCE_BADGES.map(({ icon, key, labelKey }) =>
- counts[key] ? (
- <Tooltip key={key} title={t(labelKey, { count: counts[key] })}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ flex={1}
+ gap={8}
+ style={{ minWidth: 0 }}
+ wrap={expanded ? 'wrap' : 'nowrap'}
+ >
+ <Text
+ className={expanded ? undefined : styles.titleEllipsis}
+ style={{ fontSize: 13, minWidth: 0 }}
+ >
+ {check.title}
+ </Text>
+ {!check.required && (
+ <Tooltip title={t('acceptance.checks.notRequiredHint')}>
+ <Tag size={'small'}>{t('acceptance.checks.notRequired')}</Tag>
+ </Tooltip>
+ )}
+ {/* The verdict pair travels WITH the title, not adrift at the row's
+ far right: the claim you judge and the judgement you give land in
+ one glance, so a long checklist needs no eye round-trip across the
+ row (and no mis-click onto a neighbour's buttons). */}
+ {reviewable && reviewState === 'pending' && (
<Flexbox
horizontal
align={'center'}
- gap={3}
- style={{ color: cssVar.colorTextTertiary, fontSize: 11 }}
+ className={cx(styles.rowActions, 'acceptance-row-actions')}
+ gap={2}
+ style={{
+ // The accept spinner must stay visible after the pointer leaves.
+ ...(accepting ? { opacity: 1 } : undefined),
+ flex: 'none',
+ }}
>
- <Icon icon={icon} size={13} />
- {counts[key] > 1 ? counts[key] : null}
+ <ActionIcon
+ disabled={reviewPending && !accepting}
+ icon={Check}
+ loading={accepting}
+ size={'small'}
+ title={t('acceptance.review.accept')}
+ onClick={handleAccept}
+ />
+ <ActionIcon
+ disabled={reviewPending}
+ icon={MessageSquareX}
+ size={'small'}
+ title={t('acceptance.review.reject')}
+ onClick={(event) => {
+ event.stopPropagation();
+ openReject();
+ }}
+ />
</Flexbox>
- </Tooltip>
- ) : null,
- )}
- {/* The iteration mark stays compact — [↻ N]; the words (verified N
+ )}
+ </Flexbox>
+ <Flexbox horizontal align={'center'} gap={6}>
+ {/* An accept on a NON-passed verdict can't merge into the head icon
+ (the failed/uncertain mark must stay visible) — mark it here. */}
+ {reviewState === 'accepted' && check.state !== 'passed' && (
+ <Tooltip
+ title={t('acceptance.review.acceptedNote', {
+ time: dayjs(check.userReview!.createdAt).format('MM-DD HH:mm'),
+ })}
+ >
+ <Icon color={cssVar.colorTextQuaternary} icon={BadgeCheck} size={14} />
+ </Tooltip>
+ )}
+ {EVIDENCE_BADGES.map(({ icon, key, labelKey }) =>
+ counts[key] ? (
+ <Tooltip key={key} title={t(labelKey, { count: counts[key] })}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={3}
+ style={{ color: cssVar.colorTextTertiary, fontSize: 11 }}
+ >
+ <Icon icon={icon} size={13} />
+ {counts[key] > 1 ? counts[key] : null}
+ </Flexbox>
+ </Tooltip>
+ ) : null,
+ )}
+ {/* The iteration mark stays compact — [↻ N]; the words (verified N
rounds · introduced in round X) live in its tooltip. Clicking
jumps to the round the concern first appeared in. */}
- {check.revisions > 1 && (
- <Tooltip
- title={[
- check.titleChanged
- ? t('acceptance.checks.iterated', { count: check.revisions })
- : t('acceptance.checks.rerun', { count: check.revisions }),
- check.resultRound !== undefined &&
- check.resultRound !== null &&
- check.introducedAtRound !== check.resultRound
- ? t('acceptance.checks.introduced', { round: check.introducedAtRound })
- : null,
- ]
- .filter(Boolean)
- .join(' · ')}
- >
- <span
- className={cx(styles.chip, styles.chipClickable)}
- onClick={(event) => {
- event.stopPropagation();
- onRound(check.introducedAtRound);
- }}
- >
- <Icon icon={Repeat} size={10} /> {check.revisions}
- </span>
- </Tooltip>
- )}
- {check.resultRound !== undefined && check.resultRound !== null && (
- <Tooltip title={t('acceptance.checks.finalRoundHint')}>
- <span
- className={cx(styles.chip, styles.chipClickable)}
- onClick={(event) => {
- event.stopPropagation();
- onRound(check.resultRound!);
+ {check.revisions > 1 && (
+ <Tooltip
+ title={[
+ check.titleChanged
+ ? t('acceptance.checks.iterated', { count: check.revisions })
+ : t('acceptance.checks.rerun', { count: check.revisions }),
+ check.resultRound !== undefined &&
+ check.resultRound !== null &&
+ check.introducedAtRound !== check.resultRound
+ ? t('acceptance.checks.introduced', { round: check.introducedAtRound })
+ : null,
+ ]
+ .filter(Boolean)
+ .join(' · ')}
+ >
+ <span
+ className={cx(styles.chip, styles.chipClickable)}
+ onClick={(event) => {
+ event.stopPropagation();
+ onRound(check.introducedAtRound);
+ }}
+ >
+ <Icon icon={Repeat} size={10} /> {check.revisions}
+ </span>
+ </Tooltip>
+ )}
+ {check.resultRound !== undefined && check.resultRound !== null && (
+ <Tooltip title={t('acceptance.checks.finalRoundHint')}>
+ <span
+ className={cx(styles.chip, styles.chipClickable)}
+ onClick={(event) => {
+ event.stopPropagation();
+ onRound(check.resultRound!);
+ }}
+ >
+ {t('acceptance.round', { round: check.resultRound })}
+ </span>
+ </Tooltip>
+ )}
+ <Icon
+ color={cssVar.colorTextQuaternary}
+ icon={ChevronRight}
+ size={14}
+ style={{
+ transform: expanded ? 'rotate(90deg)' : 'none',
+ transition: 'transform 0.2s',
}}
- >
- {t('acceptance.round', { round: check.resultRound })}
- </span>
- </Tooltip>
- )}
- <Icon
- color={cssVar.colorTextQuaternary}
- icon={ChevronRight}
- size={14}
- style={{ transform: expanded ? 'rotate(90deg)' : 'none', transition: 'transform 0.2s' }}
- />
- </Flexbox>
- </Flexbox>
+ />
+ </Flexbox>
+ </Flexbox>
+ )}
- {expanded && (
- <Flexbox gap={10} paddingBlock={'0 14px'} paddingInline={16}>
- {check.result?.toulmin?.evidence && (
- <Text className={styles.descClamp} fontSize={12} type={'secondary'}>
- {check.result.toulmin.evidence}
- </Text>
- )}
- <EvidenceList evidence={check.evidence} />
+ {expanded && (
+ <Flexbox
+ gap={10}
+ paddingBlock={detailMode ? 0 : '0 14px'}
+ paddingInline={detailMode ? 0 : 16}
+ >
+ {check.result?.toulmin?.evidence && (
+ <Text className={styles.descClamp} fontSize={12} type={'secondary'}>
+ {check.result.toulmin.evidence}
+ </Text>
+ )}
+ <EvidenceList evidence={check.evidence} />
- {/* An executed check with zero artifacts must SAY so — a silent blank
+ {/* An executed check with zero artifacts must SAY so — a silent blank
under the verdict reads as a rendering bug, not as a fact. Filled
so it reads as a status, never as more description text. */}
- {check.result && check.evidence.length === 0 && (
- <Flexbox
- paddingBlock={6}
- paddingInline={10}
- style={{
- background: cssVar.colorFillQuaternary,
- borderRadius: cssVar.borderRadius,
- width: '100%',
- }}
- >
- <Text fontSize={12} type={'secondary'}>
- {t('acceptance.evidence.empty')}
- </Text>
- </Flexbox>
- )}
+ {check.result && check.evidence.length === 0 && (
+ <Flexbox
+ paddingBlock={6}
+ paddingInline={10}
+ style={{
+ background: cssVar.colorFillQuaternary,
+ borderRadius: cssVar.borderRadius,
+ width: '100%',
+ }}
+ >
+ <Text fontSize={12} type={'secondary'}>
+ {t('acceptance.evidence.empty')}
+ </Text>
+ </Flexbox>
+ )}
- {/* The user's standing feedback hangs right under the evidence it
+ {/* The user's standing feedback hangs right under the evidence it
judges. BOTH verdicts keep an undo path — a mis-click is the most
likely way either happens, and a send-back the user didn't mean
otherwise costs a whole repair round to walk back. */}
- {activeReview &&
- (activeReview.action === 'accept' ? (
- <Flexbox horizontal align={'center'} gap={8}>
- <AcceptedNote review={activeReview} />
- {reviewable && (
- <Button
- disabled={reviewPending}
- size={'small'}
- type={'text'}
- onClick={(event) => {
- event.stopPropagation();
- openReject();
- }}
- >
- {t('acceptance.review.revertToReject')}
- </Button>
- )}
- </Flexbox>
- ) : (
- <Flexbox gap={6}>
- <FeedbackCard evidenceById={evidenceById} review={activeReview} />
- {/* The mirror of the accept escape: take the send-back back.
- A fresh accept supersedes the reject, so the check leaves
- 待修复 and the feedback drops out of the next round's input. */}
- {reviewable && (
- <Flexbox horizontal>
+ {activeReview &&
+ (activeReview.action === 'accept' ? (
+ <Flexbox horizontal align={'center'} gap={8}>
+ <AcceptedNote review={activeReview} />
+ {reviewable && (
<Button
- disabled={reviewPending && !accepting}
- loading={accepting}
+ disabled={reviewPending}
size={'small'}
type={'text'}
- onClick={handleAccept}
+ onClick={(event) => {
+ event.stopPropagation();
+ openReject();
+ }}
>
- {t('acceptance.review.revertToAccept')}
+ {t('acceptance.review.revertToReject')}
</Button>
- </Flexbox>
- )}
- </Flexbox>
- ))}
+ )}
+ </Flexbox>
+ ) : (
+ <Flexbox gap={6}>
+ <FeedbackCard evidenceById={evidenceById} review={activeReview} />
+ {/* The mirror of the accept escape: take the send-back back.
+ A fresh accept supersedes the reject, so the check leaves
+ 待修复 and the feedback drops out of the next round's input. */}
+ {reviewable && (
+ <Flexbox horizontal>
+ <Button
+ disabled={reviewPending && !accepting}
+ loading={accepting}
+ size={'small'}
+ type={'text'}
+ onClick={handleAccept}
+ >
+ {t('acceptance.review.revertToAccept')}
+ </Button>
+ </Flexbox>
+ )}
+ </Flexbox>
+ ))}
- {/* Confirm (plain filled) anchors the right edge; reject is the
+ {/* Confirm (plain filled) anchors the right edge; reject is the
quiet text escape next to it. */}
- {reviewable && !activeReview && (
- <Flexbox horizontal gap={4} justify={'flex-end'}>
- <Button
- disabled={reviewPending}
- size={'small'}
- type={'text'}
- onClick={(event) => {
- event.stopPropagation();
- openReject();
- }}
- >
- {t('acceptance.review.reject')}
- </Button>
- <Button
- disabled={reviewPending && !accepting}
- icon={<Icon icon={Check} />}
- loading={accepting}
- size={'small'}
- type={'fill'}
- onClick={handleAccept}
- >
- {t('acceptance.review.accept')}
- </Button>
- </Flexbox>
- )}
+ {reviewable && !activeReview && (
+ <Flexbox horizontal gap={4} justify={'flex-end'}>
+ <Button
+ disabled={reviewPending}
+ size={'small'}
+ type={'text'}
+ onClick={(event) => {
+ event.stopPropagation();
+ openReject();
+ }}
+ >
+ {t('acceptance.review.reject')}
+ </Button>
+ <Button
+ disabled={reviewPending && !accepting}
+ icon={<Icon icon={Check} />}
+ loading={accepting}
+ size={'small'}
+ type={'fill'}
+ onClick={handleAccept}
+ >
+ {t('acceptance.review.accept')}
+ </Button>
+ </Flexbox>
+ )}
- {hasHistory && (
- <span className={styles.historyToggle} onClick={() => setHistoryOpen((open) => !open)}>
- <Icon
- icon={ChevronRight}
- size={12}
- style={{
- transform: historyOpen ? 'rotate(90deg)' : 'none',
- transition: 'transform 0.2s',
- }}
+ {hasHistory && (
+ <span
+ className={styles.historyToggle}
+ onClick={() => setHistoryOpen((open) => !open)}
+ >
+ <Icon
+ icon={ChevronRight}
+ size={12}
+ style={{
+ transform: historyOpen ? 'rotate(90deg)' : 'none',
+ transition: 'transform 0.2s',
+ }}
+ />
+ {t('acceptance.checks.iterationHistory', { count: check.revisions })}
+ </span>
+ )}
+ {historyOpen && hasHistory && (
+ <IterationTimeline
+ check={check}
+ evidenceById={evidenceById}
+ historyReviews={historyReviews}
+ onRound={onRound}
/>
- {t('acceptance.checks.iterationHistory', { count: check.revisions })}
- </span>
- )}
- {historyOpen && hasHistory && (
- <IterationTimeline
- check={check}
- evidenceById={evidenceById}
- historyReviews={historyReviews}
- onRound={onRound}
- />
- )}
- </Flexbox>
- )}
- </Flexbox>
- );
-});
+ )}
+ </Flexbox>
+ )}
+ </Flexbox>
+ );
+ },
+);
+
+interface FocusedCheckDetailsProps {
+ canReview: boolean;
+ check: AcceptanceCheck;
+ onReview: (input: CheckReviewInput) => Promise<boolean>;
+ onRound: (round: number) => void;
+ reviewPending: boolean;
+}
+
+/** Full check content for the dedicated second-level acceptance workspace. */
+export const FocusedCheckDetails = memo<FocusedCheckDetailsProps>(
+ ({ canReview, check, onReview, onRound, reviewPending }) => (
+ <CheckRow
+ detailMode
+ expanded
+ canReview={canReview}
+ check={check}
+ reviewPending={reviewPending}
+ onReview={onReview}
+ onRound={onRound}
+ onToggle={() => {}}
+ />
+ ),
+);
+
+FocusedCheckDetails.displayName = 'FocusedCheckDetails';
/**
* The filter maps the reviewer's WORKFLOW, not the verifier's taxonomy — each
@@ -1119,6 +1173,8 @@ interface CheckListProps {
groupFeedback: AcceptanceGroupFeedback[];
/** Record group-scoped feedback; resolves true when the write landed. */
onGroupFeedback: (category: string, comment: string, fileIds: string[]) => Promise<boolean>;
+ /** Open one check in the focused acceptance workspace. */
+ onOpenItem?: (id: string) => void;
/** Record the user's verdict; resolves true when the write landed. */
onReview: (input: CheckReviewInput) => Promise<boolean>;
onRound: (round: number) => void;
@@ -1141,6 +1197,7 @@ const CheckList = memo<CheckListProps>(
filter,
groupFeedback,
onGroupFeedback,
+ onOpenItem,
onReview,
onRound,
onToggleGroup,
@@ -1431,6 +1488,7 @@ const CheckList = memo<CheckListProps>(
expanded={expanded.has(check.id)}
key={check.id}
reviewPending={reviewPending}
+ onOpen={onOpenItem ? () => onOpenItem(check.id) : undefined}
onReview={onReview}
onRound={onRound}
onToggle={() => onToggleItem(check.id)}
diff --git a/src/features/Verify/Acceptance/DecisionBar.test.ts b/src/features/Verify/Acceptance/DecisionBar.test.ts
new file mode 100644
index 00000000000..2eb76912c7d
--- /dev/null
+++ b/src/features/Verify/Acceptance/DecisionBar.test.ts
@@ -0,0 +1,10 @@
+import { describe, expect, it } from 'vitest';
+
+import verify from '../../../../packages/locales/src/default/verify';
+
+describe('DecisionBar copy', () => {
+ it('keeps the copy prompt action and uses Fix for rerunning the repair', () => {
+ expect(verify['acceptance.bar.copyReview']).toBe('Copy review prompt');
+ expect(verify['acceptance.bar.rerun']).toBe('Fix');
+ });
+});
diff --git a/src/features/Verify/Acceptance/TopicPanel.test.ts b/src/features/Verify/Acceptance/TopicPanel.test.ts
new file mode 100644
index 00000000000..e5c3f8402ea
--- /dev/null
+++ b/src/features/Verify/Acceptance/TopicPanel.test.ts
@@ -0,0 +1,76 @@
+/**
+ * @vitest-environment happy-dom
+ */
+import { fireEvent, render } from '@testing-library/react';
+import { createElement, type ReactNode } from 'react';
+import { describe, expect, it, vi } from 'vitest';
+
+import TopicPanel from './TopicPanel';
+
+vi.mock('@lobehub/ui', () => ({
+ ActionIcon: ({ onClick, title }: { onClick?: () => void; title?: string }) =>
+ createElement('button', { onClick, title }, title),
+ Flexbox: ({ children }: { children?: ReactNode }) => createElement('div', null, children),
+ Icon: () => null,
+ Text: ({ children }: { children?: ReactNode }) => createElement('span', null, children),
+}));
+
+vi.mock('@/features/AgentTasks/AgentTaskDetail/TopicChatDrawer', () => ({
+ TopicChatDrawerBody: ({
+ agentId,
+ defaultInputExpanded,
+ disableInputCollapse,
+ topicId,
+ }: {
+ agentId: string;
+ defaultInputExpanded?: boolean;
+ disableInputCollapse?: boolean;
+ topicId: string;
+ }) =>
+ createElement(
+ 'div',
+ {
+ 'data-default-input-expanded': String(defaultInputExpanded),
+ 'data-disable-input-collapse': String(disableInputCollapse),
+ 'data-testid': 'topic-conversation',
+ },
+ `${agentId}:${topicId}`,
+ ),
+}));
+
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+
+describe('TopicPanel', () => {
+ it('renders the topic conversation in the right rail and returns to runs', () => {
+ const onBack = vi.fn();
+ const onCollapse = vi.fn();
+ const { getByTestId, getByText, getByTitle } = render(
+ createElement(TopicPanel, {
+ agentId: 'agent-1',
+ onBack,
+ onCollapse,
+ title: 'Origin topic',
+ topicId: 'topic-1',
+ }),
+ );
+
+ expect(getByText('Origin topic')).toBeTruthy();
+ expect(getByTestId('topic-conversation')).toHaveAttribute(
+ 'data-default-input-expanded',
+ 'true',
+ );
+ expect(getByTestId('topic-conversation')).toHaveAttribute(
+ 'data-disable-input-collapse',
+ 'true',
+ );
+ expect(getByTestId('topic-conversation').textContent).toBe('agent-1:topic-1');
+
+ fireEvent.click(getByTitle('acceptance.origin.backToRuns'));
+ expect(onBack).toHaveBeenCalledOnce();
+
+ fireEvent.click(getByTitle('acceptance.ledger.collapse'));
+ expect(onCollapse).toHaveBeenCalledOnce();
+ });
+});
diff --git a/src/features/Verify/Acceptance/TopicPanel.tsx b/src/features/Verify/Acceptance/TopicPanel.tsx
new file mode 100644
index 00000000000..e4eeb466952
--- /dev/null
+++ b/src/features/Verify/Acceptance/TopicPanel.tsx
@@ -0,0 +1,68 @@
+'use client';
+
+import { ActionIcon, Flexbox, Icon, Text } from '@lobehub/ui';
+import { cssVar } from 'antd-style';
+import { ArrowLeft, MessagesSquare, PanelRightClose } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { TopicChatDrawerBody } from '@/features/AgentTasks/AgentTaskDetail/TopicChatDrawer';
+
+interface TopicPanelProps {
+ agentId: string;
+ onBack: () => void;
+ onCollapse: () => void;
+ title: string;
+ topicId: string;
+}
+
+/**
+ * The origin conversation rendered in the acceptance workspace's existing
+ * right rail. It deliberately reuses the drawer's conversation body without
+ * mounting the floating drawer chrome.
+ */
+const TopicPanel = memo<TopicPanelProps>(({ agentId, onBack, onCollapse, title, topicId }) => {
+ const { t } = useTranslation('verify');
+
+ return (
+ <Flexbox height={'100%'} style={{ minHeight: 0, overflow: 'hidden' }}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={8}
+ paddingBlock={12}
+ paddingInline={12}
+ style={{ borderBlockEnd: `1px solid ${cssVar.colorBorderSecondary}`, flexShrink: 0 }}
+ >
+ <ActionIcon
+ icon={ArrowLeft}
+ size={'small'}
+ title={t('acceptance.origin.backToRuns')}
+ onClick={onBack}
+ />
+ <Icon color={cssVar.colorTextSecondary} icon={MessagesSquare} size={16} />
+ <Text ellipsis strong style={{ flex: 1, minWidth: 0, fontSize: 13 }}>
+ {title}
+ </Text>
+ <ActionIcon
+ icon={PanelRightClose}
+ size={'small'}
+ title={t('acceptance.ledger.collapse')}
+ onClick={onCollapse}
+ />
+ </Flexbox>
+ <Flexbox flex={1} style={{ minHeight: 0, overflow: 'hidden' }}>
+ <TopicChatDrawerBody
+ defaultInputExpanded
+ disableInputCollapse
+ agentId={agentId}
+ topicId={topicId}
+ />
+ </Flexbox>
+ </Flexbox>
+ );
+});
+
+TopicPanel.displayName = 'TopicPanel';
+
+export default TopicPanel;
diff --git a/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsx b/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsx
index 12aec1031e0..b1e4aff5040 100644
--- a/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsx
+++ b/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsx
@@ -19,6 +19,7 @@ import { createStaticStyles, cssVar } from 'antd-style';
import dayjs from 'dayjs';
import isEqual from 'fast-deep-equal';
import {
+ ArrowLeft,
BadgeCheck,
Check,
CircleCheck,
@@ -513,7 +514,8 @@ AcceptanceRow.displayName = 'AcceptanceRow';
* same persisted panel-width preference so the two surfaces read as one family.
*/
const AcceptanceListPanel = memo<ReportPanelExpand>(({ expand, isNarrow, setExpand }) => {
- const { t } = useTranslation('verify');
+ const { t } = useTranslation(['verify', 'common']);
+ const navigate = useNavigate();
const { acceptanceId } = useParams<{ acceptanceId: string }>();
const { data, error, isLoading, mutate } = useAcceptanceList(true);
@@ -570,9 +572,17 @@ const AcceptanceListPanel = memo<ReportPanelExpand>(({ expand, isNarrow, setExpa
<DraggablePanelContainer style={{ flex: 'none', height: '100%', minWidth: PANEL_MIN }}>
<div className={styles.head}>
<div className={styles.titleRow}>
- <Text strong style={{ fontSize: 15 }}>
- {t('acceptance.workspace.title')}
- </Text>
+ <Flexbox horizontal align={'center'} gap={4}>
+ <ActionIcon
+ icon={ArrowLeft}
+ size={'small'}
+ title={t('back', { ns: 'common' })}
+ onClick={() => navigate(-1)}
+ />
+ <Text strong style={{ fontSize: 15 }}>
+ {t('acceptance.workspace.title')}
+ </Text>
+ </Flexbox>
<button
aria-label={t('workspace.collapse')}
className={styles.collapseBtn}
diff --git a/src/features/Verify/Acceptance/index.tsx b/src/features/Verify/Acceptance/index.tsx
index 68d1fc51c1e..a99f24766db 100644
--- a/src/features/Verify/Acceptance/index.tsx
+++ b/src/features/Verify/Acceptance/index.tsx
@@ -18,6 +18,7 @@ import { Button, Segmented, Select, toast } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar, cx, useResponsive } from 'antd-style';
import dayjs from 'dayjs';
import {
+ ArrowLeft,
BadgeCheck,
ChevronsDownUp,
ChevronsUpDown,
@@ -32,7 +33,6 @@ import {
PencilLine,
RefreshCw,
RotateCcw,
- SquareArrowOutUpRight,
} from 'lucide-react';
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -47,6 +47,7 @@ import { useLocalStorageState } from '@/hooks/useLocalStorageState';
import { mutate as globalMutate } from '@/libs/swr';
import { verifyKeys } from '@/libs/swr/keys';
import { verifyService } from '@/services/verify';
+import { useTaskStore } from '@/store/task';
import { useAcceptanceBundle } from '../hooks';
import ReportViewer from '../ReportViewer';
@@ -55,6 +56,7 @@ import CheckList, {
type CheckFilter,
checkFilterState,
type CheckReviewInput,
+ FocusedCheckDetails,
groupChecks,
hasVisualEvidence,
isException,
@@ -66,6 +68,7 @@ import { EMPTY_ID_SET, setAggregateEntry } from './expandState';
import FeedbackDrawer, { type FeedbackListEntry } from './FeedbackDrawer';
import LedgerPanel, { type AcceptanceRound } from './LedgerPanel';
import { openAcceptModal, openRejectModal } from './modals';
+import TopicPanel from './TopicPanel';
/**
* The hardcoded repair prompt (复制 review 建议 / 打回重跑 share it): points the
@@ -196,6 +199,48 @@ const styles = createStaticStyles(({ css }) => ({
font-size: 12px;
font-weight: 500;
`,
+ focusLayout: css`
+ display: grid;
+ grid-template-columns: 264px minmax(0, 1fr);
+ gap: 20px;
+ align-items: start;
+
+ @media (width <= 900px) {
+ grid-template-columns: 1fr;
+ }
+ `,
+ focusOutline: css`
+ position: sticky;
+ inset-block-start: 0;
+
+ overflow: hidden;
+
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadiusLG};
+
+ background: ${cssVar.colorBgContainer};
+
+ @media (width <= 900px) {
+ position: static;
+ }
+ `,
+ focusOutlineItem: css`
+ cursor: pointer;
+
+ padding-block: 10px;
+ padding-inline: 12px;
+ border-block-start: 1px solid ${cssVar.colorBorderSecondary};
+
+ transition: background ${cssVar.motionDurationMid};
+
+ &:hover {
+ background: ${cssVar.colorFillQuaternary};
+ }
+
+ &[data-active='true'] {
+ background: ${cssVar.colorFillSecondary};
+ }
+ `,
}));
/** Aggregate states in which the round chain is still executing. */
@@ -226,6 +271,8 @@ const AcceptancePage = memo<AcceptancePageProps>(
const isEmbedded = Boolean(explicitAcceptanceId);
const { t } = useTranslation('verify');
const { data, error, isLoading, mutate } = useAcceptanceBundle(acceptanceId ?? null);
+ const openTopicDrawer = useTaskStore((s) => s.openTopicDrawer);
+ const closeTopicDrawer = useTaskStore((s) => s.closeTopicDrawer);
// Below `lg` the report body and a 300px+ in-flow ledger cannot share the
// viewport — the ledger switches to a float overlay, closed by default (the
// same narrow regime the list panel uses).
@@ -235,10 +282,21 @@ const AcceptancePage = memo<AcceptancePageProps>(
// get the one-line compact toolbar.
const compactToolbar = isEmbedded || isNarrowViewport;
+ // The standalone acceptance page owns the conversation panel it opens.
+ // Clear its global drawer state when leaving so it cannot reappear on a
+ // later task/home surface that also mounts TopicChatDrawer.
+ useEffect(
+ () => () => {
+ if (!isEmbedded) closeTopicDrawer();
+ },
+ [closeTopicDrawer, isEmbedded],
+ );
+
// 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 focusedCheckId = isEmbedded ? null : searchParams.get('check');
const [localFilter, setLocalFilter] = useState<CheckFilter>('all');
const urlFilterRaw = searchParams.get('filter');
const urlFilter: CheckFilter = (['all', 'pending', 'needsFix', 'accepted'] as const).includes(
@@ -293,11 +351,32 @@ const AcceptancePage = memo<AcceptancePageProps>(
const seededIdsRef = useRef<Set<string>>(new Set());
const [highlightRound, setHighlightRound] = useState<number | null>(null);
const [ledgerExpand, setLedgerExpand] = useState(!isEmbedded);
+ const [topicPanelOpen, setTopicPanelOpen] = useState(false);
// Entering the narrow regime closes the ledger (it would cover the report);
// reopening is an explicit act via the corner toggle, as a float overlay.
useEffect(() => {
if (isNarrowViewport) setLedgerExpand(false);
}, [isNarrowViewport]);
+ // A focused check is the review workspace: evidence gets the horizontal
+ // room, while the round ledger remains available from the corner toggle.
+ useEffect(() => {
+ if (focusedCheckId) setLedgerExpand(false);
+ }, [focusedCheckId]);
+
+ const closeTopicPanel = useCallback(() => {
+ setTopicPanelOpen(false);
+ closeTopicDrawer();
+ }, [closeTopicDrawer]);
+
+ const openTopicPanel = useCallback(() => {
+ if (!data?.origin?.topic) return;
+ openTopicDrawer(data.origin.topic.id, {
+ agentId: data.origin.agent?.id,
+ title: data.origin.topic.title ?? data.subject.title ?? data.origin.topic.id,
+ });
+ setTopicPanelOpen(true);
+ setLedgerExpand(true);
+ }, [data, openTopicDrawer]);
const [reportRound, setReportRound] = useState<AcceptanceRound | null>(null);
// `?r=<roundIndex>` deep-links one round's full report — a durable
// per-round snapshot URL (standalone page only; the portal embed rides the
@@ -417,6 +496,21 @@ const AcceptancePage = memo<AcceptancePageProps>(
);
const { acceptance, checks, isOwner, latestReport, origin, rounds, subject } = data;
+ const focusedCheck = focusedCheckId
+ ? checks.find((check) => check.id === focusedCheckId)
+ : undefined;
+ const setFocusedCheck = (id?: string) => {
+ if (isEmbedded) return;
+ setSearchParams(
+ (prev) => {
+ const params = new URLSearchParams(prev);
+ if (id) params.set('check', id);
+ else params.delete('check');
+ return params;
+ },
+ { replace: true },
+ );
+ };
const currentRound = rounds.at(-1);
// Group-scoped feedback lives on each round's decision detail — flatten the
// chain into the derived per-entry view (roundIndex from the carrying run).
@@ -789,7 +883,7 @@ const AcceptancePage = memo<AcceptancePageProps>(
return (
<Flexbox horizontal className={styles.page}>
{/* The reopen affordance lives at the page corner — no edge handle tab. */}
- {!ledgerExpand && (
+ {!ledgerExpand && !focusedCheck && (
<ActionIcon
className={styles.ledgerToggle}
icon={PanelRightOpen}
@@ -802,374 +896,510 @@ const AcceptancePage = memo<AcceptancePageProps>(
<Flexbox
gap={16}
paddingBlock={20}
- paddingInline={24}
- style={{ margin: '0 auto', maxWidth: 920, width: '100%' }}
+ paddingInline={focusedCheck ? undefined : 24}
+ style={{
+ margin: focusedCheck ? 0 : '0 auto',
+ maxWidth: focusedCheck ? 'none' : 920,
+ paddingInlineStart: focusedCheck ? 24 : undefined,
+ width: '100%',
+ }}
>
- {/* Header — state first (the lifecycle isn't closed until the user
+ {!focusedCheck && (
+ <>
+ {/* Header — state first (the lifecycle isn't closed until the user
closes it), then identity, then the origin conversation. */}
- <Flexbox gap={10}>
- <Flexbox horizontal align={'center'} gap={10} wrap={'wrap'}>
- <span
- className={styles.verdictPill}
- style={{ background: verdictMeta.bg, color: verdictMeta.color }}
- >
- <Icon icon={verdictMeta.icon} size={13} spin={verdictMeta.spin} />
- {verdictMeta.label}
- </span>
- <Text fontSize={12} type={'secondary'}>
- {[
- countsText,
- t('acceptance.roundCount', { count: rounds.length }),
- currentRound
- ? t('acceptance.verdict.latestAt', {
- time: dayjs(currentRound.run.createdAt).format('MM-DD HH:mm'),
- })
- : null,
- ]
- .filter(Boolean)
- .join(' · ')}
- </Text>
- </Flexbox>
-
- <Flexbox horizontal align={'center'} gap={10}>
- <Text as={'h1'} style={{ fontSize: 18, margin: 0 }}>
- {subject.title ?? subject.id}
- </Text>
- <Tag size={'small'}>{t(`acceptance.subject.${subject.type}`)}</Tag>
- </Flexbox>
-
- {/* Origin — the conversation this acceptance belongs to (agent +
+ <Flexbox gap={10}>
+ <Flexbox horizontal align={'center'} gap={10} wrap={'wrap'}>
+ <span
+ className={styles.verdictPill}
+ style={{ background: verdictMeta.bg, color: verdictMeta.color }}
+ >
+ <Icon icon={verdictMeta.icon} size={13} spin={verdictMeta.spin} />
+ {verdictMeta.label}
+ </span>
+ <Text fontSize={12} type={'secondary'}>
+ {[
+ countsText,
+ t('acceptance.roundCount', { count: rounds.length }),
+ currentRound
+ ? t('acceptance.verdict.latestAt', {
+ time: dayjs(currentRound.run.createdAt).format('MM-DD HH:mm'),
+ })
+ : null,
+ ]
+ .filter(Boolean)
+ .join(' · ')}
+ </Text>
+ </Flexbox>
+
+ <Flexbox horizontal align={'center'} gap={10}>
+ <Text as={'h1'} style={{ fontSize: 18, margin: 0 }}>
+ {subject.title ?? subject.id}
+ </Text>
+ <Tag size={'small'}>{t(`acceptance.subject.${subject.type}`)}</Tag>
+ </Flexbox>
+
+ {/* Origin — the conversation this acceptance belongs to (agent +
topic). Owner-only: the server redacts it for shared links.
Hidden in the portal embed: that surface already lives inside
the origin conversation. */}
- {!isEmbedded && (origin?.agent || origin?.topic) && (
- <Flexbox horizontal align={'center'} gap={16} wrap={'wrap'}>
- {origin.agent && (
- <AgentProfilePopup
- agentId={origin.agent.id}
- trigger={'hover'}
- agent={{
- avatar: origin.agent.avatar ?? undefined,
- backgroundColor: origin.agent.backgroundColor ?? undefined,
- title: origin.agent.title ?? undefined,
- }}
- >
- <Flexbox
- horizontal
- align={'center'}
- className={styles.scopeChip}
- gap={6}
- style={{ cursor: 'default', fontSize: 14 }}
- >
- <Avatar
- avatar={origin.agent.avatar ?? undefined}
- background={origin.agent.backgroundColor ?? undefined}
- size={18}
- />
- {origin.agent.title ?? t('acceptance.origin.agentFallback')}
- </Flexbox>
- </AgentProfilePopup>
- )}
- {origin.topic && (
- <Flexbox
- horizontal
- align={'center'}
- className={cx(styles.scopeChip, styles.scopeLink)}
- gap={4}
- style={{ fontSize: 14 }}
- title={t('acceptance.origin.openTopic')}
- onClick={() =>
- window.open(
- // The canonical conversation route needs the agent;
- // without one, the legacy topic deep-link is the way in.
- origin.agent
- ? `/agent/${origin.agent.id}/${origin.topic!.id}`
- : `/chat?topic=${origin.topic!.id}`,
- '_blank',
- )
- }
- >
- <Icon icon={MessagesSquare} size={13} />
- {origin.topic.title ?? subject.title ?? origin.topic.id}
- <Icon icon={SquareArrowOutUpRight} size={12} />
+ {!isEmbedded && (origin?.agent || origin?.topic) && (
+ <Flexbox horizontal align={'center'} gap={16} wrap={'wrap'}>
+ {origin.agent && (
+ <AgentProfilePopup
+ agentId={origin.agent.id}
+ trigger={'hover'}
+ agent={{
+ avatar: origin.agent.avatar ?? undefined,
+ backgroundColor: origin.agent.backgroundColor ?? undefined,
+ title: origin.agent.title ?? undefined,
+ }}
+ >
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.scopeChip}
+ gap={6}
+ style={{ cursor: 'default', fontSize: 14 }}
+ >
+ <Avatar
+ avatar={origin.agent.avatar ?? undefined}
+ background={origin.agent.backgroundColor ?? undefined}
+ size={18}
+ />
+ {origin.agent.title ?? t('acceptance.origin.agentFallback')}
+ </Flexbox>
+ </AgentProfilePopup>
+ )}
+ {origin.topic && (
+ <Button
+ className={cx(styles.scopeChip, styles.scopeLink)}
+ icon={MessagesSquare}
+ size={'small'}
+ style={{ fontSize: 14 }}
+ title={t('acceptance.origin.openTopic')}
+ type={'text'}
+ onClick={openTopicPanel}
+ >
+ {origin.topic.title ?? subject.title ?? origin.topic.id}
+ </Button>
+ )}
</Flexbox>
)}
</Flexbox>
- )}
- </Flexbox>
- {actionError && <Text type={'danger'}>{actionError}</Text>}
+ {actionError && <Text type={'danger'}>{actionError}</Text>}
- {/* The acceptance goal — THE thing this delivery is judged against,
+ {/* The acceptance goal — THE thing this delivery is judged against,
one prominent card. The latest report summary (and the chips
describing what that round verified) is supporting context inside
it, never the headline. */}
- <Flexbox
- className={styles.card}
- gap={goalCollapsed ? 0 : 12}
- paddingBlock={goalCollapsed ? 8 : 12}
- paddingInline={goalCollapsed ? 12 : 16}
- >
- <Flexbox horizontal align={'center'} gap={4}>
- <Text className={styles.requirementLabel}>{t('acceptance.requirementLabel')}</Text>
- {isOwner && !goalCollapsed && (
- <ActionIcon
- icon={PencilLine}
- size={'small'}
- title={t('acceptance.goalEdit')}
- onClick={handleEditGoal}
- />
- )}
- {goalCollapsed && (
- <Text
- ellipsis
- fontSize={13}
- style={{ flex: 1, minWidth: 0 }}
- title={
- acceptance.requirement ??
- t(
- isOwner
- ? 'acceptance.requirementEmptyEditable'
- : 'acceptance.requirementEmpty',
- )
- }
- >
- {acceptance.requirement ??
- t(
- isOwner
- ? 'acceptance.requirementEmptyEditable'
- : 'acceptance.requirementEmpty',
- )}
- </Text>
- )}
- {!goalCollapsed && <Flexbox flex={1} />}
- <ActionIcon
- data-goal-toggle
- className={styles.goalToggle}
- icon={goalCollapsed ? ChevronsUpDown : ChevronsDownUp}
- size={'small'}
- title={t(goalCollapsed ? 'acceptance.goalExpand' : 'acceptance.goalCollapse')}
- onClick={() => setGoalCollapsed((collapsed) => !collapsed)}
- />
- </Flexbox>
- {!goalCollapsed &&
- (acceptance.requirement ? (
- <Text style={{ fontSize: 15, lineHeight: 1.7 }}>{acceptance.requirement}</Text>
- ) : isOwner ? (
- // The empty state is itself the entry: the whole line invites
- // the owner to record the goal, not just the pencil above.
- <Text
- className={styles.scopeLink}
- style={{ fontSize: 15, lineHeight: 1.7 }}
- onClick={handleEditGoal}
- >
- {t('acceptance.requirementEmptyEditable')}
- </Text>
- ) : (
- <Text style={{ fontSize: 15, lineHeight: 1.7 }}>
- {t('acceptance.requirementEmpty')}
- </Text>
- ))}
- {!goalCollapsed && (latestReport?.summary || scope) && (
<Flexbox
- gap={8}
- paddingBlock={'12px 0'}
- style={{ borderBlockStart: `1px solid ${cssVar.colorBorderSecondary}` }}
+ className={styles.card}
+ gap={goalCollapsed ? 0 : 12}
+ paddingBlock={goalCollapsed ? 8 : 12}
+ paddingInline={goalCollapsed ? 12 : 16}
>
- {/* label → the summary itself → provenance chips, all flush
- left; the drawer entry is a quiet text link, not a button. */}
- <Flexbox horizontal align={'center'} gap={8}>
- <Text fontSize={12} type={'secondary'}>
- {t('acceptance.latestSummary')}
- {currentRound
- ? ` · ${t('acceptance.round', { round: currentRound.run.roundIndex })}`
- : ''}
+ <Flexbox horizontal align={'center'} gap={4}>
+ <Text className={styles.requirementLabel}>
+ {t('acceptance.requirementLabel')}
</Text>
- <Flexbox flex={1} />
- {latestReport && (
- <span
- className={styles.viewReportLink}
- onClick={() =>
- openReport([...rounds].reverse().find((r) => r.report) ?? null)
+ {isOwner && !goalCollapsed && (
+ <ActionIcon
+ icon={PencilLine}
+ size={'small'}
+ title={t('acceptance.goalEdit')}
+ onClick={handleEditGoal}
+ />
+ )}
+ {goalCollapsed && (
+ <Text
+ ellipsis
+ fontSize={13}
+ style={{ flex: 1, minWidth: 0 }}
+ title={
+ acceptance.requirement ??
+ t(
+ isOwner
+ ? 'acceptance.requirementEmptyEditable'
+ : 'acceptance.requirementEmpty',
+ )
}
>
- {t('acceptance.viewFullReport')}
- </span>
+ {acceptance.requirement ??
+ t(
+ isOwner
+ ? 'acceptance.requirementEmptyEditable'
+ : 'acceptance.requirementEmpty',
+ )}
+ </Text>
)}
+ {!goalCollapsed && <Flexbox flex={1} />}
+ <ActionIcon
+ data-goal-toggle
+ className={styles.goalToggle}
+ icon={goalCollapsed ? ChevronsUpDown : ChevronsDownUp}
+ size={'small'}
+ title={t(goalCollapsed ? 'acceptance.goalExpand' : 'acceptance.goalCollapse')}
+ onClick={() => setGoalCollapsed((collapsed) => !collapsed)}
+ />
</Flexbox>
- {latestReport?.summary && (
- <Text className={styles.summaryClamp} fontSize={13} type={'secondary'}>
- {latestReport.summary}
- </Text>
- )}
- {scope && (
- <Flexbox horizontal align={'center'} gap={16} wrap={'wrap'}>
- {scope.branch && (
- <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
- <Icon icon={GitBranch} size={13} /> {scope.branch}
- </Flexbox>
+ {!goalCollapsed &&
+ (acceptance.requirement ? (
+ <Text style={{ fontSize: 15, lineHeight: 1.7 }}>
+ {acceptance.requirement}
+ </Text>
+ ) : isOwner ? (
+ // The empty state is itself the entry: the whole line invites
+ // the owner to record the goal, not just the pencil above.
+ <Text
+ className={styles.scopeLink}
+ style={{ fontSize: 15, lineHeight: 1.7 }}
+ onClick={handleEditGoal}
+ >
+ {t('acceptance.requirementEmptyEditable')}
+ </Text>
+ ) : (
+ <Text style={{ fontSize: 15, lineHeight: 1.7 }}>
+ {t('acceptance.requirementEmpty')}
+ </Text>
+ ))}
+ {!goalCollapsed && (latestReport?.summary || scope) && (
+ <Flexbox
+ gap={8}
+ paddingBlock={'12px 0'}
+ style={{ borderBlockStart: `1px solid ${cssVar.colorBorderSecondary}` }}
+ >
+ {/* label → the summary itself → provenance chips, all flush
+ left; the drawer entry is a quiet text link, not a button. */}
+ <Flexbox horizontal align={'center'} gap={8}>
+ <Text fontSize={12} type={'secondary'}>
+ {t('acceptance.latestSummary')}
+ {currentRound
+ ? ` · ${t('acceptance.round', { round: currentRound.run.roundIndex })}`
+ : ''}
+ </Text>
+ <Flexbox flex={1} />
+ {latestReport && (
+ <span
+ className={styles.viewReportLink}
+ onClick={() =>
+ openReport([...rounds].reverse().find((r) => r.report) ?? null)
+ }
+ >
+ {t('acceptance.viewFullReport')}
+ </span>
+ )}
+ </Flexbox>
+ {latestReport?.summary && (
+ <Text className={styles.summaryClamp} fontSize={13} type={'secondary'}>
+ {latestReport.summary}
+ </Text>
)}
- {scope.commit && (
- <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
- <Icon icon={GitCommitHorizontal} size={13} /> {scope.commit.slice(0, 10)}
+ {scope && (
+ <Flexbox horizontal align={'center'} gap={16} wrap={'wrap'}>
+ {scope.branch && (
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.scopeChip}
+ gap={4}
+ >
+ <Icon icon={GitBranch} size={13} /> {scope.branch}
+ </Flexbox>
+ )}
+ {scope.commit && (
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.scopeChip}
+ gap={4}
+ >
+ <Icon icon={GitCommitHorizontal} size={13} />{' '}
+ {scope.commit.slice(0, 10)}
+ </Flexbox>
+ )}
+ {scope.pullRequest?.number &&
+ (scope.pullRequest.url ? (
+ <a
+ className={cx(styles.scopeChip, styles.scopeLink)}
+ href={scope.pullRequest.url}
+ rel={'noreferrer'}
+ target={'_blank'}
+ title={scope.pullRequest.title ?? scope.pullRequest.url}
+ >
+ <Flexbox horizontal align={'center'} gap={4}>
+ <Icon icon={GitPullRequest} size={13} /> #
+ {scope.pullRequest.number}
+ </Flexbox>
+ </a>
+ ) : (
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.scopeChip}
+ gap={4}
+ >
+ <Icon icon={GitPullRequest} size={13} /> #{scope.pullRequest.number}
+ </Flexbox>
+ ))}
</Flexbox>
)}
- {scope.pullRequest?.number &&
- (scope.pullRequest.url ? (
- <a
- className={cx(styles.scopeChip, styles.scopeLink)}
- href={scope.pullRequest.url}
- rel={'noreferrer'}
- target={'_blank'}
- title={scope.pullRequest.title ?? scope.pullRequest.url}
- >
- <Flexbox horizontal align={'center'} gap={4}>
- <Icon icon={GitPullRequest} size={13} /> #{scope.pullRequest.number}
- </Flexbox>
- </a>
- ) : (
- <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
- <Icon icon={GitPullRequest} size={13} /> #{scope.pullRequest.number}
- </Flexbox>
- ))}
</Flexbox>
)}
</Flexbox>
- )}
- </Flexbox>
+ </>
+ )}
- {/* Check union — the complete inventory, familiar sections (P-14).
+ {focusedCheck ? (
+ <div className={styles.focusLayout}>
+ <Flexbox className={styles.focusOutline}>
+ <Flexbox gap={8} paddingBlock={12} paddingInline={12}>
+ <Button
+ icon={<Icon icon={ArrowLeft} />}
+ size={'small'}
+ type={'text'}
+ onClick={() => setFocusedCheck()}
+ >
+ {t('acceptance.focus.back')}
+ </Button>
+ <Flexbox gap={4} paddingInline={4}>
+ <Text strong style={{ fontSize: 15 }}>
+ {subject.title ?? subject.id}
+ </Text>
+ <Flexbox horizontal align={'center'} gap={6}>
+ <span
+ className={styles.verdictPill}
+ style={{ background: verdictMeta.bg, color: verdictMeta.color }}
+ >
+ <Icon icon={verdictMeta.icon} size={12} spin={verdictMeta.spin} />
+ {verdictMeta.label}
+ </span>
+ <Text fontSize={11} type={'secondary'}>
+ {t('acceptance.roundCount', { count: rounds.length })}
+ </Text>
+ </Flexbox>
+ </Flexbox>
+ <Flexbox horizontal align={'center'} gap={8}>
+ <Text strong style={{ fontSize: 13 }}>
+ {t('acceptance.checks.title')}
+ </Text>
+ <span className={styles.countBadge}>{checks.length}</span>
+ </Flexbox>
+ </Flexbox>
+ {checks.map((check) => {
+ const state = checkFilterState(check);
+ const icon =
+ state === 'accepted'
+ ? BadgeCheck
+ : state === 'needsFix'
+ ? RotateCcw
+ : CircleDashed;
+ const color =
+ state === 'accepted'
+ ? cssVar.colorSuccess
+ : state === 'needsFix'
+ ? cssVar.colorError
+ : cssVar.colorTextQuaternary;
+
+ return (
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.focusOutlineItem}
+ data-active={check.id === focusedCheck.id}
+ gap={8}
+ key={check.id}
+ onClick={() => setFocusedCheck(check.id)}
+ >
+ <Text
+ style={{
+ color: cssVar.colorTextTertiary,
+ flex: 'none',
+ fontFamily: cssVar.fontFamilyCode,
+ fontSize: 11,
+ }}
+ >
+ C{check.seq}
+ </Text>
+ <Text ellipsis style={{ flex: 1, fontSize: 13, minWidth: 0 }}>
+ {check.title}
+ </Text>
+ <Icon color={color} icon={icon} size={14} />
+ </Flexbox>
+ );
+ })}
+ </Flexbox>
+
+ <Flexbox gap={12} style={{ minWidth: 0 }}>
+ <Flexbox gap={5}>
+ <Text fontSize={12} type={'secondary'}>
+ C{focusedCheck.seq}
+ </Text>
+ <Text as={'h2'} style={{ fontSize: 22, margin: 0 }}>
+ {focusedCheck.title}
+ </Text>
+ <Text fontSize={13} type={'secondary'}>
+ {t('acceptance.focus.evidenceHint')}
+ </Text>
+ </Flexbox>
+ <FocusedCheckDetails
+ canReview={isOwner}
+ check={focusedCheck}
+ reviewPending={pending}
+ onReview={handleReview}
+ onRound={gotoRound}
+ />
+ </Flexbox>
+ </div>
+ ) : (
+ <>
+ {/* Check union — the complete inventory, familiar sections (P-14).
Narrow surfaces (the chat portal embed, sub-lg viewports) trade
the Segmented for a compact Select so the toolbar stays one
line; wide viewports keep the glanceable Segmented. */}
- <Flexbox horizontal align={'center'} gap={8} wrap={compactToolbar ? 'nowrap' : 'wrap'}>
- <Text strong style={{ fontSize: 14, whiteSpace: 'nowrap' }}>
- {t('acceptance.checks.title')}
- </Text>
- <span className={styles.countBadge}>{counts.total}</span>
- <Flexbox flex={1} />
- {compactToolbar ? (
- <Select
- size={'small'}
- style={{ height: 34, width: 118 }}
- value={filter}
- variant={'filled'}
- options={[
- { label: t('acceptance.filter.all', { count: counts.total }), value: 'all' },
- {
- label: t('acceptance.filter.pending', { count: counts.pending }),
- value: 'pending',
- },
- {
- label: t('acceptance.filter.needsFix', { count: counts.needsFix }),
- value: 'needsFix',
- },
- {
- label: t('acceptance.filter.accepted', { count: counts.accepted }),
- value: 'accepted',
- },
- ]}
- onChange={(value) => setFilter(value as CheckFilter)}
- />
- ) : (
- <Segmented
- size={'small'}
- value={filter}
- options={[
- { label: t('acceptance.filter.all', { count: counts.total }), value: 'all' },
- {
- label: t('acceptance.filter.pending', { count: counts.pending }),
- value: 'pending',
- },
- {
- label: t('acceptance.filter.needsFix', { count: counts.needsFix }),
- value: 'needsFix',
- },
- {
- label: t('acceptance.filter.accepted', { count: counts.accepted }),
- value: 'accepted',
- },
- ]}
- onChange={(value) => setFilter(value as CheckFilter)}
- />
- )}
- {/* Which round touched a check — audit slicing, orthogonal to the
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={8}
+ wrap={compactToolbar ? 'nowrap' : 'wrap'}
+ >
+ <Text strong style={{ fontSize: 14, whiteSpace: 'nowrap' }}>
+ {t('acceptance.checks.title')}
+ </Text>
+ <span className={styles.countBadge}>{counts.total}</span>
+ <Flexbox flex={1} />
+ {compactToolbar ? (
+ <Select
+ size={'small'}
+ style={{ height: 34, width: 118 }}
+ value={filter}
+ variant={'filled'}
+ options={[
+ {
+ label: t('acceptance.filter.all', { count: counts.total }),
+ value: 'all',
+ },
+ {
+ label: t('acceptance.filter.pending', { count: counts.pending }),
+ value: 'pending',
+ },
+ {
+ label: t('acceptance.filter.needsFix', { count: counts.needsFix }),
+ value: 'needsFix',
+ },
+ {
+ label: t('acceptance.filter.accepted', { count: counts.accepted }),
+ value: 'accepted',
+ },
+ ]}
+ onChange={(value) => setFilter(value as CheckFilter)}
+ />
+ ) : (
+ <Segmented
+ size={'small'}
+ value={filter}
+ options={[
+ {
+ label: t('acceptance.filter.all', { count: counts.total }),
+ value: 'all',
+ },
+ {
+ label: t('acceptance.filter.pending', { count: counts.pending }),
+ value: 'pending',
+ },
+ {
+ label: t('acceptance.filter.needsFix', { count: counts.needsFix }),
+ value: 'needsFix',
+ },
+ {
+ label: t('acceptance.filter.accepted', { count: counts.accepted }),
+ value: 'accepted',
+ },
+ ]}
+ onChange={(value) => setFilter(value as CheckFilter)}
+ />
+ )}
+ {/* Which round touched a check — audit slicing, orthogonal to the
review-state segments. */}
- {rounds.length > 1 && (
- <Select
- size={'small'}
- // Filled + the Segmented's exact height so the two read as
- // one control family, not a stray bordered input.
- style={{ height: 34, width: 110 }}
- value={roundFilter === null ? 'all' : String(roundFilter)}
- variant={'filled'}
- options={[
- { label: t('acceptance.filter.roundAll'), value: 'all' },
- ...[...rounds].reverse().map((round) => ({
- label: t('acceptance.round', { round: round.run.roundIndex }),
- value: String(round.run.roundIndex),
- })),
- ]}
- onChange={(value) => setRoundFilter(value === 'all' ? null : Number(value))}
- />
- )}
- <ActionIcon
- icon={allGroupsCollapsed ? ChevronsUpDown : ChevronsDownUp}
- size={'small'}
- title={
- allGroupsCollapsed
- ? t('acceptance.group.expandAll')
- : t('acceptance.group.collapseAll')
- }
- onClick={() =>
- setCollapsedGroups(allGroupsCollapsed ? new Set() : new Set(groupKeys))
- }
- />
- </Flexbox>
+ {rounds.length > 1 && (
+ <Select
+ size={'small'}
+ // Filled + the Segmented's exact height so the two read as
+ // one control family, not a stray bordered input.
+ style={{ height: 34, width: 110 }}
+ value={roundFilter === null ? 'all' : String(roundFilter)}
+ variant={'filled'}
+ options={[
+ { label: t('acceptance.filter.roundAll'), value: 'all' },
+ ...[...rounds].reverse().map((round) => ({
+ label: t('acceptance.round', { round: round.run.roundIndex }),
+ value: String(round.run.roundIndex),
+ })),
+ ]}
+ onChange={(value) => setRoundFilter(value === 'all' ? null : Number(value))}
+ />
+ )}
+ <ActionIcon
+ icon={allGroupsCollapsed ? ChevronsUpDown : ChevronsDownUp}
+ size={'small'}
+ title={
+ allGroupsCollapsed
+ ? t('acceptance.group.expandAll')
+ : t('acceptance.group.collapseAll')
+ }
+ onClick={() =>
+ setCollapsedGroups(allGroupsCollapsed ? new Set() : new Set(groupKeys))
+ }
+ />
+ </Flexbox>
- <CheckList
- canReview={isOwner}
- checks={checks}
- collapsedGroups={collapsedGroups}
- currentRound={currentRound?.run.roundIndex ?? 0}
- expanded={expanded}
- filter={filter}
- groupFeedback={groupFeedbackEntries}
- reviewPending={pending}
- round={roundFilter}
- onGroupFeedback={handleGroupFeedback}
- onReview={handleReview}
- onRound={gotoRound}
- onToggleGroup={(key) =>
- setCollapsedGroups((previous) => {
- const next = new Set(previous);
- if (next.has(key)) next.delete(key);
- else next.add(key);
- return next;
- })
- }
- onToggleGroupItems={(ids, open) =>
- setExpanded((previous) => {
- const next = new Set(previous);
- for (const id of ids) {
- if (open) next.add(id);
- else next.delete(id);
+ <CheckList
+ canReview={isOwner}
+ checks={checks}
+ collapsedGroups={collapsedGroups}
+ currentRound={currentRound?.run.roundIndex ?? 0}
+ expanded={expanded}
+ filter={filter}
+ groupFeedback={groupFeedbackEntries}
+ reviewPending={pending}
+ round={roundFilter}
+ onGroupFeedback={handleGroupFeedback}
+ onOpenItem={isEmbedded ? undefined : setFocusedCheck}
+ onReview={handleReview}
+ onRound={gotoRound}
+ onToggleGroup={(key) =>
+ setCollapsedGroups((previous) => {
+ const next = new Set(previous);
+ if (next.has(key)) next.delete(key);
+ else next.add(key);
+ return next;
+ })
}
- return next;
- })
- }
- onToggleItem={(id) =>
- setExpanded((previous) => {
- const next = new Set(previous);
- if (next.has(id)) next.delete(id);
- else next.add(id);
- return next;
- })
- }
- />
+ onToggleGroupItems={(ids, open) =>
+ setExpanded((previous) => {
+ const next = new Set(previous);
+ for (const id of ids) {
+ if (open) next.add(id);
+ else next.delete(id);
+ }
+ return next;
+ })
+ }
+ onToggleItem={(id) =>
+ setExpanded((previous) => {
+ const next = new Set(previous);
+ if (next.has(id)) next.delete(id);
+ else next.add(id);
+ return next;
+ })
+ }
+ />
+ </>
+ )}
{/* The floating decision strip — owner-only: closing the loop and
queueing feedback are the author's calls, never a visitor's. */}
- {isOwner && (
+ {isOwner && !focusedCheck && (
<DecisionBar
acceptedCount={acceptedCount}
embedded={isEmbedded}
@@ -1201,9 +1431,11 @@ const AcceptancePage = memo<AcceptancePageProps>(
onJumpToCheck={jumpToCheck}
/>
- {/* Round ledger — audit detail, off the decision path (P-13). No edge
+ {/* Runs / origin conversation share one right rail. Opening the origin
+ Topic replaces the run list in-place instead of layering a floating
+ drawer over the workspace. No edge
handle: opening happens from the page-corner toggle, closing from the
- ledger's own header action. On narrow viewports it opens as a masked
+ rail'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. The panel's own
fold icon is the close affordance (same as wide mode), so the Drawer's
@@ -1219,13 +1451,23 @@ const AcceptancePage = memo<AcceptancePageProps>(
width={'min(340px, 88vw)'}
onClose={() => setLedgerExpand(false)}
>
- <LedgerPanel
- highlight={highlightRound}
- reviewByRound={reviewByRound}
- rounds={rounds}
- onCollapse={() => setLedgerExpand(false)}
- onOpenReport={openReport}
- />
+ {topicPanelOpen && origin?.agent?.id && origin.topic ? (
+ <TopicPanel
+ agentId={origin.agent.id}
+ title={origin.topic.title ?? subject.title ?? origin.topic.id}
+ topicId={origin.topic.id}
+ onBack={closeTopicPanel}
+ onCollapse={() => setLedgerExpand(false)}
+ />
+ ) : (
+ <LedgerPanel
+ highlight={highlightRound}
+ reviewByRound={reviewByRound}
+ rounds={rounds}
+ onCollapse={() => setLedgerExpand(false)}
+ onOpenReport={openReport}
+ />
+ )}
</Drawer>
) : (
<DraggablePanel
@@ -1236,14 +1478,26 @@ const AcceptancePage = memo<AcceptancePageProps>(
style={{ flex: 'none', height: '100%' }}
onExpandChange={setLedgerExpand}
>
- <Flexbox style={{ height: '100%', overflow: 'auto' }}>
- <LedgerPanel
- highlight={highlightRound}
- reviewByRound={reviewByRound}
- rounds={rounds}
- onCollapse={() => setLedgerExpand(false)}
- onOpenReport={openReport}
- />
+ <Flexbox style={{ height: '100%', minHeight: 0, overflow: 'hidden' }}>
+ {topicPanelOpen && origin?.agent?.id && origin.topic ? (
+ <TopicPanel
+ agentId={origin.agent.id}
+ title={origin.topic.title ?? subject.title ?? origin.topic.id}
+ topicId={origin.topic.id}
+ onBack={closeTopicPanel}
+ onCollapse={() => setLedgerExpand(false)}
+ />
+ ) : (
+ <Flexbox style={{ height: '100%', overflow: 'auto' }}>
+ <LedgerPanel
+ highlight={highlightRound}
+ reviewByRound={reviewByRound}
+ rounds={rounds}
+ onCollapse={() => setLedgerExpand(false)}
+ onOpenReport={openReport}
+ />
+ </Flexbox>
+ )}
</Flexbox>
</DraggablePanel>
)}
diff --git a/src/store/chat/slices/agentRun/actions/__tests__/gateway.test.ts b/src/store/chat/slices/agentRun/actions/__tests__/gateway.test.ts
index f37c618657f..bef024725ad 100644
--- a/src/store/chat/slices/agentRun/actions/__tests__/gateway.test.ts
+++ b/src/store/chat/slices/agentRun/actions/__tests__/gateway.test.ts
@@ -648,6 +648,61 @@ describe('GatewayActionImpl', () => {
);
});
+ it('should execute as the target agent while routing messages to the parent conversation', async () => {
+ const { action, moveQueuedMessages, startOperation, updateTopicStatus } =
+ createExecuteTestAction();
+ const executionContext = {
+ agentId: 'target-agent',
+ scope: 'sub_agent' as const,
+ subAgentId: 'target-agent',
+ topicId: 'topic-1',
+ };
+ const messageContext = {
+ agentId: 'parent-agent',
+ scope: 'main' as const,
+ topicId: 'topic-1',
+ };
+
+ vi.mocked(aiAgentService.execAgentTask).mockResolvedValue({
+ agentId: 'target-agent',
+ assistantMessageId: 'ast-target',
+ autoStarted: true,
+ createdAt: new Date().toISOString(),
+ message: 'ok',
+ operationId: 'server-op-target',
+ status: 'created',
+ success: true,
+ timestamp: new Date().toISOString(),
+ token: 'test-token',
+ topicId: 'topic-1',
+ userMessageId: 'usr-target',
+ });
+
+ await action.executeGatewayAgent({
+ context: executionContext,
+ message: 'Delegated work',
+ messageContext,
+ });
+
+ expect(aiAgentService.execAgentTask).toHaveBeenCalledWith(
+ expect.objectContaining({
+ agentId: 'target-agent',
+ appContext: expect.objectContaining({ scope: 'sub_agent', topicId: 'topic-1' }),
+ }),
+ expect.anything(),
+ );
+ expect(startOperation).toHaveBeenCalledWith(
+ expect.objectContaining({ context: messageContext }),
+ );
+ expect(moveQueuedMessages).toHaveBeenCalledWith(
+ messageMapKey(messageContext),
+ messageMapKey(messageContext),
+ );
+ expect(updateTopicStatus).toHaveBeenCalledWith(
+ expect.objectContaining({ agentId: 'parent-agent', topicId: 'topic-1' }),
+ );
+ });
+
it('should move queued follow-ups from the new-topic key to the server-created topic key', async () => {
const { action, moveQueuedMessages } = createExecuteTestAction();
const context = { agentId: 'agent-1', topicId: null, threadId: null };
diff --git a/src/store/chat/slices/agentRun/actions/dispatch/nonHeteroSubAgentDispatcher.test.ts b/src/store/chat/slices/agentRun/actions/dispatch/nonHeteroSubAgentDispatcher.test.ts
new file mode 100644
index 00000000000..4f082436517
--- /dev/null
+++ b/src/store/chat/slices/agentRun/actions/dispatch/nonHeteroSubAgentDispatcher.test.ts
@@ -0,0 +1,43 @@
+import { describe, expect, it, vi } from 'vitest';
+
+import { dispatchNonHeteroSubAgent } from './nonHeteroSubAgentDispatcher';
+
+describe('dispatchNonHeteroSubAgent', () => {
+ it('separates target execution from the parent message context in gateway mode', async () => {
+ const executeGatewayAgent = vi.fn().mockResolvedValue(undefined);
+ const conversationContext = {
+ agentId: 'parent-agent',
+ scope: 'main' as const,
+ topicId: 'topic-1',
+ };
+
+ await dispatchNonHeteroSubAgent(
+ {
+ instruction: 'Delegated work',
+ kind: 'callAgent',
+ parentMessageId: 'parent-message',
+ targetAgentId: 'target-agent',
+ },
+ {
+ conversationContext,
+ isGatewayMode: true,
+ },
+ {
+ executeClientAgent: vi.fn(),
+ executeGatewayAgent,
+ } as any,
+ );
+
+ expect(executeGatewayAgent).toHaveBeenCalledWith({
+ context: {
+ ...conversationContext,
+ agentId: 'target-agent',
+ scope: 'sub_agent',
+ subAgentId: 'target-agent',
+ },
+ message: 'Delegated work',
+ messageContext: conversationContext,
+ parentOperationId: undefined,
+ });
+ });
+});
diff --git a/src/store/chat/slices/agentRun/actions/dispatch/nonHeteroSubAgentDispatcher.ts b/src/store/chat/slices/agentRun/actions/dispatch/nonHeteroSubAgentDispatcher.ts
index 303de6d9fc4..20cc443b081 100644
--- a/src/store/chat/slices/agentRun/actions/dispatch/nonHeteroSubAgentDispatcher.ts
+++ b/src/store/chat/slices/agentRun/actions/dispatch/nonHeteroSubAgentDispatcher.ts
@@ -104,10 +104,10 @@ export async function dispatchNonHeteroSubAgent(
}
case 'gateway': {
- // Switch agentId to the target agent so the gateway runs the correct one.
- // The gateway loads conversation history from the topic DB, so we do NOT
- // pass the client-side message array. The instruction becomes a real user
- // message created on the server.
+ // Execute with the target agent, but route persisted/streamed messages to
+ // the parent conversation. This keeps speaker identity and conversation
+ // ownership separate instead of hiding cross-agent replies in another
+ // messageMap bucket.
await store.executeGatewayAgent({
context: {
...ctx.conversationContext,
@@ -116,6 +116,7 @@ export async function dispatchNonHeteroSubAgent(
subAgentId: intent.targetAgentId,
},
message: intent.instruction,
+ messageContext: ctx.conversationContext,
parentOperationId: ctx.parentOperationId,
});
break;
diff --git a/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.ts b/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.ts
index b3e2960b9fa..ec554cf8337 100644
--- a/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.ts
+++ b/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.ts
@@ -370,10 +370,17 @@ export class GatewayActionImpl {
* then starts the agent. This method handles topic switching and WebSocket connection.
*/
executeGatewayAgent = async (params: {
+ /** Agent/runtime context used to execute the server operation. */
context: ConversationContext;
/** File IDs of already-uploaded attachments to attach to the new user message */
fileIds?: string[];
message: string;
+ /**
+ * Conversation context that owns the rendered messages. Defaults to the
+ * execution context. Sub-agent calls keep this on the parent conversation
+ * while executing with the target agent from `context`.
+ */
+ messageContext?: ConversationContext;
/** Request metadata carried from the originating user message. */
metadata?: Pick<MessageMetadata, 'trigger'>;
/** Called when the gateway session completes (agent finished running) */
@@ -431,9 +438,10 @@ export class GatewayActionImpl {
tempMessageIds?: string[];
}): Promise<ExecAgentResult> => {
const {
- context,
+ context: executionContext,
fileIds,
message,
+ messageContext = executionContext,
metadata,
onComplete,
optimisticTopic,
@@ -449,15 +457,20 @@ export class GatewayActionImpl {
const agentGatewayUrl =
window.global_serverConfigStore!.getState().serverConfig.agentGatewayUrl!;
- const isCreateNewTopic = !context.topicId;
- const taskId = context.viewedTask?.type === 'detail' ? context.viewedTask.taskId : undefined;
+ const isCreateNewTopic = !messageContext.topicId;
+ const taskId =
+ executionContext.viewedTask?.type === 'detail'
+ ? executionContext.viewedTask.taskId
+ : undefined;
// If this is a new topic, read any repos the user pre-selected before
// sending the first message. We read without consuming yet — if execAgentTask
// fails or is aborted, the selection is preserved so a retry can still pick
// it up. We clear only after the server confirms the topic was created.
const pendingRepos =
- isCreateNewTopic && context.agentId ? getPendingTopicRepos(context.agentId) : [];
+ isCreateNewTopic && messageContext.agentId
+ ? getPendingTopicRepos(messageContext.agentId)
+ : [];
// Pending repo selection wins; otherwise carry the caller-resolved topic
// metadata (e.g. the hetero cwd `conversationLifecycle` resolved from the
// effective device + per-user legacy slot) so the SERVER topic is born with
@@ -490,7 +503,7 @@ export class GatewayActionImpl {
? this.#get().getOperationAbortSignal(parentOperationId)
: undefined;
- const localDeviceId = await resolveLocalDeviceId(context.agentId);
+ const localDeviceId = await resolveLocalDeviceId(executionContext.agentId);
const userInterventionConfig = {
approvalMode: toolInterventionSelectors.approvalMode(useUserStore.getState()),
allowList: toolInterventionSelectors.allowList(useUserStore.getState()),
@@ -498,29 +511,29 @@ export class GatewayActionImpl {
const result = await aiAgentService.execAgentTask(
{
- agentId: context.agentId,
+ agentId: executionContext.agentId,
appContext: {
- agentDocumentId: context.agentDocumentId,
- defaultTaskAssigneeAgentId: context.defaultTaskAssigneeAgentId,
- documentId: context.documentId,
+ agentDocumentId: executionContext.agentDocumentId,
+ defaultTaskAssigneeAgentId: executionContext.defaultTaskAssigneeAgentId,
+ documentId: executionContext.documentId,
// When AgentBuilder runs, context.agentId is the builtin builder agent.
// The actual editing target is chatStore.activeAgentId (kept in sync by
// AgentBuilderProvider). Pass it so the server can route tool calls to
// the correct agent rather than the builder itself.
- ...(context.scope === 'agent_builder' && {
+ ...(executionContext.scope === 'agent_builder' && {
editingAgentId: this.#get().activeAgentId ?? undefined,
}),
- groupId: context.groupId,
+ groupId: executionContext.groupId,
...(initialTopicMetadata && { initialTopicMetadata }),
// Forward the group orchestration role so the server can stamp it onto
// the assistant message metadata. Without this the gateway-created
// supervisor turn loses its role on the step_start snapshot / refetch
// and renders as a generic assistant.
- orchestrationRole: context.orchestrationRole,
- scope: context.scope,
+ orchestrationRole: executionContext.orchestrationRole,
+ scope: executionContext.scope,
taskId,
- threadId: context.threadId,
- topicId: context.topicId,
+ threadId: executionContext.threadId,
+ topicId: executionContext.topicId,
},
deviceId: localDeviceId,
fileIds,
@@ -548,23 +561,23 @@ export class GatewayActionImpl {
// (same pattern as client mode: replaceMessages before switchTopic to avoid skeleton flash)
if (isCreateNewTopic && result.topicId) {
// Topic created successfully — now safe to clear the pending repo selection.
- if (context.agentId) consumePendingTopicRepos(context.agentId);
+ if (messageContext.agentId) consumePendingTopicRepos(messageContext.agentId);
if (optimisticTopic) {
const topicMetadata = optimisticTopic.metadata ?? initialTopicMetadata;
this.#get().internal_replaceTopicId({
- agentId: context.agentId,
- groupId: context.groupId,
+ agentId: messageContext.agentId,
+ groupId: messageContext.groupId,
nextId: result.topicId,
previousId: optimisticTopic.id,
value: {
...(topicMetadata ? { metadata: topicMetadata } : {}),
- ...(context.groupId ? {} : { sessionId: context.agentId }),
+ ...(messageContext.groupId ? {} : { sessionId: messageContext.agentId }),
title: optimisticTopic.title,
},
});
}
try {
- const newContext = { ...context, topicId: result.topicId };
+ const newContext = { ...messageContext, topicId: result.topicId };
const messages = await messageService.getMessages(newContext);
this.#get().replaceMessages(messages, { context: newContext });
} catch {
@@ -592,14 +605,19 @@ export class GatewayActionImpl {
}
}
- // Use the server-created topicId for the execution context
- const execContext = { ...context, topicId: result.topicId };
- this.#get().moveQueuedMessages(messageMapKey(context), messageMapKey(execContext));
+ // Keep execution identity separate from the conversation bucket that owns
+ // the streamed messages. They differ for callAgent/sub-agent runs.
+ const resolvedExecutionContext = { ...executionContext, topicId: result.topicId };
+ const resolvedMessageContext = { ...messageContext, topicId: result.topicId };
+ this.#get().moveQueuedMessages(
+ messageMapKey(messageContext),
+ messageMapKey(resolvedMessageContext),
+ );
if (result.topicId) {
void this.#get().updateTopicStatus?.({
- agentId: context.agentId,
- groupId: context.groupId,
+ agentId: messageContext.agentId,
+ groupId: messageContext.groupId,
status: 'running',
topicId: result.topicId,
});
@@ -610,7 +628,7 @@ export class GatewayActionImpl {
// (approve/reject/reject_continue) can look it up and call the server
// without needing an out-of-band lookup.
const { operationId: gatewayOpId } = this.#get().startOperation({
- context: execContext,
+ context: resolvedMessageContext,
metadata: { serverOperationId: result.operationId },
parentOperationId,
type: 'execServerAgentRuntime',
@@ -670,7 +688,7 @@ export class GatewayActionImpl {
const eventHandler = createGatewayEventHandler(this.#get, {
assistantMessageId: result.assistantMessageId,
- context: execContext,
+ context: resolvedMessageContext,
// Server-side operation id — needed for tool_result dispatch back over
// the same WS that gatewayConnections is keyed on.
gatewayOperationId: result.operationId,
@@ -679,11 +697,13 @@ export class GatewayActionImpl {
// for the gateway transport (op completion + unread + queue drain +
// notification) at `agent_runtime_end` / `error`.
runLifecycle: buildRunLifecycle(this.#get, {
- context: execContext,
+ context: resolvedMessageContext,
parentMessageId: result.assistantMessageId,
parentMessageType: 'assistant',
runId: gatewayOpId,
- runScope: (execContext.scope === 'sub_agent' ? 'sub_agent' : 'top_level') as RunScope,
+ runScope: (resolvedExecutionContext.scope === 'sub_agent'
+ ? 'sub_agent'
+ : 'top_level') as RunScope,
runtimeType: 'gateway',
}),
});
@@ -695,7 +715,7 @@ export class GatewayActionImpl {
// member's chunks stream into its own council column instead of corrupting
// the supervisor bubble.
const eventRouter = createGatewayEventRouter({
- createMemberHandler: this.buildMemberHandlerFactory(execContext, gatewayOpId),
+ createMemberHandler: this.buildMemberHandlerFactory(resolvedMessageContext, gatewayOpId),
ownerHandler: eventHandler,
ownerOperationId: result.operationId,
});
@@ -716,8 +736,8 @@ export class GatewayActionImpl {
const viewing = this.#get().activeTopicId === result.topicId;
if (viewing || !succeeded) {
void this.#get().updateTopicStatus?.({
- agentId: execContext.agentId,
- groupId: execContext.groupId,
+ agentId: resolvedMessageContext.agentId,
+ groupId: resolvedMessageContext.groupId,
status: 'active',
topicId: result.topicId,
});
@@ -730,8 +750,8 @@ export class GatewayActionImpl {
// Also clear the local store copy — the server clear above does NOT touch
// the Zustand topic map that useGatewayReconnect reads (LOBE-12055).
this.clearLocalRunningOperation({
- agentId: execContext.agentId,
- groupId: execContext.groupId,
+ agentId: resolvedMessageContext.agentId,
+ groupId: resolvedMessageContext.groupId,
operationId: result.operationId,
topicId: result.topicId,
});