refactor: replace autoChain with projectTick queue scanning

Remove hard-coded auto-chain dispatch (DEV done→QA, QA fail→DEV) and
replace with a general-purpose projectTick service that scans the queue
and fills free worker slots after every state transition.

- Create lib/services/tick.ts: consolidates shared helpers and core
  projectTick() function from duplicated code in work-start/auto-pickup
- work_finish: replaces auto-chain block with projectTick call
- work_start: adds projectTick after dispatch to fill parallel slots
- auto_pickup: delegates per-project loop to projectTick
- Remove autoChain from Project type, migration code, and project-register
- Remove scheduling config dependency from work_finish
- Net -112 lines: simpler, self-healing pipeline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lauren ten Hoor
2026-02-10 21:46:11 +08:00
parent d7178bb8e5
commit 55b062ac76
8 changed files with 246 additions and 171 deletions

View File

@@ -22,7 +22,6 @@ export type Project = {
deployUrl: string;
baseBranch: string;
deployBranch: string;
autoChain: boolean;
/** Messaging channel for this project's group (e.g. "telegram", "whatsapp", "discord", "slack"). Stored at registration time. */
channel?: string;
/** Project-level role execution: parallel (DEV+QA can run simultaneously) or sequential (only one role at a time). Default: parallel */
@@ -132,9 +131,6 @@ export async function readProjects(workspaceDir: string): Promise<ProjectsData>
project.qa = project.qa
? migrateWorkerState(project.qa as unknown as Record<string, unknown>)
: emptyWorkerState([]);
if (project.autoChain === undefined) {
project.autoChain = false;
}
if (!project.channel) {
project.channel = "telegram";
}