Wake CEO-hired agents via heartbeat so delegated tasks run autonomously

The queue worker now also enqueues one run per actionable assigned task of a
heartbeat-enabled agent with an enabled provider and no run yet, so after the
CEO hires and delegates, its reports start their tasks on their own. Each task
is enqueued at most once. The team-building prompt is now scoped to managers
(no manager) with an empty team, so reports execute their task instead.
This commit is contained in:
ZacharyZhang-NY committed 2026-05-29 21:12:09 -04:00
1 parent 0575712e02
commit 61f2162236
3 files changed
+85 -4

No files matched your search

@@ -48,8 +48,14 @@ export function startTaskQueueWorker(input: TaskQueueWorkerInput): () => void {
if (running) return;
running = true;
try {
const enqueued = input.connection.transaction(() => taskExecution.enqueueHeartbeatRuns());
const claimed = claimNextQueuedRun(input.connection);
if (!claimed) return;
if (!claimed) {
if (enqueued.length > 0 && !input.mainWindow.isDestroyed()) {
input.mainWindow.webContents.send(IPC_CHANNELS.rendererEvent, { type: "snapshot-changed" });
}
return;
}
try {
await taskExecution.executeRun(claimed.org_id, claimed.id);
} catch {