Отключённые проекты: агент не общается и не пишет по проектам с is_enabled=false; тест; docs
All checks were successful
ci / test (push) Successful in 18s
ci / deploy (push) Successful in 1m24s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 14:11:20 +03:00
parent 03abdfb1b8
commit ea57029bc0
3 changed files with 32 additions and 2 deletions

View File

@@ -147,6 +147,25 @@ d("консольные агенты (временная БД, фейковый
expect(run.rows[0].changes).toContain("createDailyLog");
});
it("отключённый проект: агенту сказано не общаться по нему, запись в него не разрешена", async () => {
calls = [];
await db.pool.query("update assistant_project set is_enabled = false where jt_job_id = 'llmtest-job'");
await db.pool.query("insert into assistant_project (jt_job_id, manager_person_id, mode, is_enabled) values ('llmtest-job-on',$1,'test',true)", [MGR]);
try {
script = [ok("## Ответ менеджеру\n(без ответа)\n## Память\nм\n## Изменения JobTread\nнет")];
const deps = { ctx: ctx(), timezone: "America/New_York", slack: { postMessage: async () => true, fileInfo: async () => null, download: async () => 0 } };
const mgr = { personId: MGR, name: "llmtest-Manager", slackUserId: "ULLMTEST", slackChannelId: "CLLMTEST" };
await handleManagerMessages({ ...deps, dryPublish: true }, mgr, [{ channel: "CLLMTEST", ts: "1791741200.000001", text: "про отключённый", fileIds: [] }]);
const p = calls[0]!.prompt;
expect(p).toContain("ОТКЛЮЧЁННЫЕ проекты");
expect(p).toContain("(llmtest-job)");
expect(p).toContain("Запись в JobTread запрещена");
} finally {
await db.pool.query("delete from assistant_project where jt_job_id = 'llmtest-job-on'");
await db.pool.query("update assistant_project set is_enabled = true where jt_job_id = 'llmtest-job'");
}
});
it("событие ассистента: напоминание пишется в историю, ответ менеджера закрывает его; через followup агент спрашивает `что-то ещё`", async () => {
calls = [];
const posted: string[] = [];