diff --git a/.peppa/memory/pep-318.md b/.peppa/memory/pep-318.md
new file mode 100644
index 00000000..f61f9c20
--- /dev/null
+++ b/.peppa/memory/pep-318.md
@@ -0,0 +1,7 @@
+# Память: PEP-318
+
+## Соглашения
+- «Принять всё» (PEP-318) — только очередь: `startAcceptAll` + `processAcceptQueue` (runner/accept-queue.ts; `accept.queue:`, ход `accept.run:`, аренда `accept.worker:` 3 мин), веб — через `after()`, вачдог — `acceptQueueTick`. Синхронный `acceptAll` в вебе не звать. Медленный Gitea в тесте — `MockGitea.delayMs`.
+
+## Грабли
+- В песочнице без tmux тесты приёмки падают «spawn tmux ENOENT», а на Node 22 висят по 25 с: нужны оба — tmux из .deb bookworm и Node 26 (`nodejs.org/dist/index.json` → tarball в /tmp).
diff --git a/apps/web/app/(app)/actions.ts b/apps/web/app/(app)/actions.ts
index 45cf48aa..e483a3b3 100644
--- a/apps/web/app/(app)/actions.ts
+++ b/apps/web/app/(app)/actions.ts
@@ -74,9 +74,10 @@ import { attachmentLabel, fixFeedback, linkAttachments, linkFeedback, parseAttac
import { deleteProject, decideProposals, mergeProposals, connectAndGrantAccessRequest, denyAccessRequestAndTell, grantAccessRequestByButton, grantAccessRequestFromExisting, decideDeferred } from "@peppa/runner";
import { bugsinkFromEnv } from "@peppa/bugsink";
import { loadEnv } from "@peppa/shared";
-import { pauseProject, resumeProject, acceptAll, acceptStory, autoPublish, fixStory, confirmTaskDecision, changeTaskDecision, undoSplit, budgetChanged, resolveTaskById, deployProd, bugsinkWebhookBase, connectErrorTracking, decideIncident, resolveIncident, acceptTask, answerAndDeliver, grantRepoAccess, moveTask, provisionProjectOnce, projectNamespace, setProjectVisibility, shareProject, unshareProject, type BoardColumn, resumeSession, sendToSession, syncSessionAttachments, startSession, stopSession, type Provider, startFreeRunner, renameRunner, promoteRunner, queueTaskOnRunner, managesProject, saveAgentsMd, cancelOwnLogin, finishOwnClaudeLogin, connectOwnSubscription, removeOwnSubscription, type OwnSubscriptionKind, chooseSharedSubscription, requestSubscription } from "@peppa/runner";
+import { pauseProject, resumeProject, startAcceptAll, processAcceptQueue, acceptStory, autoPublish, fixStory, confirmTaskDecision, changeTaskDecision, undoSplit, budgetChanged, resolveTaskById, deployProd, bugsinkWebhookBase, connectErrorTracking, decideIncident, resolveIncident, acceptTask, answerAndDeliver, grantRepoAccess, moveTask, provisionProjectOnce, projectNamespace, setProjectVisibility, shareProject, unshareProject, type BoardColumn, resumeSession, sendToSession, syncSessionAttachments, startSession, stopSession, type Provider, startFreeRunner, renameRunner, promoteRunner, queueTaskOnRunner, managesProject, saveAgentsMd, cancelOwnLogin, finishOwnClaudeLogin, connectOwnSubscription, removeOwnSubscription, type OwnSubscriptionKind, chooseSharedSubscription, requestSubscription } from "@peppa/runner";
import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";
+import { after } from "next/server";
import { asWebActor, requireUser, words } from "@/lib/auth";
import { db } from "@/lib/db";
import { getT } from "@/lib/i18n";
@@ -211,8 +212,9 @@ export async function acceptStoryAction(f: FormData) {
}
/**
- * PEP-209: «Принять» / «Принять всё» on the acceptance page — one by one, a failure of one doesn't
- * stop the others; the page shows the result («Принято 6, на доработке 1…»).
+ * PEP-209: «Принять» / «Принять всё» on the acceptance page. PEP-318: the decision is queued and
+ * the page answers at once; the stories are accepted one by one in the background (after the
+ * answer here, else by the watchdog), the page shows the progress and the result.
*/
export async function acceptAllAction(f: FormData) {
const user = asWebActor(await requireUser());
@@ -227,8 +229,10 @@ export async function acceptAllAction(f: FormData) {
if (ref.task.status === "review") refs.push(ref);
}
if (!refs.length) throw new PeppaError(m("Принимать нечего: задачи уже приняты или вернулись в работу"));
- const r = await acceptAll(db, refs, "web");
- return `${base}?ok=${r.accepted.length}&pending=${r.pending.length}&failed=${r.failed.length}`;
+ startAcceptAll(db, refs, user.id, "web");
+ const projectId = refs[0]!.project.id;
+ after(() => processAcceptQueue(db, projectId).catch(() => 0));
+ return base;
});
}
diff --git a/apps/web/app/(app)/p/[key]/accept/page.tsx b/apps/web/app/(app)/p/[key]/accept/page.tsx
index 9843ee62..4d7ef62b 100644
--- a/apps/web/app/(app)/p/[key]/accept/page.tsx
+++ b/apps/web/app/(app)/p/[key]/accept/page.tsx
@@ -1,6 +1,6 @@
import Link from "@/components/Link";
import { notFound } from "next/navigation";
-import { acceptAllSummary, acceptScreen, type AcceptItem } from "@peppa/core";
+import { acceptAllSummary, acceptRunLine, acceptScreen, type AcceptItem } from "@peppa/core";
import { acceptAllAction, fixStoryAction } from "@/app/(app)/actions";
import { Empty, Flash, Key, Notice, PageHeader } from "@/components/common";
import { LiveRefresh } from "@/components/LiveRefresh";
@@ -32,7 +32,8 @@ export default async function AcceptPage({ params, searchParams }: { params: Pro
if (!p) notFound();
const screen = await acceptScreen(db, p);
const back = `/p/${p.key}/accept`;
- const all = screen.groups.flatMap((g) => g.items);
+ // PEP-318: stories already queued are not offered again.
+ const all = screen.groups.flatMap((g) => g.items).filter((it) => !it.queued);
const done = sp.ok != null ? { accepted: Number(sp.ok) || 0, pending: Number(sp.pending) || 0, failed: Number(sp.failed) || 0 } : null;
return (
@@ -42,13 +43,20 @@ export default async function AcceptPage({ params, searchParams }: { params: Pro
{screen.total ? t("Работа, которая ждёт вашего решения: посмотрите и примите или напишите, что поправить.") : t("Принимать пока нечего: агенты пришлют задачи, когда работа будет готова.")}
- {done && (
+ {screen.run ? (
+ // PEP-318: «Принять всё» goes on in the background — its progress, then its result.
- {t.text(acceptAllSummary(done))}
- {screen.liveUrl && done.accepted + done.pending > 0 && (
+ {t.text(acceptRunLine(screen.run))}
+ {screen.liveUrl && screen.run.finishedAt && screen.run.accepted.length + screen.run.pending.length > 0 && (
{t("Открыть продукт")} →
)}
+ ) : (
+ done && (
+
+ {t.text(acceptAllSummary(done))}
+
+ )
)}
{screen.total > 0 && (
@@ -58,32 +66,34 @@ export default async function AcceptPage({ params, searchParams }: { params: Pro
{t("Открыть версию для проверки")}
)}
-
-
- {t("Принять всё · {n}", { n: all.length })}
-
-
-
+ {all.length > 0 && (
+
+
+ {t("Принять всё · {n}", { n: all.length })}
+
+
+
+ )}
)}
- {screen.total === 0 && !done && {t("Задач на приёмке нет.")}}
+ {screen.total === 0 && !done && !screen.run && {t("Задач на приёмке нет.")}}
{screen.groups.map((g) => (
@@ -115,6 +125,7 @@ async function AcceptCard({ it, back }: { it: AcceptItem; back: string }) {
{t("Не принялась: {reason}", { reason: t.text(it.failed) })}
)}
+ {it.queued && !it.pending && {t("Принимается — дождитесь, страница обновится сама.")}
}
{it.pending && {t("Вы уже приняли — изменения обновляются, задача закроется сама.")}
}
{it.shots.length > 0 ? (
// Scrolls sideways on a phone: one page per screen, «было» above «стало».
@@ -141,7 +152,7 @@ async function AcceptCard({ it, back }: { it: AcceptItem; back: string }) {
{t("Открыть в версии для проверки")} →
)}
- {!it.pending && (
+ {!it.pending && !it.queued && (