π€― 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
β¨ feat(acceptance): send a rejected delivery back to its authoring agent (#19896)
Arvin Xu0df710def034
diff --git a/apps/cli/src/commands/verifyAcceptance.ts b/apps/cli/src/commands/verifyAcceptance.tsindex 1903c92c841..8d6ea326710 100644--- a/apps/cli/src/commands/verifyAcceptance.ts+++ b/apps/cli/src/commands/verifyAcceptance.ts@@ -499,6 +499,28 @@ export function registerAcceptanceCommands(parent: Command, options?: { deprecatreturn;}console.log(`${pc.red('β')} Delivery rejected (${result.id}) β next round re-opens it`);+ const dispatch = result.repairDispatch;+ if (dispatch?.dispatched) {+ console.log(+ `${pc.green('β»')} Sent back to agent ${dispatch.agentId} in topic ${dispatch.topicId} (operation ${dispatch.operationId})`,+ );+ } else if (dispatch?.reason === 'failed') {+ console.log(+ `${pc.yellow('!')} Repair dispatch failed: ${dispatch.error ?? 'unknown error'}`,+ );+ } else if (dispatch?.reason === 'goal_coordinator') {+ console.log(pc.dim('Goal task β its coordinator starts the next attempt.'));+ } else {+ const why =+ dispatch?.reason === 'forbidden'+ ? 'Not allowed to run the source agent'+ : 'No source agent to send it back to';+ console.log(+ pc.dim(+ `${why} β hand the repair over with: lh acceptance feedback ${result.id} --actionable`,+ ),+ );+ }});// The canonical `lh acceptance init` + `lh acceptance run β¦` tree hangs off thediff --git a/apps/server/src/routers/lambda/__tests__/acceptance.reject.test.ts b/apps/server/src/routers/lambda/__tests__/acceptance.reject.test.tsindex b4b69b13573..f912b39400f 100644--- a/apps/server/src/routers/lambda/__tests__/acceptance.reject.test.ts+++ b/apps/server/src/routers/lambda/__tests__/acceptance.reject.test.ts@@ -2,11 +2,15 @@import { randomUUID } from 'node:crypto';import type { LobeChatDatabase } from '@lobechat/database';-import { acceptances, verifyRuns } from '@lobechat/database/schemas';+import { acceptances, agents, topics, verifyRuns } from '@lobechat/database/schemas';import { getTestDB } from '@lobechat/database/test-utils';import { eq } from 'drizzle-orm';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import type * as RbacPermissionModule from '@/business/server/trpc-middlewares/rbacPermission';+import type * as AcceptanceModelModule from '@/database/models/acceptance';+import type * as GoalModelModule from '@/database/models/goal';+import { acceptanceRouter } from '../acceptance';import { cleanupTestUser, createTestContext, createTestUser } from './integration/setup';@@ -15,6 +19,60 @@ vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: () => serverDB }));vi.mock('@/server/workflows/expertiseRejection', () => ({ExpertiseRejectionWorkflow: { trigger: vi.fn() },}));+const mockExecAgent = vi.fn();+vi.mock('@/server/services/aiAgent', () => ({+ AiAgentService: vi.fn().mockImplementation(function () {+ return { execAgent: mockExecAgent };+ }),+}));++const flags = vi.hoisted(() => ({+ denyMessageCreate: false,+ failRepairingStamp: false,+ goalOwnsTask: false,+}));+// OSS stubs the RBAC gate; stand in for Cloud's `message:create` check.+vi.mock('@/business/server/trpc-middlewares/rbacPermission', async (importOriginal) => {+ const actual = await importOriginal<typeof RbacPermissionModule>();+ const { trpc } = await import('@/libs/trpc/lambda/init');+ const { TRPCError } = await import('@trpc/server');+ return {+ ...actual,+ withScopedPermission: (action: string) =>+ trpc.middleware(async (opts) => {+ if (action === 'message:create' && flags.denyMessageCreate) {+ throw new TRPCError({ code: 'FORBIDDEN' });+ }+ return opts.next();+ }),+ };+});+vi.mock('@/database/models/goal', async (importOriginal) => {+ const actual = await importOriginal<typeof GoalModelModule>();+ class GoalModel extends actual.GoalModel {+ constructor(...args: ConstructorParameters<typeof actual.GoalModel>) {+ super(...args);+ const original = this.findByGraphTask;+ this.findByGraphTask = async (taskId) =>+ flags.goalOwnsTask ? ({ id: 'goal_1' } as any) : original(taskId);+ }+ }+ return { ...actual, GoalModel };+});+vi.mock('@/database/models/acceptance', async (importOriginal) => {+ const actual = await importOriginal<typeof AcceptanceModelModule>();+ class AcceptanceModel extends actual.AcceptanceModel {+ constructor(...args: ConstructorParameters<typeof actual.AcceptanceModel>) {+ super(...args);+ const original = this.updateStatus;+ this.updateStatus = async (id, status) => {+ if (flags.failRepairingStamp && status === 'repairing') throw new Error('db down');+ return original(id, status);+ };+ }+ }+ return { ...actual, AcceptanceModel };+});describe('acceptanceRouter reject', () => {let userId: string;@@ -49,10 +107,155 @@ describe('acceptanceRouter reject', () => {});afterEach(async () => {+ mockExecAgent.mockReset();+ flags.denyMessageCreate = false;+ flags.failRepairingStamp = false;+ flags.goalOwnsTask = false;await cleanupTestUser(serverDB, strangerId);await cleanupTestUser(serverDB, userId);});+ const seedOrigin = async (origin: { agentId?: string; topicId: string }) => {+ await serverDB.update(verifyRuns).set({ metadata: { origin } }).where(eq(verifyRuns.id, runId));+ };++ const seedTopic = async () => {+ const [agent] = await serverDB+ .insert(agents)+ .values({ title: 'Delivery Bot', userId })+ .returning();+ const [topic] = await serverDB+ .insert(topics)+ .values({ agentId: agent.id, title: 'Delivery', userId })+ .returning();+ return { agentId: agent.id, topicId: topic.id };+ };++ describe('repair dispatch', () => {+ it('sends the delivery back to the authoring agent and marks it repairing', async () => {+ const { agentId, topicId } = await seedTopic();+ // The origin may omit the agent β the topic's own agent is used.+ await seedOrigin({ topicId });+ mockExecAgent.mockResolvedValue({ operationId: 'op_repair' });++ const caller = acceptanceRouter.createCaller(createTestContext(userId));+ const result = await caller.reject({ comment: 'Tab title missing', id: acceptanceId });++ expect(result.repairDispatch).toEqual({+ agentId,+ dispatched: true,+ operationId: 'op_repair',+ topicId,+ });+ expect(result.status).toBe('repairing');+ expect(mockExecAgent).toHaveBeenCalledWith(+ expect.objectContaining({+ agentId,+ appContext: { topicId },+ prompt: expect.stringContaining(`lh acceptance feedback ${acceptanceId} --actionable`),+ }),+ );+ const [run] = await serverDB.select().from(verifyRuns).where(eq(verifyRuns.id, runId));+ expect(run.decisionDetail?.comment).toBe('Tab title missing');+ });++ it('only records the reject when the rounds name no authoring conversation', async () => {+ const caller = acceptanceRouter.createCaller(createTestContext(userId));+ const result = await caller.reject({ id: acceptanceId });++ expect(result.repairDispatch).toEqual({ dispatched: false, reason: 'no_origin' });+ expect(result.status).toBe('rejected');+ expect(mockExecAgent).not.toHaveBeenCalled();+ });++ it('does not dispatch when the caller opts out', async () => {+ const { topicId } = await seedTopic();+ await seedOrigin({ topicId });++ const caller = acceptanceRouter.createCaller(createTestContext(userId));+ const result = await caller.reject({ dispatch: false, id: acceptanceId });++ expect(result.repairDispatch).toEqual({ dispatched: false, reason: 'skipped' });+ expect(result.status).toBe('rejected');+ expect(mockExecAgent).not.toHaveBeenCalled();+ });++ it('keeps the reject when the origin topic no longer exists', async () => {+ await seedOrigin({ topicId: 'tpc_gone' });++ const caller = acceptanceRouter.createCaller(createTestContext(userId));+ const result = await caller.reject({ id: acceptanceId });++ expect(result.repairDispatch).toEqual({ dispatched: false, reason: 'origin_unavailable' });+ expect(result.status).toBe('rejected');+ expect(mockExecAgent).not.toHaveBeenCalled();+ });++ it('does not start the agent for a caller without conversation-write permission', async () => {+ const { topicId } = await seedTopic();+ await seedOrigin({ topicId });+ flags.denyMessageCreate = true;++ const caller = acceptanceRouter.createCaller(createTestContext(userId));+ const result = await caller.reject({ id: acceptanceId });++ expect(result.repairDispatch).toEqual({ dispatched: false, reason: 'forbidden' });+ expect(result.status).toBe('rejected');+ expect(mockExecAgent).not.toHaveBeenCalled();+ });++ it('leaves a Goal Task to its coordinator', async () => {+ const { topicId } = await seedTopic();+ await seedOrigin({ topicId });+ await serverDB+ .update(acceptances)+ .set({ subjectId: 'task_goal', subjectType: 'task' })+ .where(eq(acceptances.id, acceptanceId));+ flags.goalOwnsTask = true;++ const caller = acceptanceRouter.createCaller(createTestContext(userId));+ const result = await caller.reject({ id: acceptanceId });++ expect(result.repairDispatch).toEqual({ dispatched: false, reason: 'goal_coordinator' });+ expect(result.status).toBe('rejected');+ expect(mockExecAgent).not.toHaveBeenCalled();+ });++ it('still reports the dispatch when the repairing stamp fails after the run started', async () => {+ const { agentId, topicId } = await seedTopic();+ await seedOrigin({ topicId });+ mockExecAgent.mockResolvedValue({ operationId: 'op_repair' });+ flags.failRepairingStamp = true;++ const caller = acceptanceRouter.createCaller(createTestContext(userId));+ const result = await caller.reject({ id: acceptanceId });++ expect(result.repairDispatch).toEqual({+ agentId,+ dispatched: true,+ operationId: 'op_repair',+ topicId,+ });+ expect(mockExecAgent).toHaveBeenCalledTimes(1);+ });++ it('reports a failed agent start without undoing the reject', async () => {+ const { topicId } = await seedTopic();+ await seedOrigin({ topicId });+ mockExecAgent.mockRejectedValue(new Error('device offline'));++ const caller = acceptanceRouter.createCaller(createTestContext(userId));+ const result = await caller.reject({ id: acceptanceId });++ expect(result.repairDispatch).toEqual({+ dispatched: false,+ error: 'Failed to trigger agent: device offline',+ reason: 'failed',+ });+ expect(result.status).toBe('rejected');+ });+ });+it.each([undefined, '', ' ', ' Add dark mode evidence '])('returns the delivery and records the optional reason (%j)',async (comment) => {diff --git a/apps/server/src/routers/lambda/_helpers/acceptanceRepairDispatch.ts b/apps/server/src/routers/lambda/_helpers/acceptanceRepairDispatch.tsnew file mode 100644index 00000000000..803f398af1f--- /dev/null+++ b/apps/server/src/routers/lambda/_helpers/acceptanceRepairDispatch.ts@@ -0,0 +1,121 @@+import { buildAcceptanceRepairPrompt } from '@lobechat/prompts';+import { TRPCError } from '@trpc/server';+import debug from 'debug';++import { GoalModel } from '@/database/models/goal';+import { TopicModel } from '@/database/models/topic';+import type { AcceptanceItem } from '@/database/schemas/verify';+import type { LobeChatDatabase } from '@/database/type';+import type { AcceptanceService } from '@/server/services/verify';++import { agentNotifyRouter } from '../agentNotify';++const log = debug('lobe-server:acceptance-repair-dispatch');++/**+ * What a reject did beyond recording the decision.+ * - `no_origin`: the rounds carry no authoring conversation (e.g. an ingested+ * report) β the reviewer hands the repair prompt over by hand.+ * - `origin_unavailable`: the conversation is gone, not the caller's, or has no+ * agent to run.+ * - `forbidden`: the caller may review the delivery but not write to the+ * conversation or run its agent.+ * - `goal_coordinator`: a Goal Task β its coordinator starts the next attempt.+ * - `failed`: the agent could not be started; the reject itself still stands.+ */+export type AcceptanceRepairDispatch =+ | { agentId: string; dispatched: true; operationId: string; topicId: string }+ | {+ dispatched: false;+ error?: string;+ reason:+ | 'failed'+ | 'forbidden'+ | 'goal_coordinator'+ | 'no_origin'+ | 'origin_unavailable'+ | 'skipped';+ };++/** The caller's request context β handed to `agentNotify.notify` unchanged. */+type DispatchContext = Exclude<+ Parameters<typeof agentNotifyRouter.createCaller>[0],+ (...args: never[]) => unknown+> & { serverDB: LobeChatDatabase; userId: string; workspaceId?: string | null };++/**+ * Send a rejected delivery back to the agent that authored it: the repair+ * prompt becomes a user message in the origin topic and the agent runs.+ *+ * The send goes through `agentNotify.notify` itself rather than a copy of its+ * side effect, so it carries the same gates β the conversation-write+ * permission (`message:create`), the workspace agent-use ACL and the caller's+ * own topic scope. A reviewer who may manage the acceptance but not run its+ * agent gets `forbidden` / `origin_unavailable` and falls back to the prompt.+ *+ * Best-effort by design: the reject is already recorded, so a dispatch failure+ * is reported, never thrown.+ */+export const dispatchAcceptanceRepair = async (+ ctx: DispatchContext,+ service: AcceptanceService,+ acceptance: AcceptanceItem,+): Promise<AcceptanceRepairDispatch> => {+ // A Goal Task's next attempt belongs to its coordinator, which reads the+ // rejected round through the prompt builder and claims the task. A plain+ // run in the old topic would race it into a second, unaccounted attempt.+ if (acceptance.subjectType === 'task') {+ const goal = await new GoalModel(+ ctx.serverDB,+ acceptance.userId,+ acceptance.workspaceId ?? undefined,+ ).findByGraphTask(acceptance.subjectId);+ if (goal) return { dispatched: false, reason: 'goal_coordinator' };+ }++ const origin = await service.findRepairOrigin(acceptance.id);+ if (!origin?.topicId) return { dispatched: false, reason: 'no_origin' };++ const topic = await new TopicModel(+ ctx.serverDB,+ ctx.userId,+ ctx.workspaceId ?? undefined,+ ).findOwnTopicById(origin.topicId);+ const agentId = origin.agentId ?? topic?.agentId ?? undefined;+ if (!topic || !agentId) return { dispatched: false, reason: 'origin_unavailable' };++ let operationId: string | undefined;+ try {+ ({ operationId } = await agentNotifyRouter.createCaller(ctx).notify({+ agentId,+ content: buildAcceptanceRepairPrompt(acceptance.id),+ role: 'user',+ topicId: topic.id,+ }));+ } catch (error) {+ if (error instanceof TRPCError && error.code === 'FORBIDDEN') {+ return { dispatched: false, reason: 'forbidden' };+ }+ console.error('[acceptance] repair dispatch failed for %s: %O', acceptance.id, error);+ return {+ dispatched: false,+ error: error instanceof Error ? error.message : String(error),+ reason: 'failed',+ };+ }+ if (!operationId) {+ return { dispatched: false, error: 'The agent run did not start', reason: 'failed' };+ }++ // The run is live from here: a failed `repairing` stamp must not read as a+ // failed dispatch, or the caller would retry into a duplicate run. The+ // aggregate converges when the repair round lands.+ try {+ await service.acceptanceModel.updateStatus(acceptance.id, 'repairing');+ } catch (error) {+ console.error('[acceptance] marking %s repairing failed: %O', acceptance.id, error);+ }++ log('acceptance %s sent back to agent %s in topic %s', acceptance.id, agentId, topic.id);+ return { agentId, dispatched: true, operationId, topicId: topic.id };+};diff --git a/apps/server/src/routers/lambda/acceptance.ts b/apps/server/src/routers/lambda/acceptance.tsindex b0670233f98..0f2eccd35df 100644--- a/apps/server/src/routers/lambda/acceptance.ts+++ b/apps/server/src/routers/lambda/acceptance.ts@@ -46,6 +46,10 @@ import {} from '@/server/services/verify';import { after } from '@/server/utils/scheduleAfterResponse';+import {+ type AcceptanceRepairDispatch,+ dispatchAcceptanceRepair,+} from './_helpers/acceptanceRepairDispatch';import { canManageAcceptance, filterManageableAcceptances } from './_helpers/acceptanceWriteScope';import { assertWorkspaceRowManageable } from './_helpers/assertWorkspaceRowManageable';@@ -1213,16 +1217,44 @@ export const acceptanceRouter = router({/*** The user rejects the delivery. An optional comment is a re-tasking input: it is* recorded on the current round's decision and seeds the next repair/verify- * round (spawned by the runtime for agent rounds, or by the next- * `lh verify ingest-report` for harness rounds).+ * round. When the rounds name an authoring conversation, the delivery is sent+ * straight back to that agent and the acceptance moves to `repairing`; the+ * outcome rides on `repairDispatch` so every surface (UI, CLI, external+ * callers) reports the same thing. Without one the caller hands the repair+ * prompt over itself.*/reject: acceptanceWriteProcedure- .input(z.object({ comment: z.string().trim().max(2000).optional(), id: z.string() }))- .mutation(async ({ ctx, input }) => {- const { acceptance, service } = await resolveAcceptanceForWrite(ctx, input.id);+ .input(+ z.object({+ comment: z.string().trim().max(2000).optional(),+ /**+ * Send the delivery back to the agent that authored it (default). Pass+ * `false` to only record the decision β the caller hands the repair+ * prompt over itself.+ */+ dispatch: z.boolean().optional(),+ id: z.string(),+ }),+ )+ .mutation(+ async ({+ ctx,+ input,+ }): Promise<AcceptanceItem & { repairDispatch: AcceptanceRepairDispatch }> => {+ const { acceptance, service } = await resolveAcceptanceForWrite(ctx, input.id);++ const rejected = await service.reject(acceptance.id, input.comment || undefined);+ if (input.dispatch === false) {+ return { ...rejected, repairDispatch: { dispatched: false, reason: 'skipped' } };+ }- return service.reject(acceptance.id, input.comment || undefined);- }),+ const repairDispatch = await dispatchAcceptanceRepair(ctx, service, acceptance);+ if (!repairDispatch.dispatched) return { ...rejected, repairDispatch };++ const current = await service.acceptanceModel.findById(acceptance.id);+ return { ...(current ?? rejected), repairDispatch };+ },+ ),/*** Rename the acceptance in the caller's list β a display-title override keptdiff --git a/apps/server/src/services/verify/acceptanceService.ts b/apps/server/src/services/verify/acceptanceService.tsindex 5cdcd67ab22..cd6d8bcbe9b 100644--- a/apps/server/src/services/verify/acceptanceService.ts+++ b/apps/server/src/services/verify/acceptanceService.ts@@ -926,9 +926,9 @@ export class AcceptanceService {/*** The user rejects the delivery. An optional comment is a re-tasking input: it is* recorded on the round's decision detail, where the next repair/verify round- * picks it up. (Spawning the repair run itself is the runtime's job β for- * agent-bound rounds via the repair pipeline, for ingested rounds via the- * next `lh verify ingest-report`.)+ * picks it up. (Spawning the repair run is the caller's job β the+ * `acceptance.reject` procedure sends it back to the origin agent when the+ * rounds name one; see `dispatchAcceptanceRepair`.)** A Goal Task is no exception: its next attempt is started by the Goal* coordinator on the following tick, which reads the rejected round's@@ -1425,6 +1425,21 @@ export class AcceptanceService {return { agent, topic };};+ /**+ * The raw authoring conversation behind the latest round that recorded one β+ * the ids a rejected delivery is sent back to. Unlike {@link resolveOrigin}+ * nothing is hydrated: the dispatcher re-reads the topic under the caller's+ * own scope.+ */+ findRepairOrigin = async (+ acceptanceId: string,+ ): Promise<{ agentId?: string; topicId?: string } | null> => {+ const runs = await this.runModel.listByAcceptance(acceptanceId);+ const origin = [...runs].reverse().find((run) => run.metadata?.origin)?.metadata?.origin;+ if (!origin?.topicId) return null;+ return { agentId: origin.agentId || undefined, topicId: origin.topicId };+ };+/** The rounds + their per-round data the bundle and the union both read. */loadRounds = async (acceptanceId: string) => {const runs = await this.runModel.listByAcceptance(acceptanceId);diff --git a/packages/prompts/src/prompts/verify/index.ts b/packages/prompts/src/prompts/verify/index.tsindex c2d2bec4d44..f5b36a07594 100644--- a/packages/prompts/src/prompts/verify/index.ts+++ b/packages/prompts/src/prompts/verify/index.ts@@ -84,3 +84,15 @@ ${deliverable}`## Your taskInvestigate whether the deliverable satisfies this check, judging against the run goal and the judging instruction. Weight the captured evidence above as primary Data; gather more yourself only where it's missing or insufficient. When done, call \`submitVerifyResult\` exactly once with checkItemId="${checkItem.id}" and your verdict (passed / failed / uncertain) plus evidence and reasoning.`;++/**+ * The send-back prompt for a rejected delivery. It points the agent at the CLI+ * as the source of truth, so neither the reviewer nor the dispatcher has to+ * hand-summarize evidence and feedback.+ */+export const buildAcceptanceRepairPrompt = (acceptanceId: string) =>+ `Use the LobeHub CLI to read the latest review feedback for acceptance ${acceptanceId}:++lh acceptance feedback ${acceptanceId} --actionable++Every entry it prints (per-check comments, circled-region annotations on the evidence screenshots, and attachments) is the full set of feedback to handle this round. Fix the code item by item; then re-run verification and ingest the new result back into the SAME acceptance (reuse the existing check ids, and use supersedes for any check whose meaning changed). Keep the final report in the same language the previous rounds used.`;diff --git a/src/features/Acceptance/Viewer/Checks/checkWork.ts b/src/features/Acceptance/Viewer/Checks/checkWork.tsdeleted file mode 100644index 11106b76540..00000000000--- a/src/features/Acceptance/Viewer/Checks/checkWork.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * The repair prompt points the agent at the CLI as the source of truth, so the- * reviewer does not have to hand-summarize evidence and feedback.- */-export const buildRepairPrompt = (acceptanceId: string) =>- `Use the LobeHub CLI to read the latest review feedback for acceptance ${acceptanceId}:--lh acceptance feedback ${acceptanceId} --actionable--Every entry it prints (per-check comments, circled-region annotations on the evidence screenshots, and attachments) is the full set of feedback to handle this round. Fix the code item by item; then re-run verification and ingest the new result back into the SAME acceptance (reuse the existing check ids, and use supersedes for any check whose meaning changed). Keep the final report in the same language the previous rounds used.`;diff --git a/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx b/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsxindex 19f7986ead6..6df8cf89f88 100644--- a/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx+++ b/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx@@ -1,5 +1,6 @@'use client';+import { buildAcceptanceRepairPrompt } from '@lobechat/prompts';import { copyToClipboard, Flexbox } from '@lobehub/ui';import { Button, Text, toast } from '@lobehub/ui/base-ui';import dayjs from 'dayjs';@@ -14,7 +15,6 @@ import { verifyService } from '@/services/verify';import { useAcceptanceScope } from '../AcceptanceScope';import { checkFilterState, isException } from '../Checks/checkState';-import { buildRepairPrompt } from '../Checks/checkWork';import { useAcceptanceComments } from '../Comments/hooks';import { flowPlanPhase } from '../Plan/planReview';import { acceptanceCheckPath } from '../routes';@@ -182,7 +182,7 @@ const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {}};- const repairPrompt = buildRepairPrompt(acceptance.id);+ const repairPrompt = buildAcceptanceRepairPrompt(acceptance.id);return (<>@@ -234,7 +234,19 @@ const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {onRejectComment={() =>openRejectModal({onConfirm: (comment) =>- runAction(() => verifyService.rejectDelivery(acceptance.id, comment)),+ runAction(async () => {+ // The server sends the delivery back to its authoring agent when+ // the rounds name one β say so, since the reject itself is quiet.+ const { repairDispatch } = await verifyService.rejectDelivery(+ acceptance.id,+ comment,+ );+ if (repairDispatch.dispatched) {+ toast.success({ placement: 'top', title: t('acceptance.bar.rerunSent') });+ } else if (repairDispatch.reason === 'failed') {+ toast.error(repairDispatch.error ?? t('acceptance.actionError'));+ }+ }),})}onRerun={async () => {