From ec658ad23a77661a4e92ee6e02f5a512ce6ee6b1 Mon Sep 17 00:00:00 2001 From: peppa-bot Date: Mon, 30 Nov 2026 11:53:37 +0000 Subject: [PATCH] =?UTF-8?q?PEP-235:=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81?= =?UTF-8?q?=20=C2=AB=D0=B6=D0=B4=D1=91=D1=82=20=D0=BE=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=B8=D1=8F=C2=BB=20=D1=81=D1=82=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D1=82=D1=81=D1=8F=20=D0=B4=D0=BE=20=D0=B2=D0=BE=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=81=D0=B0=20=E2=80=94=20=D0=B1=D1=8B=D1=81=D1=82?= =?UTF-8?q?=D1=80=D1=8B=D0=B9=20=D0=BE=D1=82=D0=B2=D0=B5=D1=82=20PM=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=B7=D0=B0=D1=82=D0=B8=D1=80=D0=B0=D0=B5=D1=82?= =?UTF-8?q?=D1=81=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- packages/core/src/tasks.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/tasks.ts b/packages/core/src/tasks.ts index 0eded9cf..3c5be9b7 100644 --- a/packages/core/src/tasks.ts +++ b/packages/core/src/tasks.ts @@ -361,13 +361,13 @@ export async function askPm(db: Db, ref: TaskRef, { topic, head, details, ...q } // PEP-154: no service text (tags, command output, paths) in what the person reads. const original = q.text; q = { ...q, text: messageText(q.kind, q.text) }; + // The status goes BEFORE the question: an answer that comes at once (it moves the story on) + // must not be overwritten by a late «awaiting approval» (cjm «rejected proposal» raced here). + if (q.kind === "approval") await updateTask(db, ref, { status: "awaiting_approval" }, q.sessionId); // PEP-151: the same state of the story again refreshes the earlier message instead of adding one. const row = await raiseOnce(db, { projectId: ref.project.id, taskId: ref.task.id, sessionId: q.sessionId ?? null, kind: q.kind, text: q.text, options: q.options, topic, head }, async () => { return insertQuestion(db, { projectId: ref.project.id, taskId: ref.task.id, ...q, msgType: q.msgType ?? defaultMessageType(q) }, details); }); - // The status goes right after the question: an answer that comes at once (it moves the story - // on) must not be overwritten by a late «awaiting approval». - if (q.kind === "approval") await updateTask(db, ref, { status: "awaiting_approval" }, q.sessionId); // PEP-152: the details follow the message (a refreshed one gets the fresh details). if (details !== undefined) await setMessageDetails(db, row.id, details); await keepQuestionDetails(db, row.id, original, q.text).catch(() => {});