Агенты: нет задач у менеджера - шаг 2 не запускается, напоминания и обращения в ИТ не пишутся (deviations п.75)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,7 @@ export interface ProjectOutcome {
|
||||
packageId?: string;
|
||||
items?: number;
|
||||
changedSinceMorning?: boolean | null;
|
||||
agent?: "ok" | "failed" | "not_needed" | "dry_run";
|
||||
agent?: "ok" | "failed" | "not_needed" | "dry_run" | "no_tasks";
|
||||
error?: string;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ export async function runPrepJob(deps: PrepDeps, job: PrepJob, opts: { projectId
|
||||
);
|
||||
|
||||
const outcomes: ProjectOutcome[] = [];
|
||||
const byManager = new Map<string, { name: string; packageIds: string[]; outcomes: ProjectOutcome[] }>();
|
||||
const byManager = new Map<string, { name: string; packageIds: string[]; outcomes: ProjectOutcome[]; tasks: number }>();
|
||||
for (const pr of projects as { id: string; jt_job_id: string; jt_membership_id: string; manager_id: string; manager_name: string }[]) {
|
||||
const out: ProjectOutcome = { assistantProjectId: pr.id, jtJobId: pr.jt_job_id };
|
||||
try {
|
||||
@@ -90,8 +90,9 @@ export async function runPrepJob(deps: PrepDeps, job: PrepJob, opts: { projectId
|
||||
if (!needAgent) out.agent = "not_needed";
|
||||
else if (opts.dryRun) out.agent = "dry_run";
|
||||
else {
|
||||
const g = byManager.get(pr.manager_id) ?? { name: pr.manager_name, packageIds: [], outcomes: [] };
|
||||
const g = byManager.get(pr.manager_id) ?? { name: pr.manager_name, packageIds: [], outcomes: [], tasks: 0 };
|
||||
g.packageIds.push(pkg.id);
|
||||
g.tasks += items.filter((i) => i.input_no !== 7).length;
|
||||
g.outcomes.push(out);
|
||||
byManager.set(pr.manager_id, g);
|
||||
}
|
||||
@@ -104,6 +105,12 @@ export async function runPrepJob(deps: PrepDeps, job: PrepJob, opts: { projectId
|
||||
// шаги 2-3: один консольный агент на менеджера (параллельно, ограничено пулом agent.gate)
|
||||
await Promise.all(
|
||||
[...byManager.entries()].map(async ([managerId, g]) => {
|
||||
if (!g.tasks) {
|
||||
// нет работ и todo во входах (1)-(5): список не строим (память не заменяет данные), менеджеру не пишем, обращение в ИТ не нужно
|
||||
deps.log.info({ managerId, manager: g.name }, "у менеджера нет задач во входах - шаг 2 пропущен");
|
||||
for (const o of g.outcomes) o.agent = "no_tasks";
|
||||
return;
|
||||
}
|
||||
const r = await runStep2(deps.agent, managerId, g.name, g.packageIds, today);
|
||||
for (const o of g.outcomes) {
|
||||
o.agent = r.status;
|
||||
|
||||
Reference in New Issue
Block a user