🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(verify): enforce evidence-aware verification (#17658)
Arvin Xu80ff05c7cca7
diff --git a/.agents/acceptance/common-mistakes.md b/.agents/acceptance/common-mistakes.mdindex 8c4f409ef22..63ef2fbf33a 100644--- a/.agents/acceptance/common-mistakes.md+++ b/.agents/acceptance/common-mistakes.md@@ -270,3 +270,73 @@ full incident narratives and old Case numbers for earlier cross-references.- Why it fails: an empty conversation renders the welcome surface instead, so alerts and trays can overlap its content.- What it breaks: combined Alert + tray states visually collide with welcome copy even though the overlay items do not overlap each other.- Correct approach: apply the same measured overlay reservation to both message and welcome paths, and capture acceptance evidence with the real combined state visible.++## Acceptance evidence must show the requested product container and scale boundary++**Wrong approach:** Proving a Task run from the standalone topic page, or proving checklist grouping only with a small checklist.++**Why it's wrong:** The same content can render in several containers, while the feature under review is the Task's Topic Run drawer. Checklist hierarchy also deliberately changes at the 10-item boundary, so an eight-item sample cannot prove the grouped state.++**What it breaks:** Reviewers cannot inspect the actual drawer composition, per-check expansion behavior, or the flat-versus-grouped threshold.++**Correct approach:** Capture the run by opening the Topic card from Task detail and keeping the Topic Run drawer visible. For checklist UI, capture both sides of the boundary (10 or fewer stays flat; more than 10 groups), open representative checks in each state, and confirm obsolete edit/group controls are absent where they should be.++## Never verify Acceptance UI against an unfetched canary ref++**Wrong approach:** Rebase against a stale local `canary` pointer, start the app, and treat its rendered Acceptance UI as the latest canary behavior.++**Why it's wrong:** The local branch label can lag the remote by many commits; Acceptance presentation changes may already be merged upstream while the working branch still renders the retired UI.++**What it breaks:** Every screenshot in the round proves the wrong product version, so even otherwise-correct interactions and evidence must be discarded.++**Correct approach:** Run `git fetch origin canary`, record the resolved `origin/canary` SHA, verify it is an ancestor of the test branch after rebase, and only then start the dev server and capture evidence.++## Case: Teardown before asynchronous verification and repair reach a terminal state++**Wrong approach:** Publish a report and stop the dev server or QStash as soon as the main agent operation is done or the first verification snapshot looks stuck.++**Why:** Verification runs fire-and-forget after the main operation. Agent verifiers may take several minutes, and auto-repair starts only after every required result becomes terminal. A repair operation and its next verify round can therefore begin well after the main operation reports `done`.++**What it breaks:** Stopping the environment can strand a live repair round in `running` or `pending`, produce a stale report, and make a working auto-repair trigger look absent.++**Correct approach:** Monitor the verify run, all required result rows, repair-operation links, and the bound task until they reach a stable terminal state. Keep the dev server, QStash, Redis, and object storage alive throughout that interval; teardown only after the final repair/verify round settles or a concrete non-progress failure is proven.++## Case: A verification summary does not replace per-check detail evidence++**Wrong approach:** Publish only a checklist summary or a text transcript saying that all checks passed, while omitting screenshots of each expanded check result.++**Why:** Reviewers need to inspect the actual judgment for every delivery criterion, especially when the plan mixes LLM-only checks with image-aware or Agent multimodal checks.++**What it breaks:** The report proves the aggregate count but not what each verifier saw or why each item passed, so the reviewer must request another evidence round.++**Correct approach:** Capture one readable checklist overview plus one expanded-detail screenshot per underlying delivery check. Name evidence by criterion and verifier type, visually inspect every screenshot before attaching it, and include a text mapping from each stable criterion id to its verifier and verdict.++## Case: Evidence attachments do not replace the requested product artifact++**Wrong approach:** Upload a complete generated document only as Acceptance evidence and assume that satisfies a requirement to deliver the document from the Task.++**Why:** Acceptance evidence explains why a check passed; it is not the Task's durable deliverable surface. Reviewers looking for the output in the Task workspace will not find an evidence-only file.++**What it breaks:** The content may be technically present in the audit record while the actual Task has no pinned document artifact for users to open, reuse, or continue editing.++**Correct approach:** Create the generated content as a real product document, pin it to the owning Task, and attach separate Acceptance evidence proving both the document content and its Task association.++## Case: Screenshot requirements must disclose multimodal verification++**Wrong approach:** Show only a generic `LLM` or `Agent` badge beside a screenshot evidence requirement, with verifier metadata and required media split across separate rows.++**Why:** A screenshot cannot be judged by a text-only model, and separating the labels makes the relationship between verifier capability and evidence medium ambiguous.++**What it breaks:** Reviewers cannot tell whether the visual evidence was actually inspected by a multimodal model, and the metadata block consumes unnecessary vertical space.++**Correct approach:** Keep verifier type, multimodal capability, and required evidence media in one compact row; whenever screenshot evidence is required, explicitly label the verifier as using a multimodal LLM.++## Case: Master-detail pages must assign scrolling to bounded panes++**Wrong approach:** Let a long outline and detail body determine the page height, then rely on a sticky outline or a shared outer `overflow: auto` container.++**Why:** A master-detail workspace is one stable task surface. When intermediate flex children keep their default `min-height: auto`, content expands the frame and silently transfers scroll ownership to the whole document. Direct flex children can also shrink to hide the missing inner scrollbar.++**What it breaks:** The outline header disappears, the selected item and detail context drift together, compact layouts become one long page, and independent navigation/detail reading is impossible.++**Correct approach:** Constrain every ancestor in the height chain with `flex: 1`, `height: 100%`, and `min-height: 0`; keep the frame overflow hidden; give the outline list and detail body separate `overflow-y: auto` regions; prevent list rows from shrinking; and verify via DOM measurements that both document scroll positions remain zero while each pane scrolls independently.diff --git a/apps/server/src/services/toolExecution/serverRuntimes/lobeDeliveryChecker.ts b/apps/server/src/services/toolExecution/serverRuntimes/lobeDeliveryChecker.tsindex 080c5d15344..afc4514b283 100644--- a/apps/server/src/services/toolExecution/serverRuntimes/lobeDeliveryChecker.ts+++ b/apps/server/src/services/toolExecution/serverRuntimes/lobeDeliveryChecker.ts@@ -1,5 +1,5 @@import { LobeDeliveryCheckerIdentifier } from '@lobechat/builtin-tool-lobe-delivery-checker';-import type { BuiltinServerRuntimeOutput } from '@lobechat/types';+import type { BuiltinServerRuntimeOutput, RequiredEvidenceSpec } from '@lobechat/types';import type { LobeChatDatabase } from '@/database/type';import { VerifyPlanGeneratorService } from '@/server/services/verify';@@ -52,6 +52,7 @@ class LobeDeliveryCheckerExecutionRuntime {instruction?: string;onFail?: 'manual' | 'auto_repair';required?: boolean;+ requiredEvidence?: RequiredEvidenceSpec[];title: string;verifierType?: 'program' | 'agent' | 'llm';}[];diff --git a/apps/server/src/services/verify/__tests__/acceptanceLifecycle.test.ts b/apps/server/src/services/verify/__tests__/acceptanceLifecycle.test.tsindex c28669aae52..1384a49e976 100644--- a/apps/server/src/services/verify/__tests__/acceptanceLifecycle.test.ts+++ b/apps/server/src/services/verify/__tests__/acceptanceLifecycle.test.ts@@ -112,6 +112,7 @@ describe('Verify acceptance lifecycle', () => {agentId: 'agent-1',db,maxRepairRounds: 2,+ taskId: 'task-1',topicId: 'topic-1',userId: 'user-1',workspaceId: 'workspace-1',@@ -123,6 +124,7 @@ describe('Verify acceptance lifecycle', () => {});expect(result).toEqual({ repairOperationId: 'repair-operation' });+ expect(mocks.agentExec).toHaveBeenCalledWith(expect.objectContaining({ taskId: 'task-1' }));expect(mocks.acceptanceAttachRun).toHaveBeenCalledWith('repair-run', 'acceptance-1');});});diff --git a/apps/server/src/services/verify/__tests__/agentVerifier.test.ts b/apps/server/src/services/verify/__tests__/agentVerifier.test.tsindex 682e7a80188..a93a6c93909 100644--- a/apps/server/src/services/verify/__tests__/agentVerifier.test.ts+++ b/apps/server/src/services/verify/__tests__/agentVerifier.test.ts@@ -1,31 +1,20 @@import { BUILTIN_AGENT_SLUGS } from '@lobechat/builtin-agents';-import { AgentDocumentsIdentifier } from '@lobechat/builtin-tool-agent-documents';import { VerifyToolIdentifier } from '@lobechat/builtin-tool-verify';import type { VerifyCheckItem } from '@lobechat/types';import { beforeEach, describe, expect, it, vi } from 'vitest';import { createVerifierAgentRunner } from '../agentVerifier';-// AgentModel/ThreadModel expose their methods as arrow-function class fields+// AgentModel exposes its methods as arrow-function class fields// (instance props, not on the prototype), so they can't be spied via the// prototype — mock the modules instead. Hoisted so the factories can close over them.-const {- existsByIdMock,- getBuiltinAgentMock,- getPinnedDocumentsMock,- associateDocumentMock,- threadCreateMock,- execAgentMock,- settleVerifierCheckFromTerminalMock,-} = vi.hoisted(() => ({- execAgentMock: vi.fn(async (_params: any) => ({ operationId: 'verifier-op-1' })),- associateDocumentMock: vi.fn(),- existsByIdMock: vi.fn(),- getBuiltinAgentMock: vi.fn(),- getPinnedDocumentsMock: vi.fn(),- settleVerifierCheckFromTerminalMock: vi.fn(),- threadCreateMock: vi.fn(async () => ({ id: 'thread-1' })),-}));+const { existsByIdMock, getBuiltinAgentMock, execAgentMock, settleVerifierCheckFromTerminalMock } =+ vi.hoisted(() => ({+ execAgentMock: vi.fn(async (_params: any) => ({ operationId: 'verifier-op-1' })),+ existsByIdMock: vi.fn(),+ getBuiltinAgentMock: vi.fn(),+ settleVerifierCheckFromTerminalMock: vi.fn(),+ }));/** The single execAgent param object, asserted to exist. */const execParams = (): any => {@@ -40,17 +29,6 @@ vi.mock('@/database/models/agent', () => ({getBuiltinAgent: getBuiltinAgentMock,})),}));-vi.mock('@/database/models/thread', () => ({- ThreadModel: vi.fn().mockImplementation(() => ({ create: threadCreateMock })),-}));-vi.mock('@/database/models/task', () => ({- TaskModel: vi.fn().mockImplementation(() => ({ getPinnedDocuments: getPinnedDocumentsMock })),-}));-vi.mock('@/server/services/agentDocuments', () => ({- AgentDocumentsService: vi- .fn()- .mockImplementation(() => ({ associateDocument: associateDocumentMock })),-}));// The runner dynamically imports AiAgentService to break a static cycle.vi.mock('@/server/services/aiAgent', () => ({AiAgentService: vi.fn().mockImplementation(() => ({ execAgent: execAgentMock })),@@ -85,9 +63,7 @@ const baseParams = {describe('createVerifierAgentRunner', () => {beforeEach(() => {vi.clearAllMocks();- threadCreateMock.mockResolvedValue({ id: 'thread-1' });execAgentMock.mockResolvedValue({ operationId: 'verifier-op-1' });- getPinnedDocumentsMock.mockResolvedValue([]);});it('returns undefined without a topicId (no thread to host the verifier)', () => {@@ -189,35 +165,13 @@ describe('createVerifierAgentRunner', () => {expect(execParams().slug).toBe(BUILTIN_AGENT_SLUGS.verifyAgent);});- it('keeps the parent task scope so the verifier can read its pinned documents', async () => {+ it('keeps the parent task scope while starting a fresh isolated topic', async () => {getBuiltinAgentMock.mockResolvedValue({ id: 'builtin-verify' });const runner = createVerifierAgentRunner({ ...baseParams })!;await runner(runnerArgs);- expect(execParams().appContext).toEqual({- taskId: 'task-1',- threadId: 'thread-1',- topicId: 'topic-1',- });- });-- it('associates pinned task documents with the verifier and supplies readable ids', async () => {- getBuiltinAgentMock.mockResolvedValue({ id: 'builtin-verify' });- getPinnedDocumentsMock.mockResolvedValue([- { documentId: 'docs-manuscript' },- { documentId: 'docs-notes' },- ]);- associateDocumentMock- .mockResolvedValueOnce({ id: 'agent-doc-manuscript' })- .mockResolvedValueOnce({ id: 'agent-doc-notes' });-- const runner = createVerifierAgentRunner({ ...baseParams })!;- await runner(runnerArgs);-- expect(associateDocumentMock).toHaveBeenNthCalledWith(1, 'builtin-verify', 'docs-manuscript');- expect(associateDocumentMock).toHaveBeenNthCalledWith(2, 'builtin-verify', 'docs-notes');- expect(execParams().additionalPluginIds).toEqual([AgentDocumentsIdentifier]);+ expect(execParams().appContext).toEqual({ taskId: 'task-1' });});it('injects the builder-captured evidence into the verifier prompt', async () => {diff --git a/apps/server/src/services/verify/__tests__/evidencePlanner.test.ts b/apps/server/src/services/verify/__tests__/evidencePlanner.test.tsnew file mode 100644index 00000000000..b0f40dd2d8d--- /dev/null+++ b/apps/server/src/services/verify/__tests__/evidencePlanner.test.ts@@ -0,0 +1,83 @@+import type { VerifyCheckItem } from '@lobechat/types';+import { describe, expect, it } from 'vitest';++import { planEvidenceVerification } from '../evidencePlanner';++const item = (requiredEvidence: unknown[]): VerifyCheckItem =>+ ({+ id: 'check-1',+ index: 0,+ onFail: 'manual',+ required: true,+ title: 'check',+ verifierConfig: { requiredEvidence },+ verifierType: 'llm',+ }) as VerifyCheckItem;++describe('planEvidenceVerification', () => {+ it('uses a multimodal judge for image evidence only when the model has vision', () => {+ const check = item([{ modality: 'image', scope: 'run_evidence', type: 'screenshot' }]);+ expect(+ planEvidenceVerification({+ evidence: [{ fileId: 'file-1', type: 'screenshot' }],+ item: check,+ modelSupportsVision: true,+ }).route,+ ).toBe('llm_multimodal');+ expect(+ planEvidenceVerification({+ evidence: [{ fileId: 'file-1', type: 'screenshot' }],+ item: check,+ modelSupportsVision: false,+ }).route,+ ).toBe('agent');+ });++ it('forces an agent for documents, task artifacts, and mixed modalities', () => {+ for (const check of [+ item([{ modality: 'document', scope: 'deliverable', type: 'markdown' }]),+ item([{ modality: 'text', scope: 'task_artifacts', type: 'text' }]),+ item([+ { modality: 'image', scope: 'run_evidence', type: 'screenshot' },+ { modality: 'text', scope: 'run_evidence', type: 'dom_snapshot' },+ ]),+ ]) {+ expect(+ planEvidenceVerification({ evidence: [], item: check, modelSupportsVision: true }).route,+ ).toBe('agent');+ }+ });++ it('forces an agent to resolve deliverable-scoped evidence even when it is text', () => {+ expect(+ planEvidenceVerification({+ evidence: [],+ item: item([{ modality: 'text', scope: 'deliverable', type: 'markdown' }]),+ modelSupportsVision: true,+ }).route,+ ).toBe('agent');+ });++ it.each(['text', 'markdown', 'dom_snapshot', 'transcript'] as const)(+ 'forces an agent to inspect file-backed %s evidence with no inline content',+ (type) => {+ expect(+ planEvidenceVerification({+ evidence: [{ fileId: 'file-large-text', type }],+ item: item([{ modality: 'text', scope: 'run_evidence', type }]),+ modelSupportsVision: true,+ }).route,+ ).toBe('agent');+ },+ );++ it('keeps file-backed text on the text judge when readable content is also inline', () => {+ expect(+ planEvidenceVerification({+ evidence: [{ content: 'readable text', fileId: 'file-text', type: 'text' }],+ item: item([{ modality: 'text', scope: 'run_evidence', type: 'text' }]),+ modelSupportsVision: true,+ }).route,+ ).toBe('llm_text');+ });+});diff --git a/apps/server/src/services/verify/__tests__/executor.test.ts b/apps/server/src/services/verify/__tests__/executor.test.tsindex cd640bd02c9..fdfa46120b2 100644--- a/apps/server/src/services/verify/__tests__/executor.test.ts+++ b/apps/server/src/services/verify/__tests__/executor.test.ts@@ -4,7 +4,11 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';import { VerifyExecutorService } from '../executor';const mocks = vi.hoisted(() => ({+ aiGenerateObject: vi.fn(),+ aiModelFind: vi.fn(),evidenceListByRun: vi.fn(),+ fileAccessUrl: vi.fn(),+ fileFindById: vi.fn(),resultCreateMany: vi.fn(),resultListByRun: vi.fn(),resultUpdateByCheckItem: vi.fn(),@@ -13,9 +17,18 @@ const mocks = vi.hoisted(() => ({statusRecompute: vi.fn(),}));+vi.mock('@lobechat/model-runtime', () => ({+ getModelPropertyWithFallback: vi.fn(async () => ({ vision: false })),+}));+vi.mock('@/database/models/aiModel', () => ({+ AiModelModel: vi.fn(() => ({ findByIdAndProvider: mocks.aiModelFind })),+}));vi.mock('@/database/models/document', () => ({DocumentModel: vi.fn(() => ({ findById: vi.fn() })),}));+vi.mock('@/database/models/file', () => ({+ FileModel: vi.fn(() => ({ findById: mocks.fileFindById })),+}));vi.mock('@/database/models/verifyEvidence', () => ({VerifyEvidenceModel: vi.fn(() => ({ listByRun: mocks.evidenceListByRun })),}));@@ -29,6 +42,12 @@ vi.mock('@/database/models/verifyCheckResult', () => ({vi.mock('@/database/models/verifyRun', () => ({VerifyRunModel: vi.fn(() => ({ ensureForOperation: mocks.runEnsureForOperation })),}));+vi.mock('@/server/services/aiGeneration', () => ({+ AiGenerationService: vi.fn(() => ({ generateObject: mocks.aiGenerateObject })),+}));+vi.mock('@/server/services/file', () => ({+ FileService: vi.fn(() => ({ getFileAccessUrl: mocks.fileAccessUrl })),+}));vi.mock('../statusService', () => ({VerifyStatusService: vi.fn(() => ({markVerifying: mocks.statusMarkVerifying,@@ -40,6 +59,13 @@ describe('VerifyExecutorService', () => {beforeEach(() => {vi.clearAllMocks();mocks.evidenceListByRun.mockResolvedValue([]);+ mocks.aiModelFind.mockResolvedValue({ abilities: { vision: false } });+ mocks.fileAccessUrl.mockResolvedValue('https://files.example/image.png');+ mocks.fileFindById.mockResolvedValue({+ fileType: 'image/png',+ id: 'file-1',+ url: 'evidence/image.png',+ });mocks.resultCreateMany.mockResolvedValue(undefined);mocks.resultListByRun.mockResolvedValueOnce([])@@ -85,4 +111,182 @@ describe('VerifyExecutorService', () => {expect.objectContaining({ status: 'running', verifierOperationId: 'verifier-op-1' }),);});++ it('lets the verifier agent resolve deliverable-scoped documents without uploaded run evidence', async () => {+ mocks.runEnsureForOperation.mockResolvedValue({+ id: 'run-1',+ plan: [+ {+ id: 'document-check',+ index: 0,+ onFail: 'auto_repair',+ required: true,+ title: 'Document',+ verifierConfig: {+ requiredEvidence: [{ modality: 'text', scope: 'deliverable', type: 'markdown' }],+ },+ verifierType: 'llm',+ },+ ],+ planConfirmedAt: new Date(),+ });+ const runVerifierAgent = vi.fn().mockResolvedValue({ verifierOperationId: 'verifier-op-doc' });++ await new VerifyExecutorService({} as never, 'user-1').execute({+ deliverable: 'document link',+ goal: 'verify document',+ modelConfig: { model: 'model', provider: 'provider' },+ operationId: 'builder-op-doc',+ runVerifierAgent,+ });++ expect(runVerifierAgent).toHaveBeenCalledWith(+ expect.objectContaining({+ checkItem: expect.objectContaining({ id: 'document-check' }),+ }),+ );+ expect(mocks.resultUpdateByCheckItem).not.toHaveBeenCalledWith(+ 'run-1',+ 'document-check',+ expect.objectContaining({ verdict: 'uncertain' }),+ );+ });++ it('routes file-backed text evidence to an agent that can inspect the stored artifact', async () => {+ mocks.runEnsureForOperation.mockResolvedValue({+ id: 'run-1',+ plan: [+ {+ id: 'large-transcript',+ index: 0,+ onFail: 'auto_repair',+ required: true,+ title: 'Large transcript',+ verifierConfig: {+ requiredEvidence: [{ modality: 'text', scope: 'run_evidence', type: 'transcript' }],+ },+ verifierType: 'llm',+ },+ ],+ planConfirmedAt: new Date(),+ });+ mocks.evidenceListByRun.mockResolvedValue([+ {+ checkItemId: 'large-transcript',+ content: null,+ description: 'CLI output exceeding the inline limit',+ fileId: 'file-large-transcript',+ type: 'transcript',+ },+ ]);+ mocks.resultListByRun.mockReset().mockResolvedValue([]);+ const runVerifierAgent = vi.fn().mockResolvedValue({ verifierOperationId: 'verifier-op-text' });++ await new VerifyExecutorService({} as never, 'user-1').execute({+ deliverable: 'stored transcript',+ goal: 'verify the complete CLI output',+ modelConfig: { model: 'model', provider: 'provider' },+ operationId: 'builder-op-text',+ runVerifierAgent,+ });++ expect(runVerifierAgent).toHaveBeenCalledWith(+ expect.objectContaining({+ checkItem: expect.objectContaining({ id: 'large-transcript' }),+ evidence: [+ expect.objectContaining({+ fileId: 'file-large-transcript',+ type: 'transcript',+ }),+ ],+ }),+ );+ expect(mocks.aiGenerateObject).not.toHaveBeenCalled();+ });++ it('falls back to single-item judging when a batch omits a check id', async () => {+ mocks.runEnsureForOperation.mockResolvedValue({+ id: 'run-1',+ plan: [+ { id: 'a', index: 0, required: true, title: 'A', verifierType: 'llm' },+ { id: 'b', index: 1, required: true, title: 'B', verifierType: 'llm' },+ ],+ planConfirmedAt: new Date(),+ });+ mocks.resultListByRun.mockReset().mockResolvedValue([]);+ mocks.aiGenerateObject+ .mockResolvedValueOnce({+ verdicts: [+ { checkItemId: 'a', confidence: 1, evidence: 'ok', reasoning: 'ok', verdict: 'passed' },+ ],+ })+ .mockResolvedValueOnce({+ confidence: 1,+ evidence: 'ok',+ reasoning: 'ok',+ verdict: 'passed',+ });++ await new VerifyExecutorService({} as never, 'user-1').execute({+ deliverable: 'done',+ goal: 'ship',+ modelConfig: { model: 'model', provider: 'provider' },+ operationId: 'op-1',+ });++ expect(mocks.aiGenerateObject).toHaveBeenCalledTimes(2);+ expect(mocks.resultUpdateByCheckItem).toHaveBeenCalledWith(+ 'run-1',+ 'b',+ expect.objectContaining({ status: 'passed' }),+ );+ });++ it('loads screenshot content into a vision-model message', async () => {+ mocks.aiModelFind.mockResolvedValue({ abilities: { vision: true } });+ mocks.runEnsureForOperation.mockResolvedValue({+ id: 'run-1',+ plan: [+ {+ id: 'visual',+ index: 0,+ required: true,+ title: 'Visual',+ verifierConfig: {+ requiredEvidence: [{ modality: 'image', scope: 'run_evidence', type: 'screenshot' }],+ },+ verifierType: 'llm',+ },+ ],+ planConfirmedAt: new Date(),+ });+ mocks.evidenceListByRun.mockResolvedValue([+ {+ checkItemId: 'visual',+ description: 'screen',+ fileId: 'file-1',+ type: 'screenshot',+ },+ ]);+ mocks.resultListByRun.mockReset().mockResolvedValue([]);+ mocks.aiGenerateObject.mockResolvedValue({+ confidence: 1,+ evidence: 'visible',+ reasoning: 'visible',+ verdict: 'passed',+ });++ await new VerifyExecutorService({} as never, 'user-1').execute({+ deliverable: 'done',+ goal: 'ship',+ modelConfig: { model: 'vision-model', provider: 'provider' },+ operationId: 'op-1',+ });++ const request = mocks.aiGenerateObject.mock.calls[0][0];+ expect(request.messages[1].content).toContainEqual({+ image_url: { detail: 'high', url: 'https://files.example/image.png' },+ type: 'image_url',+ });+ });});diff --git a/apps/server/src/services/verify/__tests__/holisticPlan.test.ts b/apps/server/src/services/verify/__tests__/holisticPlan.test.tsindex 043b10763e0..759d527d33e 100644--- a/apps/server/src/services/verify/__tests__/holisticPlan.test.ts+++ b/apps/server/src/services/verify/__tests__/holisticPlan.test.ts@@ -1,27 +1,49 @@+import { LobeDeliveryCheckerManifest } from '@lobechat/builtin-tool-lobe-delivery-checker';import type { VerifyCheckItem } from '@lobechat/types';import { beforeEach, describe, expect, it, vi } from 'vitest';import { VerifyPlanGeneratorService } from '../planGenerator';// Mock the model modules the generator constructs (holistic fallback).-const { setPlanMock, ensureForOperationMock, getCriteriaMock, findByIdsMock } = vi.hoisted(() => ({+const {+ confirmPlanMock,+ createCriterionMock,+ createRubricMock,+ ensureForOperationMock,+ findByIdsMock,+ getCriteriaMock,+ setCriteriaMock,+ setPlanMock,+} = vi.hoisted(() => ({+ confirmPlanMock: vi.fn(),+ createCriterionMock: vi.fn(async (input: any) => ({ id: 'created-criterion', ...input })),+ createRubricMock: vi.fn(async () => ({ id: 'rub-created' })),ensureForOperationMock: vi.fn(async () => ({ id: 'run-1' })),findByIdsMock: vi.fn(async () => [] as any[]),getCriteriaMock: vi.fn(async () => [] as any[]),+ setCriteriaMock: vi.fn(),setPlanMock: vi.fn(async (_runId: string, _items: any[]) => {}),}));vi.mock('@/database/models/verifyRun', () => ({VerifyRunModel: vi.fn(() => ({ensureForOperation: ensureForOperationMock,+ confirmPlan: confirmPlanMock,setPlan: setPlanMock,})),}));vi.mock('@/database/models/verifyRubric', () => ({- VerifyRubricModel: vi.fn(() => ({ getCriteria: getCriteriaMock })),+ VerifyRubricModel: vi.fn(() => ({+ create: createRubricMock,+ getCriteria: getCriteriaMock,+ setCriteria: setCriteriaMock,+ })),}));vi.mock('@/database/models/verifyCriterion', () => ({- VerifyCriterionModel: vi.fn(() => ({ findByIds: findByIdsMock })),+ VerifyCriterionModel: vi.fn(() => ({+ create: createCriterionMock,+ findByIds: findByIdsMock,+ })),}));vi.mock('@/database/models/document', () => ({ DocumentModel: vi.fn(() => ({})) }));vi.mock('@/server/services/aiGeneration', () => ({ AiGenerationService: vi.fn(() => ({})) }));@@ -98,4 +120,57 @@ describe('generateDraftPlan — holistic fallback', () => {expect(plan[0].title).toBe('Crit 1');expect(plan[0].verifierType).toBe('llm');});++ it('preserves verifierConfig from mounted criteria in the frozen plan', async () => {+ getCriteriaMock.mockResolvedValue([+ {+ id: 'c-evidence',+ onFail: 'auto_repair',+ required: true,+ title: 'Visual proof',+ verifierConfig: {+ requiredEvidence: [{ modality: 'image', scope: 'run_evidence', type: 'screenshot' }],+ },+ verifierType: 'llm',+ },+ ]);++ await new VerifyPlanGeneratorService(db, 'user-1').generateDraftPlan({+ goal: 'x',+ operationId: 'op-1',+ verifyRubricId: 'rub-1',+ });++ expect(lastPlan()[0].verifierConfig).toEqual({+ requiredEvidence: [{ modality: 'image', scope: 'run_evidence', type: 'screenshot' }],+ });+ });++ it('persists agent-authored verifierConfig instead of replacing it with an empty object', async () => {+ const config = {+ requiredEvidence: [{ modality: 'image', scope: 'run_evidence', type: 'screenshot' }],+ };+ const result = await new VerifyPlanGeneratorService(db, 'user-1').createPlanFromCriteria({+ criteria: [{ title: 'Visual proof', verifierConfig: config, verifierType: 'llm' }],+ operationId: 'op-1',+ title: 'Acceptance',+ });++ expect(createCriterionMock).toHaveBeenCalledWith(+ expect.objectContaining({ verifierConfig: config }),+ );+ expect(result.items[0].verifierConfig).toEqual(config);+ });++ it('exposes the required evidence inventory in the agent tool contract', () => {+ const criterion = LobeDeliveryCheckerManifest.api[0].parameters.properties.criteria.items;++ expect(criterion.required).toContain('requiredEvidence');+ expect(criterion.properties.requiredEvidence.items.required).toEqual([+ 'type',+ 'modality',+ 'scope',+ 'hint',+ ]);+ });});diff --git a/apps/server/src/services/verify/__tests__/judgePrompt.test.ts b/apps/server/src/services/verify/__tests__/judgePrompt.test.tsindex 986c3fac5a0..4d7296e1284 100644--- a/apps/server/src/services/verify/__tests__/judgePrompt.test.ts+++ b/apps/server/src/services/verify/__tests__/judgePrompt.test.ts@@ -1,8 +1,12 @@import { describe, expect, it } from 'vitest';-import { buildJudgePrompt } from '../prompts';+import { buildJudgePrompt, VERIFY_JUDGE_PROMPT_VERSION } from '../prompts';describe('buildJudgePrompt evidence injection', () => {+ it('partitions traces with the current evidence-policy prompt version', () => {+ expect(VERIFY_JUDGE_PROMPT_VERSION).toBe('2');+ });+it('inlines text evidence and references stored artifacts under the criterion', () => {const { system, user } = buildJudgePrompt({deliverable: 'done',@@ -10,7 +14,7 @@ describe('buildJudgePrompt evidence injection', () => {items: [{evidence: [- { description: '首屏渲染', type: 'screenshot' },+ { description: '首屏渲染', fileId: 'file-1', type: 'screenshot' },{ content: '<div id="root">ok</div>', type: 'dom_snapshot' },],id: 'item-1',@@ -21,12 +25,10 @@ describe('buildJudgePrompt evidence injection', () => {});expect(user).toContain('Evidence captured during the run:');- // stored artifact → referenced by presence + caption, not inlined- expect(user).toContain('(screenshot) — 首屏渲染 [artifact captured]');+ expect(user).toContain('(screenshot) — 首屏渲染 [artifact attached to this judge request]');// inline text → quoted in fullexpect(user).toContain('(dom_snapshot): <div id="root">ok</div>');- // the judge is told to weight artifacts as primary Data- expect(system).toContain('primary Data');+ expect(system).toContain('Never treat mere existence');});it('omits the evidence block when an item has none', () => {diff --git a/apps/server/src/services/verify/__tests__/lifecycle.test.ts b/apps/server/src/services/verify/__tests__/lifecycle.test.tsnew file mode 100644index 00000000000..1e70b33a2e0--- /dev/null+++ b/apps/server/src/services/verify/__tests__/lifecycle.test.ts@@ -0,0 +1,83 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';++import { resolveVerificationDeliverable } from '../lifecycle';++const { findByIdMock, getPinnedDocumentsMock } = vi.hoisted(() => ({+ findByIdMock: vi.fn(),+ getPinnedDocumentsMock: vi.fn(),+}));++vi.mock('@/database/models/document', () => ({+ DocumentModel: vi.fn().mockImplementation(() => ({ findById: findByIdMock })),+}));+vi.mock('@/database/models/task', () => ({+ TaskModel: vi.fn().mockImplementation(() => ({+ getPinnedDocuments: getPinnedDocumentsMock,+ })),+}));++describe('resolveVerificationDeliverable', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ });++ it('keeps the original deliverable for runs without a task', async () => {+ const deliverable = await resolveVerificationDeliverable({} as any, 'user-1', 'done');++ expect(deliverable).toBe('done');+ expect(getPinnedDocumentsMock).not.toHaveBeenCalled();+ });++ it('includes the actual contents of documents associated with the task', async () => {+ getPinnedDocumentsMock.mockResolvedValue([+ { documentId: 'docs-report' },+ { documentId: 'docs-board' },+ ]);+ findByIdMock+ .mockResolvedValueOnce({+ content: '# Report\nSemantic evidence is readable.',+ id: 'docs-report',+ title: 'Report',+ })+ .mockResolvedValueOnce({+ content: '<svg><text>PASS</text></svg>',+ id: 'docs-board',+ title: 'Status board',+ });++ const deliverable = await resolveVerificationDeliverable(+ {} as any,+ 'user-1',+ 'Created the requested documents.',+ 'task-1',+ );++ expect(getPinnedDocumentsMock).toHaveBeenCalledWith('task-1');+ expect(deliverable).toContain('Created the requested documents.');+ expect(deliverable).toContain('## Task document: Report');+ expect(deliverable).toContain('Semantic evidence is readable.');+ expect(deliverable).toContain('## Task document: Status board');+ expect(deliverable).toContain('<svg><text>PASS</text></svg>');+ });++ it('ignores missing or empty associated documents', async () => {+ getPinnedDocumentsMock.mockResolvedValue([+ { documentId: 'docs-missing' },+ { documentId: 'docs-empty' },+ ]);+ findByIdMock.mockResolvedValueOnce(undefined).mockResolvedValueOnce({+ content: '',+ id: 'docs-empty',+ title: 'Empty',+ });++ const deliverable = await resolveVerificationDeliverable(+ {} as any,+ 'user-1',+ 'original',+ 'task-1',+ );++ expect(deliverable).toBe('original');+ });+});diff --git a/apps/server/src/services/verify/agentVerifier.ts b/apps/server/src/services/verify/agentVerifier.tsindex a817cd1b68a..e8f12043227 100644--- a/apps/server/src/services/verify/agentVerifier.ts+++ b/apps/server/src/services/verify/agentVerifier.ts@@ -1,17 +1,11 @@import { BUILTIN_AGENT_SLUGS } from '@lobechat/builtin-agents';-import { AgentDocumentsIdentifier } from '@lobechat/builtin-tool-agent-documents';import { VerifyToolIdentifier } from '@lobechat/builtin-tool-verify';-import type { VerifierTaskDocument } from '@lobechat/prompts';import { buildVerifierPrompt } from '@lobechat/prompts';-import { ThreadType } from '@lobechat/types';import debug from 'debug';import { AgentModel } from '@/database/models/agent';import { DocumentModel } from '@/database/models/document';-import { TaskModel } from '@/database/models/task';-import { ThreadModel } from '@/database/models/thread';import type { LobeChatDatabase } from '@/database/type';-import { AgentDocumentsService } from '@/server/services/agentDocuments';import type { AgentHook, AgentHookEvent } from '@/server/services/agentRuntime/hooks/types';import { AiAgentService } from '@/server/services/aiAgent';@@ -86,7 +80,6 @@ export const createVerifierAgentRunner = (params: {// its own agency config drives execution target/provider — we don't override// its model/provider. The builtin fallback runs by `slug` with the verify-safe// model/provider selected by lifecycle.- let threadAgentId: string;let agentRef: { agentId: string } | { slug: string };let useProvidedModelConfig = false;// A pinned agent (selected for its runtime/device) carries only its own@@ -96,7 +89,6 @@ export const createVerifierAgentRunner = (params: {let extraPluginIds: string[] = [];if (verifierAgentId && (await agentModel.existsById(verifierAgentId))) {- threadAgentId = verifierAgentId;agentRef = { agentId: verifierAgentId };extraPluginIds = [VerifyToolIdentifier];} else {@@ -109,39 +101,10 @@ export const createVerifierAgentRunner = (params: {log('verify agent unavailable, cannot run agent verifier for check %s', checkItem.id);return null;}- threadAgentId = builtin.id;agentRef = { slug: BUILTIN_AGENT_SLUGS.verifyAgent };useProvidedModelConfig = true;}- let taskDocuments: VerifierTaskDocument[] | undefined;- if (taskId) {- const pinnedDocuments = await new TaskModel(db, userId, workspaceId).getPinnedDocuments(- taskId,- );- const agentDocumentsService = new AgentDocumentsService(db, userId, workspaceId);- taskDocuments = await Promise.all(- pinnedDocuments.map(async ({ documentId }) => ({- agentDocumentId: (- await agentDocumentsService.associateDocument(threadAgentId, documentId)- ).id,- documentId,- })),- );- }- if (taskDocuments?.length) extraPluginIds.push(AgentDocumentsIdentifier);-- const thread = await new ThreadModel(db, userId, workspaceId).create({- agentId: threadAgentId,- title: `Verify: ${checkItem.title}`,- topicId,- type: ThreadType.Isolation,- });- if (!thread) {- log('failed to create verifier thread for check %s', checkItem.id);- return null;- }-// Attach the builder-captured file artifacts (screenshots / videos / large// text) so a multimodal verifier can SEE them — the prompt only references// them by presence + caption, which is blind for visual checks.@@ -180,6 +143,13 @@ export const createVerifierAgentRunner = (params: {},},];+ const verifierPrompt = buildVerifierPrompt({+ checkItem,+ deliverable,+ evidence,+ goal,+ instruction,+ });// The aiAgent → agentRuntime completion → verify lifecycle → this runner →// aiAgent import cycle is safe statically: every use here is call-time (inside@@ -187,7 +157,11 @@ export const createVerifierAgentRunner = (params: {const result = await new AiAgentService(db, userId, { workspaceId }).execAgent({// Inject the verify writeback tool for pinned agents (no-op list otherwise)....(extraPluginIds.length ? { additionalPluginIds: extraPluginIds } : {}),- appContext: { taskId, threadId: thread.id, topicId },+ // A fresh topic keeps the verifier isolated without inheriting the+ // parent topic's thread message processors. Those processors can filter+ // the verifier user turn during queued resume and leave only system+ // messages for the first LLM call.+ appContext: { taskId },autoStart: true,...(evidenceFileIds.length ? { fileIds: evidenceFileIds } : {}),hooks,@@ -195,14 +169,7 @@ export const createVerifierAgentRunner = (params: {// a pinned agent keeps its own runtime config....(useProvidedModelConfig && model ? { model } : {}),parentOperationId: operationId,- prompt: buildVerifierPrompt({- checkItem,- deliverable,- evidence,- goal,- instruction,- taskDocuments,- }),+ prompt: verifierPrompt,...(useProvidedModelConfig && provider ? { provider } : {}),...agentRef,userInterventionConfig: { approvalMode: 'headless' },diff --git a/apps/server/src/services/verify/evidencePlanner.ts b/apps/server/src/services/verify/evidencePlanner.tsnew file mode 100644index 00000000000..d1a28cd2a4a--- /dev/null+++ b/apps/server/src/services/verify/evidencePlanner.ts@@ -0,0 +1,64 @@+import type { RequiredEvidenceSpec, VerifyCheckItem } from '@lobechat/types';++import { readRequiredEvidence } from './evidenceCoverage';+import type { JudgeEvidence } from './prompts';++export type JudgeRoute = 'agent' | 'llm_multimodal' | 'llm_text';++export interface EvidencePlan {+ modalities: Set<NonNullable<RequiredEvidenceSpec['modality']>>;+ route: JudgeRoute;+}++const imageEvidenceTypes = new Set(['gif', 'screenshot']);+const textEvidenceTypes = new Set(['dom_snapshot', 'markdown', 'text', 'transcript']);++/**+ * Select the least-powerful verifier that can inspect every required artifact.+ * Heterogeneous, document, audio, video, and task-artifact checks always require+ * an agent; a pure image check may use an inline judge only when the model has vision.+ */+export const planEvidenceVerification = (params: {+ evidence: JudgeEvidence[];+ item: VerifyCheckItem;+ modelSupportsVision: boolean;+}): EvidencePlan => {+ const required = readRequiredEvidence(params.item.verifierConfig) ?? [];+ const modalities = new Set(+ required+ .map((spec) => spec.modality)+ .filter((modality): modality is NonNullable<RequiredEvidenceSpec['modality']> =>+ Boolean(modality),+ ),+ );+ const evidenceTypes = new Set([+ ...required.map((spec) => spec.type),+ ...params.evidence.map((item) => item.type),+ ]);+ const scopes = new Set(required.map((spec) => spec.scope).filter(Boolean));+ const hasFileBackedText = params.evidence.some(+ (evidence) =>+ textEvidenceTypes.has(evidence.type) && Boolean(evidence.fileId) && !evidence.content,+ );++ if (+ scopes.has('deliverable') ||+ scopes.has('task_artifacts') ||+ hasFileBackedText ||+ modalities.has('audio') ||+ modalities.has('document') ||+ modalities.has('video') ||+ modalities.size > 1 ||+ [...evidenceTypes].some((type) => !imageEvidenceTypes.has(type) && !textEvidenceTypes.has(type))+ ) {+ return { modalities, route: 'agent' };+ }++ const hasImage =+ modalities.has('image') || [...evidenceTypes].some((type) => imageEvidenceTypes.has(type));+ if (hasImage) {+ return { modalities, route: params.modelSupportsVision ? 'llm_multimodal' : 'agent' };+ }++ return { modalities, route: 'llm_text' };+};diff --git a/apps/server/src/services/verify/executor.ts b/apps/server/src/services/verify/executor.tsindex 961bad9feb5..8211b70f6a4 100644--- a/apps/server/src/services/verify/executor.ts+++ b/apps/server/src/services/verify/executor.ts@@ -2,6 +2,7 @@ import { randomUUID } from 'node:crypto';import { TRACING_SCENARIOS } from '@lobechat/const';import type { TracingOptions } from '@lobechat/llm-generation-tracing';+import { getModelPropertyWithFallback } from '@lobechat/model-runtime';import type {ToulminVerdict,VerifyCheckItem,@@ -10,14 +11,18 @@ import type {} from '@lobechat/types';import debug from 'debug';+import { AiModelModel } from '@/database/models/aiModel';import { DocumentModel } from '@/database/models/document';+import { FileModel } from '@/database/models/file';import { VerifyCheckResultModel } from '@/database/models/verifyCheckResult';import { VerifyEvidenceModel } from '@/database/models/verifyEvidence';import { VerifyRunModel } from '@/database/models/verifyRun';import type { LobeChatDatabase } from '@/database/type';import { AiGenerationService } from '@/server/services/aiGeneration';+import { FileService } from '@/server/services/file';import { coverageGaps, readRequiredEvidence } from './evidenceCoverage';+import { planEvidenceVerification } from './evidencePlanner';import { buildJudgePrompt, type JudgeEvidence, VERIFY_JUDGE_PROMPT_VERSION } from './prompts';import { planItemToPendingResult } from './resultSnapshot';import {@@ -87,6 +92,9 @@ export class VerifyExecutorService {private readonly statusService: VerifyStatusService;private readonly documentModel: DocumentModel;private readonly evidenceModel: VerifyEvidenceModel;+ private readonly fileModel: FileModel;+ private readonly fileService: FileService;+ private readonly aiModelModel: AiModelModel;constructor(db: LobeChatDatabase, userId: string, workspaceId?: string) {this.db = db;@@ -96,6 +104,9 @@ export class VerifyExecutorService {this.statusService = new VerifyStatusService(db, userId, workspaceId);this.documentModel = new DocumentModel(db, userId, workspaceId);this.evidenceModel = new VerifyEvidenceModel(db, userId, workspaceId);+ this.fileModel = new FileModel(db, userId, workspaceId);+ this.fileService = new FileService(db, userId, workspaceId);+ this.aiModelModel = new AiModelModel(db, userId, workspaceId);}/**@@ -149,8 +160,33 @@ export class VerifyExecutorService {const gapIds = await this.runStructuralGate(verifyRunId, items, evidenceByItem);const gated = items.filter((i) => !gapIds.has(i.id));- const llmItems = gated.filter((i) => i.verifierType === 'llm');- const agentItems = gated.filter((i) => i.verifierType === 'agent');+ const declaredLlmItems = gated.filter((i) => i.verifierType === 'llm');+ const supportsVision = await this.modelSupportsVision(+ params.modelConfig.model,+ params.modelConfig.provider,+ );+ const evidencePlans = new Map(+ declaredLlmItems.map((item) => [+ item.id,+ planEvidenceVerification({+ evidence: evidenceByItem.get(item.id) ?? [],+ item,+ modelSupportsVision: supportsVision,+ }),+ ]),+ );+ const llmItems = declaredLlmItems.filter(+ (item) => evidencePlans.get(item.id)?.route !== 'agent',+ );+ const multimodalItemIds = new Set(+ llmItems+ .filter((item) => evidencePlans.get(item.id)?.route === 'llm_multimodal')+ .map((item) => item.id),+ );+ const agentItems = [+ ...gated.filter((i) => i.verifierType === 'agent'),+ ...declaredLlmItems.filter((item) => evidencePlans.get(item.id)?.route === 'agent'),+ ];const programItems = gated.filter((i) => i.verifierType === 'program');// The verifier kinds are independent — run them concurrently. Program checks@@ -158,7 +194,7 @@ export class VerifyExecutorService {// sandboxed native program runner is available.await Promise.all([this.runProgramItems(params, verifyRunId, programItems, evidenceByItem),- this.runLlmItems(params, verifyRunId, llmItems, evidenceByItem),+ this.runLlmItems(params, verifyRunId, llmItems, evidenceByItem, multimodalItemIds),...agentItems.map((item) =>this.runAgentItem(params, verifyRunId, item, evidenceByItem.get(item.id) ?? []),),@@ -173,8 +209,8 @@ export class VerifyExecutorService {const byItem: EvidenceByItem = new Map();for (const row of rows) {const list = byItem.get(row.checkItemId) ?? [];- // Keep `fileId` so the agent verifier can attach the actual artifact (the- // LLM judge ignores it and renders text only).+ // Keep `fileId` so the planner can route file-only text to an agent and+ // agent verifiers can attach the actual artifact.list.push({content: row.content,description: row.description,@@ -186,6 +222,32 @@ export class VerifyExecutorService {return byItem;}+ private async hydrateInlineMedia(evidence: JudgeEvidence[]): Promise<JudgeEvidence[]> {+ return Promise.all(+ evidence.map(async (item) => {+ if (!item.fileId || (item.type !== 'screenshot' && item.type !== 'gif')) return item;+ const file = await this.fileModel.findById(item.fileId);+ if (!file) return item;+ return {+ ...item,+ accessUrl: await this.fileService.getFileAccessUrl({ id: file.id, url: file.url }),+ };+ }),+ );+ }++ private async modelSupportsVision(model: string, provider: string): Promise<boolean> {+ const custom = await this.aiModelModel.findByIdAndProvider(model, provider);+ const customAbilities = custom?.abilities as { vision?: boolean } | undefined;+ if (typeof customAbilities?.vision === 'boolean') return customAbilities.vision;+ const abilities = await getModelPropertyWithFallback<{ vision?: boolean }>(+ model,+ 'abilities',+ provider,+ );+ return abilities?.vision === true;+ }+/*** Mark every evidence-driven item whose declared evidence is incomplete as* `uncertain` (status `failed`, so it gates delivery and seeds repair), and@@ -199,7 +261,12 @@ export class VerifyExecutorService {): Promise<Set<string>> {const gapIds = new Set<string>();for (const item of items) {- const required = readRequiredEvidence(item.verifierConfig);+ // Deliverable/task-artifact evidence is resolved by the verifier agent+ // from the operation's associated documents/files. Only run evidence is+ // expected to have been explicitly captured into verify_evidence rows.+ const required = readRequiredEvidence(item.verifierConfig)?.filter(+ (spec) => !spec.scope || spec.scope === 'run_evidence',+ );const gaps = coverageGaps(required, evidenceByItem.get(item.id) ?? []);if (gaps.length === 0) continue;@@ -250,17 +317,27 @@ export class VerifyExecutorService {verifyRunId: string,items: VerifyCheckItem[],evidenceByItem: EvidenceByItem,+ multimodalItemIds: Set<string>,): Promise<void> {if (items.length === 0) return;try {- if (params.batchLlm ?? true) {- await this.judgeBatch(params, verifyRunId, items, evidenceByItem);+ const textItems = items.filter((item) => !multimodalItemIds.has(item.id));+ const multimodalItems = items.filter((item) => multimodalItemIds.has(item.id));+ if ((params.batchLlm ?? true) && textItems.length > 1) {+ await this.judgeBatch(params, verifyRunId, textItems, evidenceByItem);} else {- for (const item of items) await this.judgeSingle(params, verifyRunId, item, evidenceByItem);+ for (const item of textItems)+ await this.judgeSingle(params, verifyRunId, item, evidenceByItem);}+ for (const item of multimodalItems)+ await this.judgeSingle(params, verifyRunId, item, evidenceByItem, true);} catch (error) {log('llm judge failed for op %s: %O', params.operationId, error);- // Leave failed-to-judge items pending; rollup will report `verifying`.+ await this.markUnfinishedErrored(+ verifyRunId,+ items,+ `LLM judge failed: ${error instanceof Error ? error.message : String(error)}`,+ );}}@@ -392,18 +469,26 @@ export class VerifyExecutorService {const parsed = BatchVerdictSchema.safeParse(raw);if (!parsed.success) {log('batch judge output invalid: %O', parsed.error.flatten());+ for (const item of items) await this.judgeSingle(params, verifyRunId, item, evidenceByItem);return;}const validIds = new Set(items.map((i) => i.id));+ const returnedIds = new Set<string>();for (const v of parsed.data.verdicts) {if (!validIds.has(v.checkItemId)) continue;+ returnedIds.add(v.checkItemId);await this.writeVerdict({checkItemId: v.checkItemId,verdict: v,verifyRunId,});}+ for (const item of items) {+ if (!returnedIds.has(item.id)) {+ await this.judgeSingle(params, verifyRunId, item, evidenceByItem);+ }+ }}private async judgeSingle(@@ -411,15 +496,19 @@ export class VerifyExecutorService {verifyRunId: string,item: VerifyCheckItem,evidenceByItem: EvidenceByItem,+ multimodal = false,): Promise<void> {// Per-criterion: each result gets its own tracing row (1:1).const tracingId = randomUUID();+ const hydratedEvidence = multimodal+ ? await this.hydrateInlineMedia(evidenceByItem.get(item.id) ?? [])+ : evidenceByItem.get(item.id);const { system, user } = buildJudgePrompt({deliverable: params.deliverable,goal: params.goal,items: [{- evidence: evidenceByItem.get(item.id),+ evidence: hydratedEvidence,id: item.id,instruction: await this.resolveInstruction(item),title: item.title,@@ -431,10 +520,26 @@ export class VerifyExecutorService {const ai = new AiGenerationService(this.db, this.userId);const raw = await ai.generateObject({- messages: [- { content: system, role: 'system' as const },- { content: user, role: 'user' as const },- ],+ messages: multimodal+ ? [+ { content: system, role: 'system' as const },+ {+ content: [+ { text: user, type: 'text' as const },+ ...(hydratedEvidence ?? [])+ .filter((evidence) => evidence.accessUrl)+ .map((evidence) => ({+ image_url: { detail: 'high' as const, url: evidence.accessUrl! },+ type: 'image_url' as const,+ })),+ ],+ role: 'user' as const,+ },+ ]+ : [+ { content: system, role: 'system' as const },+ { content: user, role: 'user' as const },+ ],model: params.modelConfig.model,provider: params.modelConfig.provider,schema: SINGLE_VERDICT_JSON_SCHEMA,@@ -455,6 +560,11 @@ export class VerifyExecutorService {const parsed = SingleVerdictSchema.safeParse(raw);if (!parsed.success) {log('single judge output invalid: %O', parsed.error.flatten());+ await this.resultModel.updateByCheckItem(verifyRunId, item.id, {+ completedAt: new Date(),+ status: 'errored',+ toulmin: { limitation: 'LLM judge returned an invalid structured verdict.' },+ });return;}await this.writeVerdict({@@ -464,6 +574,30 @@ export class VerifyExecutorService {});}+ private async markUnfinishedErrored(+ verifyRunId: string,+ items: VerifyCheckItem[],+ limitation: string,+ ): Promise<void> {+ const results = await this.resultModel.listByRun(verifyRunId);+ const terminalIds = new Set(+ results+ .filter((result) => terminalResultStatuses.has(result.status))+ .map((result) => result.checkItemId),+ );+ await Promise.all(+ items+ .filter((item) => !terminalIds.has(item.id))+ .map((item) =>+ this.resultModel.updateByCheckItem(verifyRunId, item.id, {+ completedAt: new Date(),+ status: 'errored',+ toulmin: { limitation },+ }),+ ),+ );+ }+private async writeVerdict(params: {checkItemId: string;verdict: SingleVerdict;diff --git a/apps/server/src/services/verify/lifecycle.ts b/apps/server/src/services/verify/lifecycle.tsindex 7e60ca1f7a5..90419919db9 100644--- a/apps/server/src/services/verify/lifecycle.ts+++ b/apps/server/src/services/verify/lifecycle.ts@@ -1,6 +1,7 @@import debug from 'debug';import { AgentOperationModel } from '@/database/models/agentOperation';+import { DocumentModel } from '@/database/models/document';import { TaskModel } from '@/database/models/task';import { VerifyRunModel } from '@/database/models/verifyRun';import type { LobeChatDatabase } from '@/database/type';@@ -11,6 +12,44 @@ import { resolveVerifyModelConfig } from './modelConfig';import { finalizeVerifyRun } from './settle';const log = debug('lobe-server:verify-lifecycle');+const MAX_TASK_DOCUMENT_CHARS = 80_000;++export const resolveVerificationDeliverable = async (+ db: LobeChatDatabase,+ userId: string,+ deliverable: string,+ taskId?: string | null,+ workspaceId?: string,+): Promise<string> => {+ if (!taskId) return deliverable;++ const pinnedDocuments = await new TaskModel(db, userId, workspaceId).getPinnedDocuments(taskId);+ if (pinnedDocuments.length === 0) return deliverable;++ const documentModel = new DocumentModel(db, userId, workspaceId);+ const documents = await Promise.all(+ pinnedDocuments.map(({ documentId }) => documentModel.findById(documentId)),+ );+ const readableDocuments = documents.filter((document): document is NonNullable<typeof document> =>+ Boolean(document?.content),+ );+ if (readableDocuments.length === 0) return deliverable;++ const taskDocumentContent = readableDocuments+ .map(+ (document) =>+ `## Task document: ${document.title ?? document.id}\n\n${document.content ?? ''}`,+ )+ .join('\n\n');++ return [+ deliverable,+ '# Associated task deliverables',+ taskDocumentContent.slice(0, MAX_TASK_DOCUMENT_CHARS),+ ]+ .filter(Boolean)+ .join('\n\n');+};export interface RunVerifyOnCompletionParams {/** The run's final output / artifacts, judged against the plan. */@@ -73,10 +112,17 @@ export const runVerifyOnCompletion = async (},workspaceId,);+ const resolvedDeliverable = await resolveVerificationDeliverable(+ db,+ userId,+ params.deliverable,+ op.taskId,+ workspaceId,+ );const executor = new VerifyExecutorService(db, userId, workspaceId);await executor.execute({- deliverable: params.deliverable,+ deliverable: resolvedDeliverable,goal: params.goal,modelConfig,operationId: params.operationId,@@ -84,7 +130,7 @@ export const runVerifyOnCompletion = async (// one), which writes its verdict back via the submitVerifyResult tool.runVerifierAgent: createVerifierAgentRunner({db,- deliverable: params.deliverable,+ deliverable: resolvedDeliverable,model: modelConfig.model,provider: modelConfig.provider,taskId: op.taskId,@@ -106,7 +152,7 @@ export const runVerifyOnCompletion = async (params.operationId,{report: {- deliverable: params.deliverable,+ deliverable: resolvedDeliverable,goal: params.goal,modelConfig,},diff --git a/apps/server/src/services/verify/planGenerator.ts b/apps/server/src/services/verify/planGenerator.tsindex b231ed104df..466cf9e8647 100644--- a/apps/server/src/services/verify/planGenerator.ts+++ b/apps/server/src/services/verify/planGenerator.ts@@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto';import { TRACING_SCENARIOS, VERIFY_INSTRUCTION_FILE_TYPE } from '@lobechat/const';import type { TracingOptions } from '@lobechat/llm-generation-tracing';-import type { VerifyCheckItem } from '@lobechat/types';+import type { RequiredEvidenceSpec, VerifyCheckItem } from '@lobechat/types';import debug from 'debug';import { DocumentModel } from '@/database/models/document';@@ -59,6 +59,7 @@ export interface CriterionDraft {instruction?: string;onFail?: VerifyCheckItem['onFail'];required?: boolean;+ requiredEvidence?: RequiredEvidenceSpec[];title: string;/** Verifier knobs (e.g. `requiredEvidence`) — attached when the user adds them. */verifierConfig?: Record<string, unknown>;@@ -189,13 +190,17 @@ export class VerifyPlanGeneratorService {documentId = doc.id;}+ const verifierConfig = {+ ...draft.verifierConfig,+ ...(draft.requiredEvidence ? { requiredEvidence: draft.requiredEvidence } : {}),+ };const criterion = await this.criterionModel.create({description: draft.description,documentId,onFail,required,title: draft.title,- verifierConfig: {},+ verifierConfig,verifierType,});@@ -210,7 +215,7 @@ export class VerifyPlanGeneratorService {sourceCriterionId: criterion.id,sourceRubricId: rubric.id,title: draft.title,- verifierConfig: {},+ verifierConfig,verifierType,});}@@ -283,6 +288,7 @@ export class VerifyPlanGeneratorService {description: c.description,instruction: c.instruction,onFail: c.onFail ?? 'manual',+ requiredEvidence: c.requiredEvidence,required: c.required ?? true,title: c.title,verifierType: c.verifierType,@@ -320,7 +326,10 @@ export class VerifyPlanGeneratorService {onFail: draft.onFail ?? 'manual',required: draft.required ?? true,title: draft.title,- verifierConfig: draft.verifierConfig ?? {},+ verifierConfig: {+ ...draft.verifierConfig,+ ...(draft.requiredEvidence ? { requiredEvidence: draft.requiredEvidence } : {}),+ },verifierType: draft.verifierType ?? 'llm',});ids.push(criterion.id);@@ -460,7 +469,7 @@ export class VerifyPlanGeneratorService {sourceCriterionId: null,sourceRubricId: null,title: c.title,- verifierConfig: {},+ verifierConfig: { requiredEvidence: c.requiredEvidence },verifierType: c.verifierType,};}),diff --git a/apps/server/src/services/verify/prompts.ts b/apps/server/src/services/verify/prompts.tsindex 136368dc979..81583e319b9 100644--- a/apps/server/src/services/verify/prompts.ts+++ b/apps/server/src/services/verify/prompts.ts@@ -1,9 +1,9 @@import type { VerifyCheckItem, VerifyEvidenceType } from '@lobechat/types';/** Bump when the plan-gen prompt meaningfully changes (tracing partition key). */-export const VERIFY_PLAN_PROMPT_VERSION = '1';+export const VERIFY_PLAN_PROMPT_VERSION = '2';/** Bump when the judge prompt meaningfully changes. */-export const VERIFY_JUDGE_PROMPT_VERSION = '1';+export const VERIFY_JUDGE_PROMPT_VERSION = '2';/** Bump when the report prompt meaningfully changes. */export const VERIFY_REPORT_PROMPT_VERSION = '1';@@ -27,7 +27,8 @@ export const buildPlanPrompt = ({'Given the run goal, propose a concise set of verification criteria — each a single pass/fail standard that determines whether the delivered work satisfies the user’s explicit requirements.','Guidelines:',`- Propose at most ${maxCriteria} criteria. Fewer, sharper criteria are better than many vague ones.`,- '- Choose verifierType: "llm" for qualitative judgment from artifacts/output; "agent" when active investigation (reading files, running checks) is needed; "program" only for strictly deterministic command checks.',+ '- First enumerate every deliverable and artifact needed to prove the criterion. Put each one in requiredEvidence with its type, semantic modality, source scope, and a concrete capture hint. Use [] only when the final text answer alone is sufficient.',+ '- Choose verifierType: "llm" only when all required evidence is inline text, or a single image modality that a multimodal judge can directly inspect. Choose "agent" whenever evidence spans multiple modalities/files, requires opening a document or attachment, exceeds a normal prompt, or needs active investigation. Choose "program" only for strictly deterministic command checks.','- Set required=true when failing the criterion must block delivery; false for nice-to-have improvements.','- Set onFail="auto_repair" when a failure can be fixed by re-running the agent with guidance; otherwise "manual".','- description: a one-sentence summary of what this criterion verifies.',@@ -50,12 +51,14 @@ export const buildPlanPrompt = ({/** One captured artifact, summarized for the judge. */export interface JudgeEvidence {+ /** Resolved, model-readable URL for supported inline media. */+ accessUrl?: string;content?: string | null;description?: string | null;/**- * Stored artifact id (screenshot / video / large text). The text prompt only- * references it by presence + caption; the agent verifier attaches the actual- * file to its run via `execAgent({ fileIds })` so it can SEE the artifact.+ * Stored artifact id (screenshot / video / large text). Inline judges must+ * load supported files into the actual model message; agent verifiers attach+ * every file to their isolated run.*/fileId?: string | null;type: VerifyEvidenceType;@@ -78,9 +81,11 @@ export const describeEvidence = (evidence: JudgeEvidence[] | undefined): stringif (!evidence?.length) return '';const lines = evidence.map((e) => {const caption = e.description ? ` — ${e.description}` : '';- // Inline text is quoted in full; a stored artifact (screenshot/gif/video) is- // referenced by presence + caption, which is itself supporting Data.- const payload = e.content ? `: ${e.content}` : ' [artifact captured]';+ const payload = e.content+ ? `: ${e.content}`+ : e.fileId+ ? ' [artifact attached to this judge request]'+ : ' [artifact metadata only; contents unavailable]';return ` - (${e.type})${caption}${payload}`;});return `\nEvidence captured during the run:\n${lines.join('\n')}`;@@ -102,7 +107,7 @@ export const buildJudgePrompt = ({ goal, deliverable, items, mode }: JudgePrompt'- counterEvidence: evidence pointing the other way, if any (the Rebuttal).','- limitation: what you could not verify and why (the Rebuttal).','- suggestion: a concrete fix when the verdict is failed/uncertain.',- 'Artifacts listed under "Evidence captured during the run" are primary Data — weight them above the deliverable prose. An entry marked "[artifact captured]" means the screenshot/recording was taken; treat its presence and caption as supporting Data for what it depicts.',+ 'Artifacts listed under "Evidence captured during the run" are primary Data only when their contents are attached or quoted. Never treat mere existence, a filename, or a caption as proof of what an artifact depicts.','Be skeptical: default to "uncertain" rather than "passed" when evidence is missing.',mode === 'batch'? 'Return one verdict object per criterion, each tagged with its exact checkItemId.'diff --git a/apps/server/src/services/verify/repairService.ts b/apps/server/src/services/verify/repairService.tsindex 28ad891e17d..b5bee57f4fa 100644--- a/apps/server/src/services/verify/repairService.ts+++ b/apps/server/src/services/verify/repairService.ts@@ -87,11 +87,13 @@ export const createRepairRunner = (params: {maxRepairRounds: number;model?: string | null;provider?: string | null;+ taskId?: string | null;topicId?: string | null;userId: string;workspaceId?: string;}): RepairSpawner | undefined => {- const { agentId, db, maxRepairRounds, model, provider, topicId, userId, workspaceId } = params;+ const { agentId, db, maxRepairRounds, model, provider, taskId, topicId, userId, workspaceId } =+ params;if (!agentId || !topicId) return undefined;return async ({ instruction, operationId, verifyMessageId }) => {@@ -118,6 +120,7 @@ export const createRepairRunner = (params: {prompt: instruction,...(provider ? { provider } : {}),suppressUserMessage: true,+ ...(taskId ? { taskId } : {}),userInterventionConfig: { approvalMode: 'headless' },});const repairOperationId = result.operationId;@@ -184,6 +187,12 @@ export const maybeAutoRepair = async (if (stillPending) return;const op = await operationModel.findById(operationId);+ let taskOperation = op;+ let taskDepth = 0;+ while (!taskOperation?.taskId && taskOperation?.parentOperationId && taskDepth < 10) {+ taskOperation = await operationModel.findById(taskOperation.parentOperationId);+ taskDepth += 1;+ }const spawner = createRepairRunner({agentId: op?.agentId,db,@@ -196,6 +205,7 @@ export const maybeAutoRepair = async (),model: op?.model,provider: op?.provider,+ taskId: taskOperation?.taskId,topicId: op?.topicId,userId,workspaceId,diff --git a/apps/server/src/services/verify/schema.ts b/apps/server/src/services/verify/schema.tsindex d23f57fd52e..87aacd2bc01 100644--- a/apps/server/src/services/verify/schema.ts+++ b/apps/server/src/services/verify/schema.ts@@ -7,6 +7,24 @@ import { z } from 'zod';const verifierTypeEnum = ['program', 'agent', 'llm'] as const;const onFailEnum = ['manual', 'auto_repair'] as const;+const evidenceTypeEnum = [+ 'screenshot',+ 'gif',+ 'video',+ 'text',+ 'markdown',+ 'dom_snapshot',+ 'transcript',+] as const;+const evidenceModalityEnum = ['audio', 'document', 'image', 'structured', 'text', 'video'] as const;+const evidenceScopeEnum = ['deliverable', 'run_evidence', 'task_artifacts'] as const;++const requiredEvidenceSchema = z.object({+ hint: z.string().optional(),+ modality: z.enum(evidenceModalityEnum).optional(),+ scope: z.enum(evidenceScopeEnum).optional(),+ type: z.enum(evidenceTypeEnum),+});/** Lenient parse of the AI plan-gen output; the service filters/normalizes. */export const RawGeneratedCriteriaSchema = z.object({@@ -15,6 +33,7 @@ export const RawGeneratedCriteriaSchema = z.object({description: z.string().optional(),instruction: z.string().optional(),onFail: z.enum(onFailEnum).optional(),+ requiredEvidence: z.array(requiredEvidenceSchema).optional(),required: z.boolean().optional(),title: z.string(),verifierType: z.enum(verifierTypeEnum),@@ -37,11 +56,33 @@ export const GENERATED_CRITERIA_JSON_SCHEMA: GenerateObjectSchema = {description: { maxLength: 280, type: 'string' },instruction: { type: 'string' },onFail: { enum: [...onFailEnum], type: 'string' },+ requiredEvidence: {+ items: {+ additionalProperties: false,+ properties: {+ hint: { type: 'string' },+ modality: { enum: [...evidenceModalityEnum], type: 'string' },+ scope: { enum: [...evidenceScopeEnum], type: 'string' },+ type: { enum: [...evidenceTypeEnum], type: 'string' },+ },+ required: ['type', 'modality', 'scope', 'hint'],+ type: 'object',+ },+ type: 'array',+ },required: { type: 'boolean' },title: { maxLength: 80, minLength: 1, type: 'string' },verifierType: { enum: [...verifierTypeEnum], type: 'string' },},- required: ['title', 'description', 'instruction', 'verifierType', 'required', 'onFail'],+ required: [+ 'title',+ 'description',+ 'instruction',+ 'verifierType',+ 'required',+ 'onFail',+ 'requiredEvidence',+ ],type: 'object',},maxItems: 8,diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex aff52fd4e7c..e05e9e1a292 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -996,9 +996,12 @@"taskDetail.acceptance.expandAll": "Expand all groups","taskDetail.acceptance.goal": "Acceptance goal","taskDetail.acceptance.loadError": "Could not load delivery acceptance.",+ "taskDetail.acceptance.multimodalLlm": "Multimodal LLM",+ "taskDetail.acceptance.requiredEvidence": "Required evidence","taskDetail.acceptance.retry": "Retry","taskDetail.acceptance.reviewError": "Could not save this review.","taskDetail.acceptance.title": "Delivery acceptance",+ "taskDetail.acceptance.verifier": "Verification method","taskDetail.activities": "Activities","taskDetail.activities.agentTag": "Agent","taskDetail.activities.fallback.brief": "posted a brief",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex 8f5a86c8807..45964ce2af5 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -996,9 +996,12 @@"taskDetail.acceptance.expandAll": "展开全部分组","taskDetail.acceptance.goal": "验收目标","taskDetail.acceptance.loadError": "交付验收加载失败。",+ "taskDetail.acceptance.multimodalLlm": "多模态 LLM",+ "taskDetail.acceptance.requiredEvidence": "所需证据","taskDetail.acceptance.retry": "重试","taskDetail.acceptance.reviewError": "复核结果保存失败。","taskDetail.acceptance.title": "交付验收",+ "taskDetail.acceptance.verifier": "验证方式","taskDetail.activities": "活动","taskDetail.activities.agentTag": "智能体","taskDetail.activities.fallback.brief": "发布了简要说明",diff --git a/packages/builtin-tool-lobe-delivery-checker/src/manifest.ts b/packages/builtin-tool-lobe-delivery-checker/src/manifest.tsindex cd4f7bc6bb7..6ed113f2e4b 100644--- a/packages/builtin-tool-lobe-delivery-checker/src/manifest.ts+++ b/packages/builtin-tool-lobe-delivery-checker/src/manifest.ts@@ -52,8 +52,40 @@ export const LobeDeliveryCheckerManifest: BuiltinToolManifest = {enum: ['manual', 'auto_repair'],type: 'string',},+ requiredEvidence: {+ description:+ 'Every artifact required to prove this check. Declare type, semantic modality, source scope, and a concrete capture hint. Use [] only when final text alone is sufficient.',+ items: {+ properties: {+ hint: { type: 'string' },+ modality: {+ enum: ['text', 'image', 'audio', 'video', 'document', 'structured'],+ type: 'string',+ },+ scope: {+ enum: ['deliverable', 'run_evidence', 'task_artifacts'],+ type: 'string',+ },+ type: {+ enum: [+ 'screenshot',+ 'gif',+ 'video',+ 'text',+ 'markdown',+ 'dom_snapshot',+ 'transcript',+ ],+ type: 'string',+ },+ },+ required: ['type', 'modality', 'scope', 'hint'],+ type: 'object',+ },+ type: 'array',+ },},- required: ['title', 'description', 'instruction'],+ required: ['title', 'description', 'instruction', 'requiredEvidence'],type: 'object',},type: 'array',diff --git a/packages/builtin-tool-lobe-delivery-checker/src/systemRole.ts b/packages/builtin-tool-lobe-delivery-checker/src/systemRole.tsindex 6ff3dc1cc63..f60a648ba8c 100644--- a/packages/builtin-tool-lobe-delivery-checker/src/systemRole.ts+++ b/packages/builtin-tool-lobe-delivery-checker/src/systemRole.ts@@ -2,10 +2,11 @@ export const systemPrompt = `<delivery_checker>For a task that produces a **deliverable** (writing code, editing files, producing a document or a multi-step result), call \`generateVerifyPlan\` **once at the start**, after you understand the request and before doing the substantive work.-Enumerate the concrete checks the deliverable must satisfy and pass them as \`criteria\` (one entry per check), with \`title\` set to the user's task/goal. Derive the criteria from the user's explicit requirements — **each requirement becomes one criterion**. For each criterion:+First enumerate all deliverables and associated artifacts that must be inspected. Then enumerate the concrete checks the deliverable must satisfy and pass them as \`criteria\` (one entry per check), with \`title\` set to the user's task/goal. Derive the criteria from the user's explicit requirements — **each requirement becomes one criterion**. For each criterion:- \`title\`: the single, concrete pass/fail standard (short).- \`instruction\`: a **detailed, fine-grained judging rubric** — the exact pass conditions, what counts as a fail, the concrete evidence the judge must find, and edge cases. Write it thoroughly, not a one-liner; the judge relies entirely on it.-- \`verifierType\`: \`llm\` (default) for qualitative judgement from the output; \`agent\` when the check needs active investigation (reading files, running checks).+- \`requiredEvidence\`: every required artifact with its evidence \`type\`, semantic \`modality\`, source \`scope\`, and a concrete capture \`hint\`. Use an empty array only when the final text response alone is sufficient.+- \`verifierType\`: \`llm\` only for inline text or a single image modality a multimodal judge can directly inspect; \`agent\` for documents, attachments, multiple files/modalities, large context, or active investigation.- \`required\`: \`true\` when the check must pass to deliver, \`false\` when it is optional/advisory.- The user reviews and confirms the proposed checks; on confirmation they are persisted and the checks run **automatically** when the operation completes. You do **not** run the checks yourself.diff --git a/packages/builtin-tool-lobe-delivery-checker/src/types.ts b/packages/builtin-tool-lobe-delivery-checker/src/types.tsindex 6bb1064364c..5e01901a682 100644--- a/packages/builtin-tool-lobe-delivery-checker/src/types.ts+++ b/packages/builtin-tool-lobe-delivery-checker/src/types.ts@@ -1,3 +1,5 @@+import type { RequiredEvidenceSpec } from '@lobechat/types';+export const LobeDeliveryCheckerIdentifier = 'lobe-delivery-checker';export const LobeDeliveryCheckerApiName = {@@ -32,6 +34,8 @@ export interface VerifyCriterionInput {onFail?: VerifyOnFailStrategy;/** Whether this check is required (must pass to deliver) vs optional. Defaults to true. */required?: boolean;+ /** Artifacts that must be captured and semantically inspected for this check. */+ requiredEvidence?: RequiredEvidenceSpec[];/** The short title of this check. */title: string;/** How this check is judged. Defaults to 'llm'. */diff --git a/packages/database/src/models/agent.ts b/packages/database/src/models/agent.tsindex 4e2b6fdff42..7261d4be1b2 100644--- a/packages/database/src/models/agent.ts+++ b/packages/database/src/models/agent.ts@@ -1346,12 +1346,24 @@ export class AgentModel {**/getBuiltinAgent = async (slug: string): Promise<AgentItem | null> => {+ const persistConfig = getAgentPersistConfig(slug);+// 1. First try to find existing agent by slugconst existing = await this.db.query.agents.findFirst({where: and(eq(agents.slug, slug), this.ownership()),});- if (existing) return normalizeInboxAgentMeta(existing, { slug: existing.slug });+ if (existing) {+ if (persistConfig?.chatConfig) {+ const [updated] = await this.db+ .update(agents)+ .set({ chatConfig: persistConfig.chatConfig })+ .where(eq(agents.id, existing.id))+ .returning();+ return normalizeInboxAgentMeta(updated ?? existing, { slug: existing.slug });+ }+ return normalizeInboxAgentMeta(existing, { slug: existing.slug });+ }// For inbox agent, it has special compatibility handling:// Historical inbox was stored as session with slug='inbox' and linked agent via agentsToSessions@@ -1380,7 +1392,6 @@ export class AgentModel {}// 3. Check if this is a known builtin agent- const persistConfig = getAgentPersistConfig(slug);if (!persistConfig) return null;// 4. Create the builtin agent with persist config.@@ -1403,6 +1414,7 @@ export class AgentModel {{ userId: this.userId, workspaceId: this.workspaceId },{agencyConfig: this.withWorkspaceSelectionPolicyDefaults(undefined),+ chatConfig: persistConfig.chatConfig,model: persistConfig.model,provider: persistConfig.provider,slug: persistConfig.slug,diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex 6392fb2c0c0..f607eb4881b 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -1180,9 +1180,12 @@ export default {'taskDetail.acceptance.expandAll': 'Expand all groups','taskDetail.acceptance.goal': 'Acceptance goal','taskDetail.acceptance.loadError': 'Could not load delivery acceptance.',+ 'taskDetail.acceptance.multimodalLlm': 'Multimodal LLM','taskDetail.acceptance.retry': 'Retry',+ 'taskDetail.acceptance.requiredEvidence': 'Required evidence','taskDetail.acceptance.reviewError': 'Could not save this review.','taskDetail.acceptance.title': 'Delivery acceptance',+ 'taskDetail.acceptance.verifier': 'Verification method','taskDetail.activities': 'Activities','taskDetail.activitiesEmpty': 'No activity yet','taskDetail.artifacts': 'Artifacts',diff --git a/packages/types/src/verify.ts b/packages/types/src/verify.tsindex 1afec93197f..45be1864b7f 100644--- a/packages/types/src/verify.ts+++ b/packages/types/src/verify.ts@@ -697,6 +697,10 @@ export interface ToulminVerdict {export interface RequiredEvidenceSpec {/** What the capturer should produce — guidance only, not validated. */hint?: string;+ /** Semantic medium the verifier must actually understand, not merely observe exists. */+ modality?: 'audio' | 'document' | 'image' | 'structured' | 'text' | 'video';+ /** Where the evidence is expected to come from. */+ scope?: 'deliverable' | 'run_evidence' | 'task_artifacts';/** The evidence medium that must be present for this criterion. */type: VerifyEvidenceType;}diff --git a/src/features/AgentTasks/AgentTaskDetail/PendingAcceptanceCheckList.tsx b/src/features/AgentTasks/AgentTaskDetail/PendingAcceptanceCheckList.tsxindex bc2589bc6f9..cf33fde3e48 100644--- a/src/features/AgentTasks/AgentTaskDetail/PendingAcceptanceCheckList.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/PendingAcceptanceCheckList.tsx@@ -5,6 +5,8 @@ import { createStaticStyles, cssVar } from 'antd-style';import { CircleDashed } from 'lucide-react';import { memo } from 'react';+import { shouldGroupChecks } from '@/features/Verify';+const styles = createStaticStyles(({ css }) => ({groupHeader: css`padding-block: 9px;@@ -48,43 +50,49 @@ interface PendingAcceptanceCheckListProps {/** The pre-run projection of Acceptance checks: same list grammar, pending verdicts. */export const PendingAcceptanceCheckList = memo<PendingAcceptanceCheckListProps>(- ({ groupLabel, items, onOpen }) => (- <Block className={styles.list} variant={'outlined'}>- <Flexbox horizontal align={'center'} className={styles.groupHeader} gap={8}>- <Text fontSize={12}>{groupLabel}</Text>- <Text fontSize={11} type={'secondary'}>- {items.length}- </Text>- </Flexbox>- {items.map((item, index) => (- <Flexbox- horizontal- align={'center'}- className={styles.row}- data-task-acceptance-criterion={item.id}- gap={10}- key={item.id}- role={'button'}- tabIndex={0}- onClick={() => onOpen(item)}- onKeyDown={(event) => {- if (event.key === 'Enter' || event.key === ' ') onOpen(item);- }}- >- <Icon- color={cssVar.colorTextQuaternary}- icon={CircleDashed}- size={16}- style={{ flex: 'none' }}- />- <span className={styles.seq}>C{index + 1}</span>- <Text ellipsis style={{ flex: 1, minWidth: 0 }}>- {item.title}- </Text>- </Flexbox>- ))}- </Block>- ),+ ({ groupLabel, items, onOpen }) => {+ const grouped = shouldGroupChecks(items.length);++ return (+ <Block className={styles.list} variant={'outlined'}>+ {grouped && (+ <Flexbox horizontal align={'center'} className={styles.groupHeader} gap={8}>+ <Text fontSize={12}>{groupLabel}</Text>+ <Text fontSize={11} type={'secondary'}>+ {items.length}+ </Text>+ </Flexbox>+ )}+ {items.map((item, index) => (+ <Flexbox+ horizontal+ align={'center'}+ className={styles.row}+ data-task-acceptance-criterion={item.id}+ gap={10}+ key={item.id}+ role={'button'}+ tabIndex={0}+ onClick={() => onOpen(item)}+ onKeyDown={(event) => {+ if (event.key === 'Enter' || event.key === ' ') onOpen(item);+ }}+ >+ <Icon+ color={cssVar.colorTextQuaternary}+ icon={CircleDashed}+ size={16}+ style={{ flex: 'none' }}+ />+ <span className={styles.seq}>C{index + 1}</span>+ <Text ellipsis style={{ flex: 1, minWidth: 0 }}>+ {item.title}+ </Text>+ </Flexbox>+ ))}+ </Block>+ );+ },);PendingAcceptanceCheckList.displayName = 'PendingAcceptanceCheckList';diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsxindex 032eb5eb420..342e2d289cb 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx@@ -89,13 +89,13 @@ vi.mock('@/features/Verify', () => ({<div data-testid="acceptance-check-detail">detail: {check.title}</div>),checkHeadMeta: () => ({ color: 'green', icon: () => null }),+ shouldGroupChecks: (checkCount: number) => checkCount > 10,groupChecks: (checks: Array<{ category: string }>) =>[...new Set(checks.map((check) => check.category))].map((category) => ({checks: checks.filter((check) => check.category === category),key: `category:${category}`,label: category,})),- shouldGroupChecks: (checkCount: number) => checkCount > 10,useAcceptanceBundle: () => ({data: mocks.bundle,error: undefined,@@ -162,7 +162,7 @@ describe('TaskAcceptance', () => {expect(mocks.subjectArgs).toEqual(['task', 'task-database-231']);});- it('renders pending criteria with the Acceptance check row grammar', () => {+ it('keeps a small pending checklist flat with the Acceptance check row grammar', () => {const onOpen = vi.fn();render(@@ -176,7 +176,7 @@ describe('TaskAcceptance', () => {/>,);- expect(screen.getByText('Ungrouped')).toBeInTheDocument();+ expect(screen.queryByText('Ungrouped')).not.toBeInTheDocument();expect(screen.getByText('C1')).toBeInTheDocument();expect(screen.getByText('C2')).toBeInTheDocument();expect(screen.queryByText('Agent')).not.toBeInTheDocument();@@ -186,6 +186,22 @@ describe('TaskAcceptance', () => {expect(onOpen).toHaveBeenCalledWith({ id: 'criterion-1', title: 'Word count' });});+ it('shows the pending checklist group only after it exceeds ten checks', () => {+ render(+ <PendingAcceptanceCheckList+ groupLabel={'Ungrouped'}+ items={Array.from({ length: 11 }, (_, index) => ({+ id: `criterion-${index + 1}`,+ title: `Check ${index + 1}`,+ }))}+ onOpen={vi.fn()}+ />,+ );++ expect(screen.getByText('Ungrouped')).toBeInTheDocument();+ expect(screen.getByText('Check 11')).toBeInTheDocument();+ });+it('keeps a small checklist flat and opens the selected check in the Acceptance portal', () => {mocks.acceptanceSubject = { id: 'acceptance-1' };mocks.bundle = {@@ -245,4 +261,25 @@ describe('TaskAcceptance', () => {expect(screen.getByText('Current check')).toBeInTheDocument();expect(screen.getByText('Removed check')).toBeInTheDocument();});++ it('groups a checklist only after it exceeds ten checks', () => {+ mocks.acceptanceSubject = { id: 'acceptance-1' };+ mocks.bundle = {+ acceptance: { id: 'acceptance-1', requirement: 'Everything is verifiable.' },+ checks: Array.from({ length: 11 }, (_, index) => ({+ category: index < 6 ? 'Setup' : 'Result',+ id: `c${index + 1}`,+ seq: index + 1,+ title: `Check ${index + 1}`,+ })),+ isOwner: true,+ };++ render(<TaskAcceptance />);++ expect(screen.getByText('Setup')).toBeInTheDocument();+ expect(screen.getByText('Result')).toBeInTheDocument();+ expect(screen.getByText('taskDetail.acceptance.collapseAll')).toBeInTheDocument();+ expect(screen.getByText('Check 11')).toBeInTheDocument();+ });});diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.tsxindex ca692d0f6c5..34be45672e8 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.tsx@@ -152,11 +152,11 @@ const TaskAcceptance = memo(() => {// count may grow when later rounds introduce checks; that history is part of// the delivery record rather than a mismatch with the original configuration.const checks = useMemo(() => bundle?.checks ?? [], [bundle?.checks]);- const grouped = shouldGroupChecks(checks.length);const requirement = resolveTaskAcceptanceRequirement(verify?.requirement,bundle?.acceptance.requirement,);+ const grouped = shouldGroupChecks(checks.length);const groups = useMemo(() =>grouped ? groupChecks(checks, t('acceptance.group.uncategorized', { ns: 'verify' })) : [],diff --git a/src/features/Portal/AcceptanceCheck/Body.test.tsx b/src/features/Portal/AcceptanceCheck/Body.test.tsxindex 7b9f7ae7804..6bce80edf5d 100644--- a/src/features/Portal/AcceptanceCheck/Body.test.tsx+++ b/src/features/Portal/AcceptanceCheck/Body.test.tsx@@ -12,12 +12,24 @@ const mocks = vi.hoisted(() => ({vi.mock('@lobehub/ui', () => ({Center: ({ children }: { children: ReactNode }) => <div>{children}</div>,Empty: () => <div />,- Flexbox: ({ children, className }: { children: ReactNode; className?: string }) => (- <div className={className} data-testid={className ? 'detail-surface' : undefined}>+ Flexbox: ({+ children,+ className,+ horizontal,+ }: {+ children: ReactNode;+ className?: string;+ horizontal?: boolean;+ }) => (+ <div+ className={className}+ data-testid={className ? 'detail-surface' : horizontal ? 'horizontal-flex' : undefined}+ >{children}</div>),Icon: () => <span data-testid={'check-state-icon'} />,+ Tag: ({ children }: { children: ReactNode }) => <span>{children}</span>,Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,}));@@ -58,7 +70,19 @@ vi.mock('@/features/Verify', () => ({useAcceptanceBundle: () => ({data: {acceptance: { id: 'acc-1' },- checks: [{ id: 'check-1', seq: 3, title: 'The result keeps its title' }],+ checks: [+ {+ id: 'check-1',+ planItem: {+ verifierConfig: {+ requiredEvidence: [{ type: 'markdown' }, { type: 'screenshot' }],+ },+ verifierType: 'agent',+ },+ seq: 3,+ title: 'The result keeps its title',+ },+ ],isOwner: true,},error: mocks.bundleError,@@ -90,6 +114,26 @@ describe('AcceptanceCheck Portal Body', () => {expect(screen.getByTestId('check-state-icon')).toBeInTheDocument();});+ it('shows how the task check is verified and which evidence media it requires', () => {+ render(<Body />);++ expect(screen.getByText('taskDetail.acceptance.verifier')).toBeInTheDocument();+ expect(screen.getByText('verifyConfig.verifierType.agent')).toBeInTheDocument();+ expect(screen.getByText('taskDetail.acceptance.multimodalLlm')).toBeInTheDocument();+ expect(screen.getByText('taskDetail.acceptance.requiredEvidence')).toBeInTheDocument();+ expect(screen.getByText('report.evidence.medium.markdown')).toBeInTheDocument();+ expect(screen.getByText('report.evidence.medium.screenshot')).toBeInTheDocument();+ expect(+ screen+ .getAllByTestId('horizontal-flex')+ .some(+ (element) =>+ element.textContent?.includes('taskDetail.acceptance.verifier') &&+ element.textContent.includes('taskDetail.acceptance.requiredEvidence'),+ ),+ ).toBe(true);+ });+it('offers an in-place retry when loading the selected check fails', () => {mocks.bundleError = new Error('network failed');diff --git a/src/features/Portal/AcceptanceCheck/Body.tsx b/src/features/Portal/AcceptanceCheck/Body.tsxindex c48d11cf19b..193b75e4e62 100644--- a/src/features/Portal/AcceptanceCheck/Body.tsx+++ b/src/features/Portal/AcceptanceCheck/Body.tsx@@ -1,6 +1,7 @@'use client';-import { Center, Empty, Flexbox, Icon, Text } from '@lobehub/ui';+import type { VerifyAgentPlanConfig } from '@lobechat/types';+import { Center, Empty, Flexbox, Icon, Tag, Text } from '@lobehub/ui';import { Button } from '@lobehub/ui/base-ui';import { App } from 'antd';import { createStaticStyles } from 'antd-style';@@ -27,7 +28,7 @@ const styles = createStaticStyles(({ css }) => ({}));const Body = memo(() => {- const { t } = useTranslation('chat');+ const { t } = useTranslation(['chat', 'verify']);const { message } = App.useApp();const portal = useChatStore(chatPortalSelectors.acceptanceCheckPortal);const openAcceptance = useChatStore((state) => state.openAcceptance);@@ -73,6 +74,10 @@ const Body = memo(() => {}const checkMeta = checkHeadMeta(check);+ const verifierType = check.planItem?.verifierType ?? check.result?.verifierType;+ const planConfig = (check.planItem?.verifierConfig ?? {}) as VerifyAgentPlanConfig;+ const requiredEvidence = planConfig.requiredEvidence ?? [];+ const usesMultimodalLlm = requiredEvidence.some((evidence) => evidence.type === 'screenshot');return (<Flexbox className={styles.body} gap={16}>@@ -82,6 +87,31 @@ const Body = memo(() => {C{check.seq} · {check.title}</Text></Flexbox>+ {(verifierType || requiredEvidence.length > 0) && (+ <Flexbox horizontal align={'center'} gap={16} wrap={'wrap'}>+ {verifierType && (+ <Flexbox horizontal align={'center'} gap={8}>+ <Text fontSize={12} type={'secondary'}>+ {t('taskDetail.acceptance.verifier')}+ </Text>+ <Tag>{t(`verifyConfig.verifierType.${verifierType}` as const)}</Tag>+ {usesMultimodalLlm && <Tag>{t('taskDetail.acceptance.multimodalLlm')}</Tag>}+ </Flexbox>+ )}+ {requiredEvidence.length > 0 && (+ <Flexbox horizontal align={'center'} gap={8} wrap={'wrap'}>+ <Text fontSize={12} type={'secondary'}>+ {t('taskDetail.acceptance.requiredEvidence')}+ </Text>+ {requiredEvidence.map((evidence) => (+ <Tag key={evidence.type}>+ {t(`report.evidence.medium.${evidence.type}` as const, { ns: 'verify' })}+ </Tag>+ ))}+ </Flexbox>+ )}+ </Flexbox>+ )}<FocusedCheckDetailscanReview={data.isOwner}check={check}diff --git a/src/features/Verify/Acceptance/CheckList.test.ts b/src/features/Verify/Acceptance/CheckList.test.tsindex 0dec2325f55..63e2af3680b 100644--- a/src/features/Verify/Acceptance/CheckList.test.ts+++ b/src/features/Verify/Acceptance/CheckList.test.ts@@ -5,6 +5,7 @@ import {checkFilterState,focusedCheckStates,groupChecks,+ isCheckWorkActionable,shouldGroupChecks,userReviewState,} from './CheckList';@@ -105,6 +106,30 @@ describe('userReviewState', () => {});});+describe('isCheckWorkActionable', () => {+ const withReview = (action?: 'accept' | 'ignore' | 'reject') =>+ ({+ userReview: action+ ? {+ action,+ createdAt: '2026-07-16T00:00:00.000Z',+ roundIndex: 1,+ stale: false,+ }+ : undefined,+ }) as AcceptanceCheck;++ it('keeps work available for pending and rejected checks', () => {+ expect(isCheckWorkActionable(withReview())).toBe(true);+ expect(isCheckWorkActionable(withReview('reject'))).toBe(true);+ });++ it('hides work for accepted and ignored checks', () => {+ expect(isCheckWorkActionable(withReview('accept'))).toBe(false);+ expect(isCheckWorkActionable(withReview('ignore'))).toBe(false);+ });+});+describe('checkFilterState', () => {const reject = (stale: boolean): AcceptanceCheck['userReview'] => ({action: 'reject',diff --git a/src/features/Verify/Acceptance/CheckList.tsx b/src/features/Verify/Acceptance/CheckList.tsxindex 869a03cb623..7344de61478 100644--- a/src/features/Verify/Acceptance/CheckList.tsx+++ b/src/features/Verify/Acceptance/CheckList.tsx@@ -90,6 +90,10 @@ export const userReviewState = (check: AcceptanceCheck): UserReviewState => {return review.stale ? 'pending' : 'rejected';};+/** Accepted and ignored checks are terminal — there is no remaining work to send back. */+export const isCheckWorkActionable = (check: AcceptanceCheck): boolean =>+ ['pending', 'rejected'].includes(userReviewState(check));+/** Every reviewable check in the group is user-accepted — settled business. */export const isGroupFullyAccepted = (checks: AcceptanceCheck[]): boolean => {const reviewable = checks.filter((check) => check.result);diff --git a/src/features/Verify/Acceptance/index.tsx b/src/features/Verify/Acceptance/index.tsxindex ca973c8ab73..9169a1b1bfe 100644--- a/src/features/Verify/Acceptance/index.tsx+++ b/src/features/Verify/Acceptance/index.tsx@@ -72,6 +72,7 @@ import CheckList, {focusedCheckStates,groupChecks,hasVisualEvidence,+ isCheckWorkActionable,isException,isGroupFullyAccepted,shouldGroupChecks,@@ -235,35 +236,51 @@ const styles = createStaticStyles(({ css }) => ({}`,focusLayout: css`+ overflow: ${acceptanceFocusedLayout.frameOverflow};display: grid;grid-template-columns: 320px minmax(0, 1fr);- min-height: ${acceptanceFocusedLayout.viewportHeight};++ width: 100%;+ height: ${acceptanceFocusedLayout.viewportHeight};+ min-height: 0;@media (width <= 900px) {grid-template-columns: 1fr;+ grid-template-rows: ${acceptanceFocusedLayout.compactOutlineHeight} minmax(0, 1fr);}`,focusOutline: css`- position: sticky;- inset-block-start: 0;-- overflow: auto;+ overflow: ${acceptanceFocusedLayout.frameOverflow};height: ${acceptanceFocusedLayout.viewportHeight};+ min-height: 0;padding: 8px;border-inline-end: 1px solid ${cssVar.colorBorderSecondary};background: ${cssVar.colorFillQuaternary};@media (width <= 900px) {- position: static;- height: auto;+ height: 100%;border-block-end: 1px solid ${cssVar.colorBorderSecondary};border-inline-end: 0;}`,+ focusOutlineList: css`+ overflow-y: ${acceptanceFocusedLayout.paneOverflow};+ overscroll-behavior: contain;+ min-height: 0;++ > * {+ flex-shrink: 0;+ }+ `,focusMain: css`+ overflow-y: ${acceptanceFocusedLayout.paneOverflow};+ overscroll-behavior: contain;+min-width: 0;+ height: ${acceptanceFocusedLayout.viewportHeight};+ min-height: 0;padding-block: ${acceptanceFocusedLayout.contentPaddingBlock};padding-inline: 32px;`,@@ -1097,14 +1114,24 @@ const AcceptancePage = memo<AcceptancePageProps>(onClick={() => setLedgerExpand(true)}/>)}- <Flexbox flex={1} style={{ minWidth: 0, overflow: 'auto' }}>+ <Flexbox+ flex={1}+ style={{+ minHeight: 0,+ minWidth: 0,+ overflow: focusedCheck ? acceptanceFocusedLayout.frameOverflow : 'auto',+ }}+ ><Flexbox+ flex={focusedCheck ? 1 : undefined}gap={16}paddingBlock={focusedCheck ? 0 : 20}paddingInline={focusedCheck ? 0 : 24}style={{+ height: focusedCheck ? '100%' : undefined,margin: focusedCheck ? 0 : '0 auto',maxWidth: focusedCheck ? 'none' : 920,+ minHeight: 0,width: '100%',}}>@@ -1380,7 +1407,7 @@ const AcceptancePage = memo<AcceptancePageProps>({focusedCheck ? (<div className={styles.focusLayout}><Flexbox className={styles.focusOutline}>- <Flexbox gap={10} paddingBlock={8} paddingInline={4}>+ <Flexbox flex={'none'} gap={10} paddingBlock={8} paddingInline={4}><Buttonicon={<Icon icon={ArrowLeft} />}size={'small'}@@ -1427,94 +1454,100 @@ const AcceptancePage = memo<AcceptancePageProps>()}</Flexbox></Flexbox>- {orderedChecks.map((check) => {- const state = checkFilterState(check);- const icon =- state === 'accepted'- ? BadgeCheck- : state === 'needsFix'- ? RotateCcw- : state === 'ignored'- ? Ban- : CircleDashed;- const color =- state === 'accepted'- ? 'success'- : state === 'needsFix'- ? 'error'- : state === 'ignored'- ? 'default'- : 'default';-- return (- <NavItem- active={check.id === focusedCheck.id}- key={check.id}- paddingBlock={acceptanceFocusedLayout.outlineItemPaddingBlock}- paddingInline={acceptanceFocusedLayout.outlineItemPaddingInline}- title={check.title}- titleColor={cssVar.colorText}- description={- <Flexbox horizontal align={'center'} gap={8}>- <Tag color={color} icon={<Icon icon={icon} />} size={'small'}>- {t(`acceptance.focus.state.${state}`)}- </Tag>- <Text fontSize={12} type={'secondary'}>- {t('acceptance.focus.evidenceCount', {- count: check.evidence.length,- })}- </Text>- </Flexbox>- }- extra={- <Icon color={cssVar.colorTextQuaternary} icon={ChevronRight} size={14} />- }- slots={{- titlePrefix: (- <Flexbox- align={'center'}- height={22}- style={{ alignSelf: 'flex-start' }}- >- <Text- style={{- color: cssVar.colorTextQuaternary,- fontFamily: cssVar.fontFamilyCode,- fontSize: 11,- }}- >- C{check.seq}- </Text>- </Flexbox>- ),- }}- onClick={() => setFocusedCheck(check.id)}- />- );- })}- {unverifiedStandingChecks.length > 0 && (- <Flexbox gap={4} paddingBlock={8} paddingInline={8}>- <Text fontSize={11} type={'secondary'}>- {t('acceptance.checkCreate.pendingGroup')}- </Text>- {unverifiedStandingChecks.map((item) => (+ <Flexbox className={styles.focusOutlineList} flex={1}>+ {orderedChecks.map((check) => {+ const state = checkFilterState(check);+ const icon =+ state === 'accepted'+ ? BadgeCheck+ : state === 'needsFix'+ ? RotateCcw+ : state === 'ignored'+ ? Ban+ : CircleDashed;+ const color =+ state === 'accepted'+ ? 'success'+ : state === 'needsFix'+ ? 'error'+ : state === 'ignored'+ ? 'default'+ : 'default';++ return (<NavItem- extra={<Icon color={cssVar.colorTextQuaternary} icon={PencilLine} />}- key={item.id}+ active={check.id === focusedCheck.id}+ key={check.id}paddingBlock={acceptanceFocusedLayout.outlineItemPaddingBlock}paddingInline={acceptanceFocusedLayout.outlineItemPaddingInline}- title={item.name}+ title={check.title}titleColor={cssVar.colorText}description={- <Text fontSize={12} type={'secondary'}>- {item.method || t('acceptance.checkCreate.pendingDescription')}- </Text>+ <Flexbox horizontal align={'center'} gap={8}>+ <Tag color={color} icon={<Icon icon={icon} />} size={'small'}>+ {t(`acceptance.focus.state.${state}`)}+ </Tag>+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.focus.evidenceCount', {+ count: check.evidence.length,+ })}+ </Text>+ </Flexbox>+ }+ extra={+ <Icon+ color={cssVar.colorTextQuaternary}+ icon={ChevronRight}+ size={14}+ />}- onClick={() => handleEditStandingCheck(item)}+ slots={{+ titlePrefix: (+ <Flexbox+ align={'center'}+ height={22}+ style={{ alignSelf: 'flex-start' }}+ >+ <Text+ style={{+ color: cssVar.colorTextQuaternary,+ fontFamily: cssVar.fontFamilyCode,+ fontSize: 11,+ }}+ >+ C{check.seq}+ </Text>+ </Flexbox>+ ),+ }}+ onClick={() => setFocusedCheck(check.id)}/>- ))}- </Flexbox>- )}+ );+ })}+ {unverifiedStandingChecks.length > 0 && (+ <Flexbox gap={4} paddingBlock={8} paddingInline={8}>+ <Text fontSize={11} type={'secondary'}>+ {t('acceptance.checkCreate.pendingGroup')}+ </Text>+ {unverifiedStandingChecks.map((item) => (+ <NavItem+ extra={<Icon color={cssVar.colorTextQuaternary} icon={PencilLine} />}+ key={item.id}+ paddingBlock={acceptanceFocusedLayout.outlineItemPaddingBlock}+ paddingInline={acceptanceFocusedLayout.outlineItemPaddingInline}+ title={item.name}+ titleColor={cssVar.colorText}+ description={+ <Text fontSize={12} type={'secondary'}>+ {item.method || t('acceptance.checkCreate.pendingDescription')}+ </Text>+ }+ onClick={() => handleEditStandingCheck(item)}+ />+ ))}+ </Flexbox>+ )}+ </Flexbox></Flexbox><Flexbox className={styles.focusMain}>@@ -1600,25 +1633,27 @@ const AcceptancePage = memo<AcceptancePageProps>({t(`acceptance.focus.verifierDescription.${focusedStates.verifierLabel}`)}</Text></Flexbox>- {isOwner && acceptance.status !== 'closed' && (- <Flexbox horizontal align={'center'} className={styles.focusWork} gap={16}>- <Flexbox flex={1} gap={3}>- <Text strong>{t('acceptance.checkWork.title')}</Text>- <Text fontSize={12} type={'secondary'}>- {t('acceptance.checkWork.description')}- </Text>+ {isOwner &&+ acceptance.status !== 'closed' &&+ isCheckWorkActionable(focusedCheck) && (+ <Flexbox horizontal align={'center'} className={styles.focusWork} gap={16}>+ <Flexbox flex={1} gap={3}>+ <Text strong>{t('acceptance.checkWork.title')}</Text>+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.checkWork.description')}+ </Text>+ </Flexbox>+ <Button+ loading={checkWorkPending}+ type={'primary'}+ onClick={handleCheckWork}+ >+ {origin?.topic || isEmbedded+ ? t('acceptance.checkWork.action')+ : t('acceptance.checkWork.copy')}+ </Button></Flexbox>- <Button- loading={checkWorkPending}- type={'primary'}- onClick={handleCheckWork}- >- {origin?.topic || isEmbedded- ? t('acceptance.checkWork.action')- : t('acceptance.checkWork.copy')}- </Button>- </Flexbox>- )}+ )}<FocusedCheckDetailscanReview={isOwner}check={focusedCheck}diff --git a/src/features/Verify/Acceptance/layout.test.ts b/src/features/Verify/Acceptance/layout.test.tsindex 4e30749ad20..891c87e46c5 100644--- a/src/features/Verify/Acceptance/layout.test.ts+++ b/src/features/Verify/Acceptance/layout.test.ts@@ -7,6 +7,12 @@ describe('acceptanceFocusedLayout', () => {expect(acceptanceFocusedLayout.viewportHeight).toBe('100%');});+ it('keeps the frame fixed while each master-detail pane owns its scrolling', () => {+ expect(acceptanceFocusedLayout.frameOverflow).toBe('hidden');+ expect(acceptanceFocusedLayout.paneOverflow).toBe('auto');+ expect(acceptanceFocusedLayout.compactOutlineHeight).toBe('min(36%, 320px)');+ });+it('keeps deliberate reading space above and below focused check content', () => {expect(acceptanceFocusedLayout.contentPaddingBlock).toBe('32px 24px');});diff --git a/src/features/Verify/Acceptance/layout.ts b/src/features/Verify/Acceptance/layout.tsindex 225cdc7e60c..4a02fb54e26 100644--- a/src/features/Verify/Acceptance/layout.ts+++ b/src/features/Verify/Acceptance/layout.ts@@ -1,7 +1,10 @@export const acceptanceFocusedLayout = {+ compactOutlineHeight: 'min(36%, 320px)',contentPaddingBlock: '32px 24px',+ frameOverflow: 'hidden',headerGap: 8,outlineItemPaddingBlock: 10,outlineItemPaddingInline: 8,+ paneOverflow: 'auto',viewportHeight: '100%',} as const;