Ассистент: дедупликация обращений в ИТ, закрытие осиротевших запусков при старте; предложение к промтам
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,8 +6,8 @@ import { createLogger, createTestDb, testDatabaseUrl, type TestDb } from "khb_co
|
||||
import { ClaudeError, type ClaudeCall, type ClaudeResult } from "./agents/cli-runner.js";
|
||||
import { KeyedMutex, Semaphore } from "./agents/pool.js";
|
||||
import { parseSections } from "./agents/sections.js";
|
||||
import { AgentFailure, runManagerAgent, type AgentContext } from "./agents/session.js";
|
||||
import { runStep2 } from "./agents/step2.js";
|
||||
import { AgentFailure, closeOrphanRuns, runManagerAgent, type AgentContext } from "./agents/session.js";
|
||||
import { runStep2, saveProblems } from "./agents/step2.js";
|
||||
import { handleManagerMessages } from "./slack/chat.js";
|
||||
import { DriveInbox } from "./slack/drive-inbox.js";
|
||||
import { SlackIntake } from "./slack/intake.js";
|
||||
@@ -226,6 +226,26 @@ d("консольные агенты (временная БД, фейковый
|
||||
const log = await db.pool.query("select message_ts, status, sender_slack_user_id as sender from slack_message_log where message_ts like '1.%' order by message_ts");
|
||||
expect(log.rows).toEqual([{ message_ts: "1.2", status: "done", sender: "UOTHER" }, { message_ts: "1.5", status: "done", sender: "ULLMTEST" }, { message_ts: "1.6", status: "done", sender: "ULLMTEST" }]);
|
||||
});
|
||||
it("обращения в ИТ: повтор не отправляется, изменённый текст идёт как обновление; осиротевшие запуски закрываются при старте", async () => {
|
||||
it_messages.length = 0;
|
||||
await db.pool.query("delete from agent_problem_log where manager_person_id = $1 and severity = 'it_request'", [MGR]);
|
||||
const c = ctx();
|
||||
const sec = (t: string) => new Map([["обращение в ит", t]]);
|
||||
await saveProblems(c, MGR, "step4", sec("llmtest применить даты A"));
|
||||
await saveProblems(c, MGR, "step4", sec("llmtest применить даты A")); // тот же текст - пропуск
|
||||
await saveProblems(c, MGR, "step4", sec("llmtest применить даты A и B")); // изменился - обновление
|
||||
expect(it_messages).toHaveLength(2);
|
||||
expect(it_messages[0]).toContain("Обращение агента в ИТ");
|
||||
expect(it_messages[1]).toContain("ОБНОВЛЕНИЕ");
|
||||
const rows = await db.pool.query("select count(*)::int as n from agent_problem_log where manager_person_id = $1 and severity = 'it_request' and body like 'llmtest%'", [MGR]);
|
||||
expect(rows.rows[0].n).toBe(2);
|
||||
|
||||
await db.pool.query("insert into agent_run (manager_person_id, step, status, started_at) values ($1,'step4','running', now() - interval '3 hours')", [MGR]);
|
||||
expect(await closeOrphanRuns(c)).toBeGreaterThanOrEqual(1);
|
||||
const st = await db.pool.query("select status, error from agent_run where manager_person_id = $1 and error like '%осиротевший%'", [MGR]);
|
||||
expect(st.rows[0].status).toBe("failed");
|
||||
expect(it_messages.at(-1)).toContain("осиротевших");
|
||||
});
|
||||
it("проектный канал: проект задан каналом, huddle принимается, чужой бот игнорируется", async () => {
|
||||
calls = [];
|
||||
const posted: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user