feat: implement workerStart notifications for tick pickups and enhance tick handling

This commit is contained in:
Lauren ten Hoor
2026-02-10 23:14:12 +08:00
parent 41caa13050
commit ff83c25e8c
6 changed files with 107 additions and 27 deletions

View File

@@ -12,6 +12,7 @@
import { execFile } from "node:child_process";
import { promisify } from "node:util";
import { log as auditLog } from "./audit.js";
import type { TickAction } from "./services/tick.js";
const execFileAsync = promisify(execFile);
@@ -226,6 +227,43 @@ export async function notify(
return sendMessage(target, message, channel, opts.workspaceDir);
}
/**
* Send workerStart notifications for each tick pickup.
*
* Called after projectTick() returns pickups — callers pass the array
* so each dispatched task gets a visible start notification in the project group.
*/
export async function notifyTickPickups(
pickups: TickAction[],
opts: {
workspaceDir: string;
config?: NotificationConfig;
channel?: string;
},
): Promise<void> {
for (const pickup of pickups) {
await notify(
{
type: "workerStart",
project: pickup.project,
groupId: pickup.groupId,
issueId: pickup.issueId,
issueTitle: pickup.issueTitle,
issueUrl: pickup.issueUrl,
role: pickup.role,
tier: pickup.tier,
sessionAction: pickup.sessionAction,
},
{
workspaceDir: opts.workspaceDir,
config: opts.config,
groupId: pickup.groupId,
channel: opts.channel,
},
);
}
}
/**
* Get notification config from plugin config.
*/