kantban-cli 0.1.7 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-ZCUIGFSP.js +4111 -0
- package/dist/chunk-ZCUIGFSP.js.map +1 -0
- package/dist/context-7YDNTI3P.js +30 -0
- package/dist/context-7YDNTI3P.js.map +1 -0
- package/dist/cron-OKQP6QDF.js +112 -0
- package/dist/cron-OKQP6QDF.js.map +1 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +179 -44
- package/dist/index.js.map +1 -1
- package/dist/pipeline-HTGCXNPL.js +4049 -0
- package/dist/pipeline-HTGCXNPL.js.map +1 -0
- package/dist/pipeline-init-IGZZOOLK.js +103 -0
- package/dist/pipeline-init-IGZZOOLK.js.map +1 -0
- package/dist/status-4GFXMVIM.js +128 -0
- package/dist/status-4GFXMVIM.js.map +1 -0
- package/dist/work-2V33NZAT.js +81 -0
- package/dist/work-2V33NZAT.js.map +1 -0
- package/package.json +7 -4
- package/dist/client.d.ts +0 -35
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -109
- package/dist/client.js.map +0 -1
- package/dist/commands/context.d.ts +0 -3
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -27
- package/dist/commands/context.js.map +0 -1
- package/dist/commands/cron.d.ts +0 -3
- package/dist/commands/cron.d.ts.map +0 -1
- package/dist/commands/cron.js +0 -106
- package/dist/commands/cron.js.map +0 -1
- package/dist/commands/pipeline.d.ts +0 -4
- package/dist/commands/pipeline.d.ts.map +0 -1
- package/dist/commands/pipeline.js +0 -645
- package/dist/commands/pipeline.js.map +0 -1
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -135
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/work.d.ts +0 -3
- package/dist/commands/work.d.ts.map +0 -1
- package/dist/commands/work.js +0 -76
- package/dist/commands/work.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/constraint-evaluator.d.ts +0 -40
- package/dist/lib/constraint-evaluator.d.ts.map +0 -1
- package/dist/lib/constraint-evaluator.js +0 -180
- package/dist/lib/constraint-evaluator.js.map +0 -1
- package/dist/lib/event-queue.d.ts +0 -28
- package/dist/lib/event-queue.d.ts.map +0 -1
- package/dist/lib/event-queue.js +0 -73
- package/dist/lib/event-queue.js.map +0 -1
- package/dist/lib/logger.d.ts +0 -20
- package/dist/lib/logger.d.ts.map +0 -1
- package/dist/lib/logger.js +0 -52
- package/dist/lib/logger.js.map +0 -1
- package/dist/lib/mcp-config.d.ts +0 -9
- package/dist/lib/mcp-config.d.ts.map +0 -1
- package/dist/lib/mcp-config.js +0 -51
- package/dist/lib/mcp-config.js.map +0 -1
- package/dist/lib/orchestrator.d.ts +0 -238
- package/dist/lib/orchestrator.d.ts.map +0 -1
- package/dist/lib/orchestrator.js +0 -616
- package/dist/lib/orchestrator.js.map +0 -1
- package/dist/lib/prompt-composer.d.ts +0 -102
- package/dist/lib/prompt-composer.d.ts.map +0 -1
- package/dist/lib/prompt-composer.js +0 -182
- package/dist/lib/prompt-composer.js.map +0 -1
- package/dist/lib/ralph-loop.d.ts +0 -49
- package/dist/lib/ralph-loop.d.ts.map +0 -1
- package/dist/lib/ralph-loop.js +0 -174
- package/dist/lib/ralph-loop.js.map +0 -1
- package/dist/lib/ws-client.d.ts +0 -31
- package/dist/lib/ws-client.d.ts.map +0 -1
- package/dist/lib/ws-client.js +0 -110
- package/dist/lib/ws-client.js.map +0 -1
package/dist/lib/orchestrator.js
DELETED
|
@@ -1,616 +0,0 @@
|
|
|
1
|
-
import { evaluateConstraints } from './constraint-evaluator.js';
|
|
2
|
-
/**
|
|
3
|
-
* PipelineOrchestrator — coordination layer for Ralph Loops.
|
|
4
|
-
*
|
|
5
|
-
* Discovers pipeline columns (has_prompt=true, type !== 'done'),
|
|
6
|
-
* spawns loops for tickets with concurrency limits per column,
|
|
7
|
-
* and handles WebSocket events for dynamic ticket arrivals.
|
|
8
|
-
*/
|
|
9
|
-
export class PipelineOrchestrator {
|
|
10
|
-
boardId;
|
|
11
|
-
projectId;
|
|
12
|
-
deps;
|
|
13
|
-
/** Column ID -> column configuration */
|
|
14
|
-
pipelineColumns = new Map();
|
|
15
|
-
/** Column ID -> cached column scope (from initialize) */
|
|
16
|
-
columnScopes = new Map();
|
|
17
|
-
/** Ticket ID -> active loop tracking */
|
|
18
|
-
activeLoops = new Map();
|
|
19
|
-
/** Column ID -> queued ticket IDs (FIFO) */
|
|
20
|
-
loopQueues = new Map();
|
|
21
|
-
/** Ticket IDs that have been spawned or queued (prevents re-processing) */
|
|
22
|
-
knownTickets = new Set();
|
|
23
|
-
/** Tickets deferred because they have unresolved blockers. Re-queued when a blocker reaches Done. */
|
|
24
|
-
deferredTickets = new Map(); // ticketId → columnId
|
|
25
|
-
/** Ticket IDs currently in the spawning process (prevents double-spawn race) */
|
|
26
|
-
spawning = new Set();
|
|
27
|
-
/** Per-column reservation count for in-flight spawns (prevents concurrency overshoot) */
|
|
28
|
-
columnReservations = new Map();
|
|
29
|
-
/** Cached board scope for constraint evaluation — refreshed each scan cycle */
|
|
30
|
-
cachedBoardScope = null;
|
|
31
|
-
/** Last time a loop was spawned per column — for column.last_fired_at subject */
|
|
32
|
-
lastFiredAt = new Map();
|
|
33
|
-
/** Column IDs currently blocked by firing constraints (prevents redundant re-evaluation within a scan) */
|
|
34
|
-
blockedColumns = new Set();
|
|
35
|
-
constructor(boardId, projectId, deps) {
|
|
36
|
-
this.boardId = boardId;
|
|
37
|
-
this.projectId = projectId;
|
|
38
|
-
this.deps = deps;
|
|
39
|
-
}
|
|
40
|
-
/** Returns the IDs of all discovered pipeline columns. */
|
|
41
|
-
get pipelineColumnIds() {
|
|
42
|
-
return Array.from(this.pipelineColumns.keys());
|
|
43
|
-
}
|
|
44
|
-
/** Returns the total number of active loops. */
|
|
45
|
-
get activeLoopCount() {
|
|
46
|
-
return this.activeLoops.size;
|
|
47
|
-
}
|
|
48
|
-
/** Returns true if any tickets are queued or deferred (waiting for a slot). */
|
|
49
|
-
get hasQueuedWork() {
|
|
50
|
-
for (const [, queue] of this.loopQueues) {
|
|
51
|
-
if (queue.length > 0)
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
return this.deferredTickets.size > 0 || this.spawning.size > 0;
|
|
55
|
-
}
|
|
56
|
-
/** Returns the number of queued (waiting) tickets for a column. */
|
|
57
|
-
queuedCount(columnId) {
|
|
58
|
-
return this.loopQueues.get(columnId)?.length ?? 0;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Initialize the orchestrator: fetch board scope, identify pipeline columns,
|
|
62
|
-
* and fetch column-level agent configs.
|
|
63
|
-
*/
|
|
64
|
-
async initialize() {
|
|
65
|
-
const boardScope = await this.deps.fetchBoardScope(this.boardId);
|
|
66
|
-
this.cachedBoardScope = boardScope;
|
|
67
|
-
// Identify pipeline columns: has_prompt=true AND type !== 'done'
|
|
68
|
-
const pipelineCols = boardScope.columns.filter((col) => col.has_prompt && col.type !== 'done');
|
|
69
|
-
// Fetch column scope for each pipeline column to get agent_config and tickets
|
|
70
|
-
await Promise.all(pipelineCols.map(async (col) => {
|
|
71
|
-
const colScope = await this.deps.fetchColumnScope(col.id);
|
|
72
|
-
const cfg = colScope.agent_config;
|
|
73
|
-
this.pipelineColumns.set(col.id, {
|
|
74
|
-
columnId: col.id,
|
|
75
|
-
name: col.name,
|
|
76
|
-
concurrency: cfg?.concurrency ?? 1,
|
|
77
|
-
maxIterations: cfg?.max_iterations ?? 10,
|
|
78
|
-
gutterThreshold: cfg?.gutter_threshold ?? 3,
|
|
79
|
-
modelPreference: cfg?.model_preference,
|
|
80
|
-
maxBudgetUsd: cfg?.max_budget_usd,
|
|
81
|
-
worktreeEnabled: cfg?.worktree?.enabled,
|
|
82
|
-
worktreePattern: cfg?.worktree?.path_pattern,
|
|
83
|
-
});
|
|
84
|
-
// Cache column scope for scanAndSpawn
|
|
85
|
-
this.columnScopes.set(col.id, colScope);
|
|
86
|
-
// Initialize the queue for this column
|
|
87
|
-
this.loopQueues.set(col.id, []);
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Refresh the cached column scope for a single column.
|
|
92
|
-
* Keeps stale scope on error rather than crashing.
|
|
93
|
-
*/
|
|
94
|
-
async refreshColumnScope(columnId) {
|
|
95
|
-
try {
|
|
96
|
-
const colScope = await this.deps.fetchColumnScope(columnId);
|
|
97
|
-
this.columnScopes.set(columnId, colScope);
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
// Keep stale scope rather than crash
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Refresh the cached board scope. Called at the start of each scan cycle
|
|
105
|
-
* to get fresh ticket counts for constraint evaluation.
|
|
106
|
-
*/
|
|
107
|
-
async refreshBoardScope() {
|
|
108
|
-
try {
|
|
109
|
-
this.cachedBoardScope = await this.deps.fetchBoardScope(this.boardId);
|
|
110
|
-
}
|
|
111
|
-
catch {
|
|
112
|
-
// Keep stale scope rather than crash
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Public method to invalidate constraint caches when WS events arrive
|
|
117
|
-
* (firing_constraint:created/updated/deleted). Forces re-fetch on next access.
|
|
118
|
-
*/
|
|
119
|
-
async refreshConstraints() {
|
|
120
|
-
// Re-fetch column scopes to get updated firing_constraints arrays
|
|
121
|
-
await Promise.all(Array.from(this.pipelineColumns.keys()).map((colId) => this.refreshColumnScope(colId)));
|
|
122
|
-
this.blockedColumns.clear();
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Build the BoardState required by the constraint evaluator from current
|
|
126
|
-
* orchestrator state + cached board scope.
|
|
127
|
-
*/
|
|
128
|
-
buildBoardState() {
|
|
129
|
-
const bs = this.cachedBoardScope;
|
|
130
|
-
if (!bs) {
|
|
131
|
-
return {
|
|
132
|
-
columns: [],
|
|
133
|
-
active_loops: new Map(),
|
|
134
|
-
last_fired_at: new Map(),
|
|
135
|
-
circuit_breaker_count: 0,
|
|
136
|
-
backlog_ticket_count: 0,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
// Compute active loops per column
|
|
140
|
-
const activeLoopsPerColumn = new Map();
|
|
141
|
-
for (const [, loop] of this.activeLoops) {
|
|
142
|
-
activeLoopsPerColumn.set(loop.columnId, (activeLoopsPerColumn.get(loop.columnId) ?? 0) + 1);
|
|
143
|
-
}
|
|
144
|
-
// Compute seconds since last fire per column
|
|
145
|
-
const now = Date.now();
|
|
146
|
-
const lastFiredSeconds = new Map();
|
|
147
|
-
for (const [colId, firedAt] of this.lastFiredAt) {
|
|
148
|
-
lastFiredSeconds.set(colId, Math.floor((now - firedAt.getTime()) / 1000));
|
|
149
|
-
}
|
|
150
|
-
// Circuit breaker count = ticket count in circuit breaker target column
|
|
151
|
-
let circuitBreakerCount = 0;
|
|
152
|
-
if (bs.circuit_breaker.target_column_id) {
|
|
153
|
-
const targetCol = bs.columns.find((c) => c.id === bs.circuit_breaker.target_column_id);
|
|
154
|
-
if (targetCol)
|
|
155
|
-
circuitBreakerCount = targetCol.ticket_count;
|
|
156
|
-
}
|
|
157
|
-
return {
|
|
158
|
-
columns: bs.columns.map((c) => ({
|
|
159
|
-
id: c.id,
|
|
160
|
-
name: c.name,
|
|
161
|
-
position: c.position,
|
|
162
|
-
column_type: c.type,
|
|
163
|
-
wip_limit: c.wip_limit,
|
|
164
|
-
ticket_count: c.ticket_count,
|
|
165
|
-
})),
|
|
166
|
-
active_loops: activeLoopsPerColumn,
|
|
167
|
-
last_fired_at: lastFiredSeconds,
|
|
168
|
-
circuit_breaker_count: circuitBreakerCount,
|
|
169
|
-
backlog_ticket_count: bs.backlog_ticket_count,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Convert camelCase FiringConstraintLite from column scope to snake_case
|
|
174
|
-
* FiringConstraint expected by the evaluator.
|
|
175
|
-
*/
|
|
176
|
-
toFiringConstraints(lites) {
|
|
177
|
-
return lites.map((c) => ({
|
|
178
|
-
id: c.id,
|
|
179
|
-
project_id: this.projectId,
|
|
180
|
-
board_id: this.boardId,
|
|
181
|
-
column_id: c.columnId,
|
|
182
|
-
name: c.name,
|
|
183
|
-
description: null,
|
|
184
|
-
enabled: c.enabled,
|
|
185
|
-
subject_type: c.subjectType,
|
|
186
|
-
subject_ref: c.subjectRef,
|
|
187
|
-
subject_param: null,
|
|
188
|
-
operator: c.operator,
|
|
189
|
-
value: c.value,
|
|
190
|
-
scope: c.scope,
|
|
191
|
-
notify: c.notify,
|
|
192
|
-
position: 0,
|
|
193
|
-
created_at: '',
|
|
194
|
-
updated_at: '',
|
|
195
|
-
}));
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Evaluate firing constraints for a column. Returns the EvalResult if any
|
|
199
|
-
* constraint failed, or null if all passed (column is clear to fire).
|
|
200
|
-
*
|
|
201
|
-
* Handles logging and optional signal creation for blocked columns.
|
|
202
|
-
*/
|
|
203
|
-
evaluateColumnConstraints(columnId) {
|
|
204
|
-
const colScope = this.columnScopes.get(columnId);
|
|
205
|
-
if (!colScope?.firing_constraints || colScope.firing_constraints.length === 0) {
|
|
206
|
-
return null; // No constraints — always pass
|
|
207
|
-
}
|
|
208
|
-
const constraints = this.toFiringConstraints(colScope.firing_constraints);
|
|
209
|
-
const boardState = this.buildBoardState();
|
|
210
|
-
const result = evaluateConstraints(constraints, boardState, columnId);
|
|
211
|
-
if (result.summary.failed === 0) {
|
|
212
|
-
return null; // All passed
|
|
213
|
-
}
|
|
214
|
-
// Log each failed constraint clearly
|
|
215
|
-
const colName = colScope.column.name;
|
|
216
|
-
for (const r of result.results) {
|
|
217
|
-
if (!r.passed && !r.error) {
|
|
218
|
-
console.error(` [blocked] Column "${colName}" (${columnId}): constraint "${r.name}" ` +
|
|
219
|
-
`FAILED — resolved=${String(r.resolved_value)} ${r.threshold.operator} ${String(r.threshold.value)}`);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
if (result.summary.errors > 0) {
|
|
223
|
-
for (const r of result.results) {
|
|
224
|
-
if (r.error) {
|
|
225
|
-
console.error(` [constraint-error] Column "${colName}" (${columnId}): "${r.name}" — ${r.error} (fail-open)`);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
// Handle notify flag: create signals for blocked constraints with notify=true
|
|
230
|
-
const constraintMap = new Map(constraints.map((c) => [c.id, c]));
|
|
231
|
-
for (const r of result.results) {
|
|
232
|
-
if (!r.passed && !r.error) {
|
|
233
|
-
const constraint = constraintMap.get(r.constraint_id);
|
|
234
|
-
if (constraint?.notify && this.deps.createColumnSignal) {
|
|
235
|
-
void this.deps.createColumnSignal(columnId, `Firing constraint "${r.name}" blocked column: ` +
|
|
236
|
-
`resolved=${String(r.resolved_value)} ${r.threshold.operator} ${String(r.threshold.value)}`).catch((err) => {
|
|
237
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
238
|
-
console.error(` [warn] Failed to create constraint signal: ${msg}`);
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
return result;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Check if a column is blocked by firing constraints.
|
|
247
|
-
* Returns true if blocked (should not fire), false if clear.
|
|
248
|
-
*/
|
|
249
|
-
isColumnBlocked(columnId) {
|
|
250
|
-
const result = this.evaluateColumnConstraints(columnId);
|
|
251
|
-
return result !== null;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Scan all pipeline columns for existing tickets and spawn loops.
|
|
255
|
-
* Refreshes column scopes before scanning to avoid stale ticket lists.
|
|
256
|
-
* Evaluates firing constraints per column before processing tickets.
|
|
257
|
-
* Respects per-column concurrency limits — excess tickets are queued.
|
|
258
|
-
*/
|
|
259
|
-
async scanAndSpawn() {
|
|
260
|
-
// Reset knownTickets each scan cycle so that completed loops can be
|
|
261
|
-
// re-evaluated on the next poll. The activeLoops and spawning checks
|
|
262
|
-
// already prevent true double-spawns; knownTickets only deduplicates
|
|
263
|
-
// within a single scan (e.g. ticket appearing in stale column scope).
|
|
264
|
-
this.knownTickets.clear();
|
|
265
|
-
// Re-populate with tickets that are actively running or queued
|
|
266
|
-
for (const ticketId of this.activeLoops.keys()) {
|
|
267
|
-
this.knownTickets.add(ticketId);
|
|
268
|
-
}
|
|
269
|
-
for (const [, queue] of this.loopQueues) {
|
|
270
|
-
for (const ticketId of queue) {
|
|
271
|
-
this.knownTickets.add(ticketId);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
// Re-evaluate deferred tickets — their blockers may have resolved (H12)
|
|
275
|
-
// Note: deferred tickets are NOT added to knownTickets so they can be re-spawned
|
|
276
|
-
for (const [ticketId, columnId] of Array.from(this.deferredTickets)) {
|
|
277
|
-
try {
|
|
278
|
-
const stillBlocked = await this.deps.hasUnresolvedBlockers(ticketId);
|
|
279
|
-
if (!stillBlocked) {
|
|
280
|
-
this.deferredTickets.delete(ticketId);
|
|
281
|
-
await this.spawnOrQueue(ticketId, columnId, true);
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
// Still blocked — add to knownTickets so the column scan doesn't re-process it
|
|
285
|
-
this.knownTickets.add(ticketId);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
catch {
|
|
289
|
-
// Leave deferred — will re-evaluate next cycle
|
|
290
|
-
this.knownTickets.add(ticketId);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
// Refresh board scope for fresh ticket counts used by constraint evaluation
|
|
294
|
-
await this.refreshBoardScope();
|
|
295
|
-
this.blockedColumns.clear();
|
|
296
|
-
for (const [columnId] of this.pipelineColumns) {
|
|
297
|
-
await this.refreshColumnScope(columnId);
|
|
298
|
-
const colScope = this.columnScopes.get(columnId);
|
|
299
|
-
if (!colScope) {
|
|
300
|
-
console.error(` [scan] Column ${columnId}: no cached scope`);
|
|
301
|
-
continue;
|
|
302
|
-
}
|
|
303
|
-
// Evaluate column-scope firing constraints BEFORE processing tickets
|
|
304
|
-
if (this.isColumnBlocked(columnId)) {
|
|
305
|
-
this.blockedColumns.add(columnId);
|
|
306
|
-
console.error(` [scan] Column ${columnId} (${colScope.column.name}): BLOCKED by firing constraints — skipping ${String(colScope.tickets.length)} ticket(s)`);
|
|
307
|
-
continue;
|
|
308
|
-
}
|
|
309
|
-
console.error(` [scan] Column ${columnId} (${colScope.column.name}): ${String(colScope.tickets.length)} ticket(s)`);
|
|
310
|
-
for (const ticket of colScope.tickets) {
|
|
311
|
-
await this.spawnOrQueue(ticket.id, columnId);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Handle a pipeline event (typically from WebSocket via EventQueue).
|
|
317
|
-
*/
|
|
318
|
-
async handleEvent(event) {
|
|
319
|
-
switch (event.type) {
|
|
320
|
-
case 'ticket:moved':
|
|
321
|
-
case 'ticket:created': {
|
|
322
|
-
if (event.columnId && this.pipelineColumns.has(event.columnId)) {
|
|
323
|
-
// Check firing constraints before spawning
|
|
324
|
-
if (this.isColumnBlocked(event.columnId)) {
|
|
325
|
-
console.error(` [event] ${event.type} ${event.ticketId} → column ${event.columnId}: BLOCKED by firing constraints`);
|
|
326
|
-
// Don't break — still need to re-evaluate blockers below for ticket:moved
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
329
|
-
await this.spawnOrQueue(event.ticketId, event.columnId, true);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
// On any move, check if the moved ticket unblocks dependents
|
|
333
|
-
if (event.type === 'ticket:moved') {
|
|
334
|
-
try {
|
|
335
|
-
const blocked = await this.deps.fetchBlockedTickets(event.ticketId);
|
|
336
|
-
for (const dep of blocked) {
|
|
337
|
-
if (dep.id === event.ticketId)
|
|
338
|
-
continue; // skip self
|
|
339
|
-
if (dep.column_id && this.pipelineColumns.has(dep.column_id)) {
|
|
340
|
-
this.knownTickets.delete(dep.id);
|
|
341
|
-
this.deferredTickets.delete(dep.id);
|
|
342
|
-
await this.spawnOrQueue(dep.id, dep.column_id, true);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
catch (err) {
|
|
347
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
348
|
-
console.error(` [warn] Failed to fetch blocked tickets for ${event.ticketId}: ${msg}`);
|
|
349
|
-
}
|
|
350
|
-
// Re-evaluate all deferred tickets — resolution is server-side now
|
|
351
|
-
for (const [deferredId, deferredCol] of Array.from(this.deferredTickets)) {
|
|
352
|
-
if (deferredId === event.ticketId)
|
|
353
|
-
continue; // already handled above
|
|
354
|
-
this.knownTickets.delete(deferredId);
|
|
355
|
-
this.deferredTickets.delete(deferredId);
|
|
356
|
-
await this.spawnOrQueue(deferredId, deferredCol, true);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
|
-
case 'ticket:updated': {
|
|
362
|
-
// Re-evaluate the ticket if it's deferred in a pipeline column
|
|
363
|
-
if (event.columnId && this.pipelineColumns.has(event.columnId)) {
|
|
364
|
-
if (this.deferredTickets.has(event.ticketId)) {
|
|
365
|
-
this.knownTickets.delete(event.ticketId);
|
|
366
|
-
this.deferredTickets.delete(event.ticketId);
|
|
367
|
-
await this.spawnOrQueue(event.ticketId, event.columnId, true);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
break;
|
|
371
|
-
}
|
|
372
|
-
case 'ticket:deleted':
|
|
373
|
-
case 'ticket:archived': {
|
|
374
|
-
// If there's an active loop for this ticket, it will detect the
|
|
375
|
-
// change via fingerprint/404. We just clean up our tracking.
|
|
376
|
-
this.activeLoops.delete(event.ticketId);
|
|
377
|
-
this.knownTickets.delete(event.ticketId);
|
|
378
|
-
this.deferredTickets.delete(event.ticketId);
|
|
379
|
-
this.spawning.delete(event.ticketId);
|
|
380
|
-
// Also remove from any queue
|
|
381
|
-
for (const [, queue] of this.loopQueues) {
|
|
382
|
-
const idx = queue.indexOf(event.ticketId);
|
|
383
|
-
if (idx !== -1) {
|
|
384
|
-
queue.splice(idx, 1);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Spawn a loop for a ticket if under concurrency limit, otherwise queue it.
|
|
393
|
-
* @param skipKnownCheck - true for event-driven spawns (bypass scan dedup)
|
|
394
|
-
*/
|
|
395
|
-
async spawnOrQueue(ticketId, columnId, skipKnownCheck = false) {
|
|
396
|
-
// Don't double-spawn
|
|
397
|
-
if (this.activeLoops.has(ticketId))
|
|
398
|
-
return;
|
|
399
|
-
// Prevent double-spawn race: two rapid events passing the activeLoops check
|
|
400
|
-
if (this.spawning.has(ticketId))
|
|
401
|
-
return;
|
|
402
|
-
// During scanAndSpawn, prevent re-processing tickets seen in other columns
|
|
403
|
-
if (!skipKnownCheck && this.knownTickets.has(ticketId))
|
|
404
|
-
return;
|
|
405
|
-
const colConfig = this.pipelineColumns.get(columnId);
|
|
406
|
-
if (!colConfig)
|
|
407
|
-
return;
|
|
408
|
-
// Belt-and-suspenders: check firing constraints even if already checked at column level.
|
|
409
|
-
// This catches paths like blocker re-evaluation and deferred ticket re-queue.
|
|
410
|
-
if (this.isColumnBlocked(columnId)) {
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
// Count active loops for this column
|
|
414
|
-
const activeInColumn = this.activeCountForColumn(columnId);
|
|
415
|
-
// Mark as known to prevent re-processing
|
|
416
|
-
this.knownTickets.add(ticketId);
|
|
417
|
-
if (activeInColumn >= colConfig.concurrency) {
|
|
418
|
-
// Queue it
|
|
419
|
-
const queue = this.loopQueues.get(columnId);
|
|
420
|
-
if (queue && !queue.includes(ticketId)) {
|
|
421
|
-
queue.push(ticketId);
|
|
422
|
-
}
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
// Mark as in-progress spawning to prevent double-spawn race
|
|
426
|
-
this.spawning.add(ticketId);
|
|
427
|
-
// Reserve the concurrency slot before the async claimTicket call
|
|
428
|
-
this.reserveSlot(columnId);
|
|
429
|
-
try {
|
|
430
|
-
const blocked = await this.deps.hasUnresolvedBlockers(ticketId);
|
|
431
|
-
if (blocked) {
|
|
432
|
-
this.spawning.delete(ticketId);
|
|
433
|
-
this.releaseSlot(columnId);
|
|
434
|
-
this.deferredTickets.set(ticketId, columnId);
|
|
435
|
-
console.error(` [skip] ${ticketId} has unresolved blockers — deferred`);
|
|
436
|
-
void this.drainQueue(columnId).catch(() => { });
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
catch (err) {
|
|
441
|
-
// Defer rather than proceed — cost of false-defer (retried next scan) is
|
|
442
|
-
// lower than cost of wasted agent iterations on a blocked ticket (H5)
|
|
443
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
444
|
-
console.error(` [warn] Blocker check failed for ${ticketId}, deferring: ${msg}`);
|
|
445
|
-
this.spawning.delete(ticketId);
|
|
446
|
-
this.releaseSlot(columnId);
|
|
447
|
-
this.deferredTickets.set(ticketId, columnId);
|
|
448
|
-
void this.drainQueue(columnId);
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
// Spawn the loop
|
|
452
|
-
try {
|
|
453
|
-
await this.deps.claimTicket(ticketId);
|
|
454
|
-
this.startTrackedLoop(ticketId, columnId, colConfig);
|
|
455
|
-
}
|
|
456
|
-
catch (err) {
|
|
457
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
458
|
-
console.error(` [error] Failed to claim ticket ${ticketId}: ${msg}`);
|
|
459
|
-
this.knownTickets.delete(ticketId);
|
|
460
|
-
}
|
|
461
|
-
finally {
|
|
462
|
-
this.spawning.delete(ticketId);
|
|
463
|
-
this.releaseSlot(columnId);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* Start a loop and track it. Attach completion handler for cleanup + queue drain.
|
|
468
|
-
*/
|
|
469
|
-
startTrackedLoop(ticketId, columnId, config) {
|
|
470
|
-
const loopConfig = {
|
|
471
|
-
maxIterations: config.maxIterations,
|
|
472
|
-
gutterThreshold: config.gutterThreshold,
|
|
473
|
-
...(config.modelPreference !== undefined && { modelPreference: config.modelPreference }),
|
|
474
|
-
...(config.maxBudgetUsd !== undefined && { maxBudgetUsd: config.maxBudgetUsd }),
|
|
475
|
-
...(config.worktreeEnabled !== undefined && { worktreeEnabled: config.worktreeEnabled }),
|
|
476
|
-
...(config.worktreePattern !== undefined && { worktreePattern: config.worktreePattern }),
|
|
477
|
-
};
|
|
478
|
-
const promise = this.deps.startLoop(ticketId, columnId, loopConfig);
|
|
479
|
-
this.activeLoops.set(ticketId, { columnId, promise });
|
|
480
|
-
// Track last fire time for column.last_fired_at constraint subject
|
|
481
|
-
this.lastFiredAt.set(columnId, new Date());
|
|
482
|
-
// Attach completion handler — do NOT await
|
|
483
|
-
void promise.then((result) => this.onLoopComplete(ticketId, columnId, result).catch((err) => {
|
|
484
|
-
console.error(`onLoopComplete error for ${ticketId}:`, err);
|
|
485
|
-
}), (err) => this.onLoopComplete(ticketId, columnId, {
|
|
486
|
-
reason: 'error',
|
|
487
|
-
iterations: 0,
|
|
488
|
-
gutterCount: 0,
|
|
489
|
-
lastError: err instanceof Error ? err.message : String(err),
|
|
490
|
-
}).catch((completionErr) => {
|
|
491
|
-
console.error(`onLoopComplete error for ${ticketId}:`, completionErr);
|
|
492
|
-
}));
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Called when a loop finishes. Cleans up tracking and drains the queue.
|
|
496
|
-
*/
|
|
497
|
-
async onLoopComplete(ticketId, columnId, result) {
|
|
498
|
-
this.activeLoops.delete(ticketId);
|
|
499
|
-
// Drain queue FIRST to minimize slot idle time (H13)
|
|
500
|
-
await this.drainQueue(columnId);
|
|
501
|
-
// Write reason-specific comment
|
|
502
|
-
let comment;
|
|
503
|
-
switch (result.reason) {
|
|
504
|
-
case 'moved':
|
|
505
|
-
comment = `Pipeline agent advanced ticket after ${result.iterations} iteration(s).`;
|
|
506
|
-
break;
|
|
507
|
-
case 'max_iterations':
|
|
508
|
-
comment = `Pipeline agent reached iteration limit (${result.iterations}) without advancing. Manual review needed.`;
|
|
509
|
-
break;
|
|
510
|
-
case 'stalled':
|
|
511
|
-
comment = `Pipeline agent stalled — no progress for ${result.gutterCount} consecutive iterations (of ${result.iterations} total). Manual review needed.`;
|
|
512
|
-
break;
|
|
513
|
-
case 'error':
|
|
514
|
-
comment = `Pipeline agent encountered an error after ${result.iterations} iteration(s): ${result.lastError ?? 'unknown error'}`;
|
|
515
|
-
break;
|
|
516
|
-
case 'stopped':
|
|
517
|
-
comment = `Pipeline agent was stopped externally after ${result.iterations} iteration(s).`;
|
|
518
|
-
break;
|
|
519
|
-
case 'deleted':
|
|
520
|
-
comment = `Pipeline agent stopped — ticket was deleted or archived during iteration ${result.iterations}.`;
|
|
521
|
-
break;
|
|
522
|
-
}
|
|
523
|
-
if (result.reason !== 'deleted') {
|
|
524
|
-
await this.deps.createComment(ticketId, comment).catch((err) => {
|
|
525
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
526
|
-
console.error(` [warn] Failed to write completion comment for ${ticketId}: ${msg}`);
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
// Create signal for failure exits so future agents inherit the context
|
|
530
|
-
if (result.reason === 'stalled') {
|
|
531
|
-
await this.deps.createSignal(ticketId, `Previous pipeline run stalled after ${result.iterations} iterations with no progress. Review comments for details before retrying.`).catch((err) => {
|
|
532
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
533
|
-
console.error(` [warn] Failed to write signal for ${ticketId}: ${msg}`);
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
else if (result.reason === 'error') {
|
|
537
|
-
await this.deps.createSignal(ticketId, `Previous pipeline run failed after ${result.iterations} iteration(s): ${result.lastError ?? 'unknown error'}. Review comments for details before retrying.`).catch((err) => {
|
|
538
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
539
|
-
console.error(` [warn] Failed to write signal for ${ticketId}: ${msg}`);
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
/**
|
|
544
|
-
* Start queued tickets for a column until concurrency limit is reached (H16: fills multiple slots).
|
|
545
|
-
*/
|
|
546
|
-
async drainQueue(columnId) {
|
|
547
|
-
const colConfig = this.pipelineColumns.get(columnId);
|
|
548
|
-
if (!colConfig)
|
|
549
|
-
return;
|
|
550
|
-
const queue = this.loopQueues.get(columnId);
|
|
551
|
-
if (!queue || queue.length === 0)
|
|
552
|
-
return;
|
|
553
|
-
// Check firing constraints before draining — if column is now blocked, stop
|
|
554
|
-
if (this.isColumnBlocked(columnId)) {
|
|
555
|
-
console.error(` [drain] Column ${columnId}: BLOCKED by firing constraints — ${String(queue.length)} ticket(s) remain queued`);
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
// Loop to fill all available slots (H16)
|
|
559
|
-
while (queue.length > 0) {
|
|
560
|
-
const activeInColumn = this.activeCountForColumn(columnId);
|
|
561
|
-
if (activeInColumn >= colConfig.concurrency)
|
|
562
|
-
return;
|
|
563
|
-
const nextTicketId = queue.shift();
|
|
564
|
-
// Guard against double-spawn race with concurrent scanAndSpawn (C2)
|
|
565
|
-
if (this.spawning.has(nextTicketId) || this.activeLoops.has(nextTicketId)) {
|
|
566
|
-
continue;
|
|
567
|
-
}
|
|
568
|
-
this.spawning.add(nextTicketId);
|
|
569
|
-
this.reserveSlot(columnId);
|
|
570
|
-
try {
|
|
571
|
-
const blocked = await this.deps.hasUnresolvedBlockers(nextTicketId);
|
|
572
|
-
if (blocked) {
|
|
573
|
-
this.deferredTickets.set(nextTicketId, columnId);
|
|
574
|
-
this.spawning.delete(nextTicketId);
|
|
575
|
-
this.releaseSlot(columnId);
|
|
576
|
-
continue; // try next ticket in queue
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
catch {
|
|
580
|
-
// If check fails, proceed anyway — agent will handle it
|
|
581
|
-
}
|
|
582
|
-
try {
|
|
583
|
-
await this.deps.claimTicket(nextTicketId);
|
|
584
|
-
this.startTrackedLoop(nextTicketId, columnId, colConfig);
|
|
585
|
-
}
|
|
586
|
-
catch (err) {
|
|
587
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
588
|
-
console.error(` [error] Failed to claim queued ticket ${nextTicketId}: ${msg}`);
|
|
589
|
-
}
|
|
590
|
-
finally {
|
|
591
|
-
this.spawning.delete(nextTicketId);
|
|
592
|
-
this.releaseSlot(columnId);
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
/**
|
|
597
|
-
* Count active loops + in-flight reservations for a specific column.
|
|
598
|
-
*/
|
|
599
|
-
activeCountForColumn(columnId) {
|
|
600
|
-
let count = 0;
|
|
601
|
-
for (const [, loop] of this.activeLoops) {
|
|
602
|
-
if (loop.columnId === columnId)
|
|
603
|
-
count++;
|
|
604
|
-
}
|
|
605
|
-
return count + (this.columnReservations.get(columnId) ?? 0);
|
|
606
|
-
}
|
|
607
|
-
reserveSlot(columnId) {
|
|
608
|
-
this.columnReservations.set(columnId, (this.columnReservations.get(columnId) ?? 0) + 1);
|
|
609
|
-
}
|
|
610
|
-
releaseSlot(columnId) {
|
|
611
|
-
const current = this.columnReservations.get(columnId) ?? 0;
|
|
612
|
-
if (current > 0)
|
|
613
|
-
this.columnReservations.set(columnId, current - 1);
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/lib/orchestrator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAoC,MAAM,2BAA2B,CAAC;AAoIlG;;;;;;GAMG;AACH,MAAM,OAAO,oBAAoB;IACvB,OAAO,CAAS;I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