PEP-235: статус «ждёт одобрения» ставится до вопроса — быстрый ответ PM не затирается
All checks were successful
peppa/lint lint: success за 2с
peppa/typecheck typecheck: success за 52с
peppa/build build: success за 36с
peppa/bundle bundle: success за 0с
peppa/test test: success за 1768с
peppa-ci / ci (pull_request) Successful in 32m3s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
peppa-bot 2026-11-30 11:53:37 +00:00
parent c43ab6d44b
commit ec658ad23a

View File

@ -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(() => {});