PEP-248: решение по ошибке из продукта записывается до задачи; тест триажа сверяет итог после сообщения
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9084a6a8ed
commit
a7fb69ad5f
@ -133,10 +133,11 @@ async function execute(
|
||||
await sendIncidentMessage(db, row, { kind: "ask", note: limitNote });
|
||||
return row;
|
||||
}
|
||||
// The decision goes first: whoever sees the incident with its task sees the decision too.
|
||||
await updateIncident(db, i.id, base);
|
||||
const ref = await createBugTask(db, i, by, by === "triage" ? reason : null);
|
||||
let row = await updateIncident(db, i.id, base);
|
||||
const started = action === "start" ? await startBugTask(db, ref, o) : false;
|
||||
row = await getIncident(db, i.id);
|
||||
const row = await getIncident(db, i.id);
|
||||
await sendIncidentMessage(db, row, { kind: "task", task: ref, started, reason: by === "triage" ? reason : null });
|
||||
return row;
|
||||
}
|
||||
|
||||
@ -308,13 +308,15 @@ describe("Политика инцидентов проекта", () => {
|
||||
triage({ rules: [{ match: "PaymentError", action: "start", confidence: 0.92, reason: "падает оплата — по правилам сразу в работу" }] });
|
||||
const c = await connected({ policy: "triage", triagePrompt: prompt });
|
||||
await bugsink.capture(c.api, { type: "PaymentError", value: "card declined handler crashed", environment: "prod", release: "a1b2c3", frames: [{ filename: "billing/pay.ts", function: "pay", lineno: 3 }] });
|
||||
await waitIncident(c, "PaymentError: card declined handler crashed", (x) => x.status === "task");
|
||||
// The message is the last step of the decision: after it the incident and the task are final.
|
||||
const m = await waitPm("PaymentError: card declined", (x) => /Агент взялся/.test(x.text));
|
||||
const i = await waitIncident(c, "PaymentError: card declined handler crashed", (x) => x.status === "task");
|
||||
assert.equal(i.decidedBy, "triage");
|
||||
assert.equal(i.decision, "start");
|
||||
const t = (await tasksOf(c)).find((x) => x.id === i.taskId)!;
|
||||
assert.equal(t.status, "in_progress");
|
||||
assert.match(t.description!, /Решение триажёра: падает оплата — по правилам сразу в работу/);
|
||||
const m = await waitPm("PaymentError: card declined", (x) => /Агент взялся/.test(x.text));
|
||||
assert.match(m.text, /🤖 Триажёр: падает оплата/);
|
||||
const call = triageLog().at(-1);
|
||||
assert.equal(call.pmRules, prompt);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user