codekin 0.6.5 → 0.7.0

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.
Files changed (79) hide show
  1. package/README.md +6 -3
  2. package/dist/assets/index-CLuQVRRb.css +1 -0
  3. package/dist/assets/index-JVnFWiSw.js +185 -0
  4. package/dist/index.html +2 -2
  5. package/package.json +4 -2
  6. package/server/dist/anthropic-models.d.ts +40 -0
  7. package/server/dist/anthropic-models.js +212 -0
  8. package/server/dist/anthropic-models.js.map +1 -0
  9. package/server/dist/claude-process.d.ts +31 -3
  10. package/server/dist/claude-process.js +126 -9
  11. package/server/dist/claude-process.js.map +1 -1
  12. package/server/dist/codex-process.d.ts +147 -0
  13. package/server/dist/codex-process.js +741 -0
  14. package/server/dist/codex-process.js.map +1 -0
  15. package/server/dist/coding-process.d.ts +16 -4
  16. package/server/dist/coding-process.js +10 -0
  17. package/server/dist/coding-process.js.map +1 -1
  18. package/server/dist/config.d.ts +13 -0
  19. package/server/dist/config.js +18 -0
  20. package/server/dist/config.js.map +1 -1
  21. package/server/dist/opencode-process.d.ts +142 -5
  22. package/server/dist/opencode-process.js +664 -84
  23. package/server/dist/opencode-process.js.map +1 -1
  24. package/server/dist/orchestrator-children.d.ts +53 -6
  25. package/server/dist/orchestrator-children.js +292 -68
  26. package/server/dist/orchestrator-children.js.map +1 -1
  27. package/server/dist/orchestrator-manager.d.ts +10 -0
  28. package/server/dist/orchestrator-manager.js +70 -18
  29. package/server/dist/orchestrator-manager.js.map +1 -1
  30. package/server/dist/orchestrator-monitor.d.ts +7 -1
  31. package/server/dist/orchestrator-monitor.js +49 -19
  32. package/server/dist/orchestrator-monitor.js.map +1 -1
  33. package/server/dist/orchestrator-notify.d.ts +16 -3
  34. package/server/dist/orchestrator-notify.js +22 -7
  35. package/server/dist/orchestrator-notify.js.map +1 -1
  36. package/server/dist/orchestrator-outbox.d.ts +48 -0
  37. package/server/dist/orchestrator-outbox.js +154 -0
  38. package/server/dist/orchestrator-outbox.js.map +1 -0
  39. package/server/dist/orchestrator-session-router.js +40 -1
  40. package/server/dist/orchestrator-session-router.js.map +1 -1
  41. package/server/dist/prompt-router.d.ts +22 -1
  42. package/server/dist/prompt-router.js +94 -11
  43. package/server/dist/prompt-router.js.map +1 -1
  44. package/server/dist/session-archive.js +11 -1
  45. package/server/dist/session-archive.js.map +1 -1
  46. package/server/dist/session-lifecycle.js +36 -0
  47. package/server/dist/session-lifecycle.js.map +1 -1
  48. package/server/dist/session-manager.d.ts +19 -2
  49. package/server/dist/session-manager.js +116 -27
  50. package/server/dist/session-manager.js.map +1 -1
  51. package/server/dist/session-naming.d.ts +4 -0
  52. package/server/dist/session-naming.js +26 -5
  53. package/server/dist/session-naming.js.map +1 -1
  54. package/server/dist/session-routes.js +38 -1
  55. package/server/dist/session-routes.js.map +1 -1
  56. package/server/dist/stepflow-handler.js +2 -2
  57. package/server/dist/stepflow-handler.js.map +1 -1
  58. package/server/dist/tsconfig.tsbuildinfo +1 -1
  59. package/server/dist/types.d.ts +24 -3
  60. package/server/dist/types.js +1 -9
  61. package/server/dist/types.js.map +1 -1
  62. package/server/dist/upload-routes.d.ts +7 -0
  63. package/server/dist/upload-routes.js +53 -24
  64. package/server/dist/upload-routes.js.map +1 -1
  65. package/server/dist/webhook-handler.js +3 -3
  66. package/server/dist/webhook-handler.js.map +1 -1
  67. package/server/dist/workflow-config.d.ts +2 -2
  68. package/server/dist/workflow-engine.d.ts +19 -0
  69. package/server/dist/workflow-engine.js +27 -3
  70. package/server/dist/workflow-engine.js.map +1 -1
  71. package/server/dist/workflow-loader.d.ts +5 -5
  72. package/server/dist/workflow-loader.js +90 -59
  73. package/server/dist/workflow-loader.js.map +1 -1
  74. package/server/dist/ws-message-handler.js +19 -8
  75. package/server/dist/ws-message-handler.js.map +1 -1
  76. package/server/dist/ws-server.js +25 -1
  77. package/server/dist/ws-server.js.map +1 -1
  78. package/dist/assets/index-B0xIzdCK.js +0 -187
  79. package/dist/assets/index-Q2WSVlHo.css +0 -1
@@ -6,6 +6,7 @@
6
6
  * and result polling.
7
7
  */
8
8
  import { randomUUID } from 'crypto';
9
+ import { execFile } from 'child_process';
9
10
  import { getAgentDisplayName } from './config.js';
10
11
  import { sendOrchestratorNotification, } from './orchestrator-notify.js';
11
12
  /** Statuses considered terminal — once entered, the child is done. */
@@ -14,13 +15,28 @@ const TERMINAL_STATUSES = new Set([
14
15
  'failed',
15
16
  'timed_out',
16
17
  ]);
18
+ const defaultExec = (cmd, args, cwd) => new Promise((resolvePromise, rejectPromise) => {
19
+ execFile(cmd, args, { cwd, timeout: 15_000, maxBuffer: 1024 * 1024 }, (err, stdout) => {
20
+ if (err)
21
+ rejectPromise(err instanceof Error ? err : new Error(`${cmd} failed`));
22
+ else
23
+ resolvePromise(stdout);
24
+ });
25
+ });
17
26
  // ---------------------------------------------------------------------------
18
27
  // Constants
19
28
  // ---------------------------------------------------------------------------
20
29
  const MAX_CONCURRENT = 5;
21
- const DEFAULT_TIMEOUT_MS = 600_000; // 10 minutes
30
+ const DEFAULT_TIMEOUT_MS = 1_800_000; // 30 minutes of working time
31
+ /**
32
+ * Separate budget for time spent blocked on a pending approval or question.
33
+ * The working-time clock is paused while blocked; this cap ensures a child
34
+ * waiting on an answer that never comes still terminates eventually.
35
+ */
36
+ const MAX_BLOCKED_MS = 1_800_000; // 30 minutes
22
37
  const CHILD_RETENTION_MS = 3_600_000; // keep completed/failed children for 1 hour
23
38
  const MAX_RETAINED_CHILDREN = 100; // hard cap on total entries
39
+ const MAX_NOTIFIED_PROMPT_IDS = 500; // cap on the blocked-prompt dedup set
24
40
  /**
25
41
  * Default allowed tools for agent child sessions. Covers standard dev
26
42
  * operations without granting arbitrary shell access. Destructive commands
@@ -41,6 +57,12 @@ export const AGENT_CHILD_ALLOWED_TOOLS = [
41
57
  // Build / lint / test tools
42
58
  'Bash(node:*)', 'Bash(tsc:*)', 'Bash(eslint:*)', 'Bash(prettier:*)',
43
59
  'Bash(cargo:*)', 'Bash(go:*)', 'Bash(make:*)', 'Bash(pip:*)',
60
+ // Python toolchain (linting/tests in Python repos)
61
+ 'Bash(python3:*)', 'Bash(pytest:*)',
62
+ // Text/data processing (read-only or scoped to working dir)
63
+ 'Bash(sed:*)', 'Bash(rg:*)', 'Bash(jq:*)',
64
+ // Non-destructive file management (no rm — deletion still needs approval)
65
+ 'Bash(mkdir:*)', 'Bash(cp:*)', 'Bash(mv:*)', 'Bash(touch:*)',
44
66
  // Safe filesystem inspection (read-only)
45
67
  'Bash(ls:*)', 'Bash(cat:*)', 'Bash(wc:*)',
46
68
  'Bash(head:*)', 'Bash(tail:*)', 'Bash(sort:*)', 'Bash(diff:*)',
@@ -55,9 +77,106 @@ export class OrchestratorChildManager {
55
77
  children = new Map();
56
78
  sessions;
57
79
  notify;
80
+ /** Prompt requestIds already reported to the parent (single-fire per prompt). */
81
+ notifiedPromptIds = new Set();
82
+ /**
83
+ * Per-child timeout controllers — lets the prompt handler pause the
84
+ * working-time clock the moment a child blocks on an approval/question,
85
+ * instead of waiting for the next monitor event.
86
+ */
87
+ timeoutControllers = new Map();
88
+ exec;
58
89
  constructor(sessions, opts) {
59
90
  this.sessions = sessions;
60
91
  this.notify = opts?.notify ?? ((args) => sendOrchestratorNotification(sessions, args));
92
+ this.exec = opts?.exec ?? defaultExec;
93
+ // Push a realtime notification to the parent orchestrator whenever one of
94
+ // our children blocks on a tool approval or question. Without this, a
95
+ // blocked child would silently sit until its timeout killed it.
96
+ this.sessions.onSessionPrompt((sessionId, promptType, toolName, requestId) => {
97
+ this.handleChildPrompt(sessionId, promptType, toolName, requestId);
98
+ });
99
+ }
100
+ /**
101
+ * Handle a prompt event from any session: if it belongs to one of our
102
+ * active children, mark the child as blocked and notify the parent
103
+ * orchestrator with everything it needs to unblock the child.
104
+ */
105
+ handleChildPrompt(sessionId, promptType, toolName, requestId) {
106
+ const child = this.children.get(sessionId);
107
+ if (!child || TERMINAL_STATUSES.has(child.status))
108
+ return;
109
+ child.status = 'blocked';
110
+ // Pause the working-time clock while the child waits for an answer.
111
+ this.timeoutControllers.get(sessionId)?.pause();
112
+ // Single-fire per requestId (re-broadcasts on client join would otherwise
113
+ // spam the parent). Prompts without a requestId can't be deduped or
114
+ // responded to by ID — still notify, but only describe them generically.
115
+ const dedupKey = requestId ?? `${sessionId}:${toolName ?? 'unknown'}`;
116
+ if (this.notifiedPromptIds.has(dedupKey))
117
+ return;
118
+ this.notifiedPromptIds.add(dedupKey);
119
+ if (this.notifiedPromptIds.size > MAX_NOTIFIED_PROMPT_IDS) {
120
+ // Drop oldest entries (Set preserves insertion order)
121
+ for (const id of this.notifiedPromptIds) {
122
+ this.notifiedPromptIds.delete(id);
123
+ if (this.notifiedPromptIds.size <= MAX_NOTIFIED_PROMPT_IDS)
124
+ break;
125
+ }
126
+ }
127
+ const parentSessionId = child.request.parentSessionId;
128
+ if (!parentSessionId)
129
+ return;
130
+ try {
131
+ this.notify({
132
+ parentSessionId,
133
+ label: 'Child Session Blocked',
134
+ title: `Session: ${getAgentDisplayName().toLowerCase()}:${child.request.branchName} (${child.id})`,
135
+ body: this.buildBlockedNotificationBody(child, promptType, toolName, requestId),
136
+ });
137
+ }
138
+ catch (err) {
139
+ console.warn(`[orchestrator-child] Failed to notify parent about blocked child ${child.id}:`, err);
140
+ }
141
+ }
142
+ /** Build the body for a blocked-child notification, including the exact
143
+ * API call the orchestrator can use to respond. */
144
+ buildBlockedNotificationBody(child, promptType, toolName, requestId) {
145
+ const lines = [
146
+ 'Status: blocked — waiting for a response',
147
+ `Branch: ${child.request.branchName}`,
148
+ `Repo: ${child.request.repo}`,
149
+ `Prompt: ${promptType}${toolName ? ` (${toolName})` : ''}`,
150
+ ];
151
+ // Include a one-line summary of what the tool wants to do, if available.
152
+ const detail = this.describePendingPrompt(child.id, requestId);
153
+ if (detail)
154
+ lines.push(`Detail: ${detail}`);
155
+ if (requestId) {
156
+ lines.push(`RequestId: ${requestId}`, 'Respond with:', `curl -s -X POST "http://localhost:$CODEKIN_PORT/api/orchestrator/sessions/${child.id}/respond" \\`, ' -H "Authorization: Bearer $CODEKIN_AUTH_TOKEN" -H "Content-Type: application/json" \\', promptType === 'question'
157
+ ? ` -d '{"requestId": "${requestId}", "value": "YOUR_ANSWER"}'`
158
+ : ` -d '{"requestId": "${requestId}", "value": "allow"}' # or "deny"`);
159
+ }
160
+ lines.push('Unanswered permission prompts are auto-denied after 5 minutes. If unsure, ask the user.');
161
+ return lines.join('\n');
162
+ }
163
+ /** One-line summary of the pending prompt's tool input (e.g. the Bash command). */
164
+ describePendingPrompt(sessionId, requestId) {
165
+ if (!requestId)
166
+ return null;
167
+ const session = this.sessions.get(sessionId);
168
+ if (!session)
169
+ return null;
170
+ const pending = session.pendingToolApprovals.get(requestId) ?? session.pendingControlRequests.get(requestId);
171
+ if (!pending)
172
+ return null;
173
+ const input = pending.toolInput;
174
+ if (typeof input.command === 'string')
175
+ return `$ ${input.command.split('\n')[0].slice(0, 200)}`;
176
+ if (typeof input.file_path === 'string')
177
+ return input.file_path;
178
+ const json = JSON.stringify(input);
179
+ return json.length > 2 ? json.slice(0, 200) : null;
61
180
  }
62
181
  /** Get all active/recent child sessions. */
63
182
  list() {
@@ -73,7 +192,7 @@ export class OrchestratorChildManager {
73
192
  purgeStaleChildren() {
74
193
  const now = Date.now();
75
194
  for (const [id, child] of this.children) {
76
- if (child.status === 'starting' || child.status === 'running')
195
+ if (!TERMINAL_STATUSES.has(child.status))
77
196
  continue;
78
197
  if (child.completedAt && now - new Date(child.completedAt).getTime() > CHILD_RETENTION_MS) {
79
198
  this.children.delete(id);
@@ -82,7 +201,7 @@ export class OrchestratorChildManager {
82
201
  // Hard cap: if still over limit, remove oldest completed entries
83
202
  if (this.children.size > MAX_RETAINED_CHILDREN) {
84
203
  const completed = Array.from(this.children.entries())
85
- .filter(([, c]) => c.status !== 'starting' && c.status !== 'running')
204
+ .filter(([, c]) => TERMINAL_STATUSES.has(c.status))
86
205
  .sort((a, b) => (a[1].completedAt ?? '').localeCompare(b[1].completedAt ?? ''));
87
206
  while (this.children.size > MAX_RETAINED_CHILDREN && completed.length > 0) {
88
207
  const [id] = completed.shift();
@@ -93,7 +212,7 @@ export class OrchestratorChildManager {
93
212
  /** Count currently active (non-terminal) child sessions. */
94
213
  activeCount() {
95
214
  return Array.from(this.children.values())
96
- .filter(c => c.status === 'starting' || c.status === 'running')
215
+ .filter(c => !TERMINAL_STATUSES.has(c.status))
97
216
  .length;
98
217
  }
99
218
  /**
@@ -117,6 +236,8 @@ export class OrchestratorChildManager {
117
236
  result: null,
118
237
  error: null,
119
238
  terminalNotifiedAt: null,
239
+ worktree: request.useWorktree ? 'failed' : 'none', // upgraded to 'active' on success
240
+ worktreePath: null,
120
241
  };
121
242
  this.children.set(sessionId, child);
122
243
  try {
@@ -136,7 +257,11 @@ export class OrchestratorChildManager {
136
257
  let worktreeFailed = false;
137
258
  if (request.useWorktree) {
138
259
  const wtPath = await this.sessions.createWorktree(sessionId, request.repo, request.branchName);
139
- if (!wtPath) {
260
+ if (wtPath) {
261
+ child.worktree = 'active';
262
+ child.worktreePath = wtPath;
263
+ }
264
+ else {
140
265
  worktreeFailed = true;
141
266
  console.warn(`[orchestrator-child] Failed to create worktree for ${sessionId}, falling back to main directory`);
142
267
  }
@@ -178,10 +303,12 @@ export class OrchestratorChildManager {
178
303
  title: `Session: ${getAgentDisplayName().toLowerCase()}:${child.request.branchName} (${child.id})`,
179
304
  body: this.buildTerminalNotificationBody(child),
180
305
  };
181
- // Only stamp `terminalNotifiedAt` on confirmed delivery so that a
182
- // transient parent-down (notify returns false / throws) does not
183
- // permanently suppress future retries. Idempotency is still enforced
184
- // by the early-return on terminalNotifiedAt at the top of this method.
306
+ // `notify` returns true on immediate delivery AND when the notification
307
+ // was queued in the persistent outbox (the outbox owns replay from that
308
+ // point on) both count as handled, so we stamp `terminalNotifiedAt`.
309
+ // It returns false only when queueing itself failed; we leave the stamp
310
+ // unset so a later terminal-path call can retry. Idempotency is still
311
+ // enforced by the early-return on terminalNotifiedAt at the top.
185
312
  let delivered = false;
186
313
  try {
187
314
  delivered = this.notify(args);
@@ -280,7 +407,6 @@ export class OrchestratorChildManager {
280
407
  let unsubResult;
281
408
  let unsubExit;
282
409
  const nudgedIds = new Set();
283
- const supersededMsgs = new Set();
284
410
  try {
285
411
  await new Promise((resolve) => {
286
412
  let settled = false;
@@ -288,48 +414,130 @@ export class OrchestratorChildManager {
288
414
  settled = true;
289
415
  resolve();
290
416
  } };
291
- // Timeout handler
292
- const timer = setTimeout(() => {
417
+ // Re-read after awaits — a timeout may settle while a ground-truth
418
+ // check is in flight (also defeats overly-eager type narrowing).
419
+ const isSettled = () => settled;
420
+ // ---- Pausable working-time clock -----------------------------------
421
+ // The working budget (timeoutMs) only burns while the child is doing
422
+ // work. When the child blocks on an approval/question, the clock is
423
+ // paused and a separate blocked-time cap (MAX_BLOCKED_MS) takes over
424
+ // so an unanswered prompt still terminates the child eventually.
425
+ let remainingMs = timeoutMs;
426
+ let workStartedAt = Date.now();
427
+ let workTimer = null;
428
+ let blockedTimer = null;
429
+ const clearTimers = () => {
430
+ if (workTimer) {
431
+ clearTimeout(workTimer);
432
+ workTimer = null;
433
+ }
434
+ if (blockedTimer) {
435
+ clearTimeout(blockedTimer);
436
+ blockedTimer = null;
437
+ }
438
+ };
439
+ const fireTimeout = (error) => {
293
440
  if (settled)
294
441
  return;
295
442
  child.status = 'timed_out';
296
- child.error = `Timed out after ${timeoutMs}ms`;
443
+ child.error = error;
297
444
  child.completedAt = new Date().toISOString();
445
+ clearTimers();
298
446
  const session = this.sessions.get(child.id);
299
447
  if (session?.claudeProcess?.isAlive()) {
300
448
  session.claudeProcess.stop();
301
449
  }
302
450
  settle();
303
- }, timeoutMs);
451
+ };
452
+ const pause = () => {
453
+ if (settled || !workTimer)
454
+ return;
455
+ clearTimeout(workTimer);
456
+ workTimer = null;
457
+ remainingMs = Math.max(0, remainingMs - (Date.now() - workStartedAt));
458
+ blockedTimer ??= setTimeout(() => {
459
+ fireTimeout(`Timed out after waiting ${MAX_BLOCKED_MS}ms for a pending approval/answer`);
460
+ }, MAX_BLOCKED_MS);
461
+ };
462
+ const resume = () => {
463
+ if (settled || workTimer)
464
+ return;
465
+ if (blockedTimer) {
466
+ clearTimeout(blockedTimer);
467
+ blockedTimer = null;
468
+ }
469
+ workStartedAt = Date.now();
470
+ workTimer = setTimeout(() => {
471
+ fireTimeout(`Timed out after ${timeoutMs}ms of working time`);
472
+ }, remainingMs);
473
+ };
474
+ // Expose pause/resume to the prompt handler (handleChildPrompt).
475
+ this.timeoutControllers.set(child.id, { pause, resume });
476
+ // Start the working clock.
477
+ workStartedAt = Date.now();
478
+ workTimer = setTimeout(() => {
479
+ fireTimeout(`Timed out after ${timeoutMs}ms of working time`);
480
+ }, remainingMs);
481
+ // Guard against overlapping async ground-truth checks when result
482
+ // events arrive in quick succession.
483
+ let verifying = false;
304
484
  // Result hook: Claude completed a turn
305
485
  const onResult = (sessionId, isError) => {
306
- if (sessionId !== child.id || settled)
486
+ if (sessionId !== child.id || settled || verifying)
307
487
  return;
308
488
  const session = this.sessions.get(child.id);
309
489
  if (!session) {
310
490
  child.status = 'failed';
311
491
  child.error = 'Session was deleted';
312
492
  child.completedAt = new Date().toISOString();
313
- clearTimeout(timer);
493
+ clearTimers();
314
494
  settle();
315
495
  return;
316
496
  }
317
- const text = this.extractText(session.outputHistory);
318
- // Check if the final step was done; if not, nudge (keep listening)
319
- if (this.ensureFinalStep(child, session, text, nudgedIds, supersededMsgs))
497
+ // Don't mark as completed (or nudge) while the session still has
498
+ // pending tool approvals or control requests the Claude process
499
+ // may still be alive and blocked on an approval (e.g. git push).
500
+ // Nudging here would waste the single nudge on a child that cannot
501
+ // act. Keep monitoring; the next result/exit event re-evaluates.
502
+ if (session.pendingToolApprovals.size > 0 || session.pendingControlRequests.size > 0) {
503
+ child.status = 'blocked';
504
+ pause();
320
505
  return;
321
- // Don't mark as completed while the session still has pending
322
- // tool approvals or control requests — the Claude process may
323
- // still be alive and blocked on an approval (e.g. git push).
324
- // Keep monitoring; the next result/exit event will re-evaluate.
325
- if (session.pendingToolApprovals.size > 0 || session.pendingControlRequests.size > 0)
326
- return;
327
- child.status = isError ? 'failed' : 'completed';
328
- child.result = text || null;
329
- child.error = isError ? 'Claude returned an error' : null;
330
- child.completedAt = new Date().toISOString();
331
- clearTimeout(timer);
332
- settle();
506
+ }
507
+ // The prompt (if any) was answered restart the working clock so
508
+ // post-approval work draws from the remaining working budget.
509
+ resume();
510
+ if (child.status === 'blocked')
511
+ child.status = 'running';
512
+ verifying = true;
513
+ void (async () => {
514
+ try {
515
+ const text = this.extractText(session.outputHistory);
516
+ // Ground-truth check: did the final step (PR / push) really land?
517
+ const missing = await this.isFinalStepMissing(child, text);
518
+ if (isSettled())
519
+ return;
520
+ // Final step missing — nudge once, then keep monitoring.
521
+ if (missing && !isError && !nudgedIds.has(child.id) && session.claudeProcess?.isAlive()) {
522
+ nudgedIds.add(child.id);
523
+ this.sessions.sendInput(child.id, this.buildNudgeInstruction(child.request.completionPolicy));
524
+ return;
525
+ }
526
+ child.status = isError ? 'failed' : 'completed';
527
+ child.result = text || null;
528
+ child.error = isError
529
+ ? 'Claude returned an error'
530
+ : missing
531
+ ? `Completion not verified: expected ${child.request.completionPolicy === 'pr' ? 'a pull request' : 'a pushed branch'} but found none`
532
+ : null;
533
+ child.completedAt = new Date().toISOString();
534
+ clearTimers();
535
+ settle();
536
+ }
537
+ finally {
538
+ verifying = false;
539
+ }
540
+ })();
333
541
  };
334
542
  // Exit hook: Claude process exited
335
543
  const onExit = (sessionId, _code, _signal, willRestart) => {
@@ -339,12 +547,23 @@ export class OrchestratorChildManager {
339
547
  return; // Will auto-restart, keep monitoring
340
548
  const session = this.sessions.get(child.id);
341
549
  const text = session ? this.extractText(session.outputHistory) : '';
342
- child.status = text.length > 100 ? 'completed' : 'failed';
343
- child.result = text || null;
344
- child.error = text.length <= 100 ? 'Claude exited without sufficient output' : null;
345
- child.completedAt = new Date().toISOString();
346
- clearTimeout(timer);
347
- settle();
550
+ void (async () => {
551
+ // Process is gone — decide the terminal status from ground truth
552
+ // (did the PR / push land?) rather than transcript length.
553
+ let missing = session ? await this.isFinalStepMissing(child, text) : true;
554
+ // commit-only has no remote artifact to verify; an exit without
555
+ // any output cannot be considered a success.
556
+ if (child.request.completionPolicy === 'commit-only' && !text)
557
+ missing = true;
558
+ if (isSettled())
559
+ return;
560
+ child.status = missing ? 'failed' : 'completed';
561
+ child.result = text || null;
562
+ child.error = missing ? 'Claude exited before the final step could be verified' : null;
563
+ child.completedAt = new Date().toISOString();
564
+ clearTimers();
565
+ settle();
566
+ })();
348
567
  };
349
568
  unsubResult = this.sessions.onSessionResult(onResult);
350
569
  unsubExit = this.sessions.onSessionExit(onExit);
@@ -354,6 +573,7 @@ export class OrchestratorChildManager {
354
573
  // Unsubscribe listeners to prevent accumulation across spawn() calls
355
574
  unsubResult?.();
356
575
  unsubExit?.();
576
+ this.timeoutControllers.delete(child.id);
357
577
  // Safety net: ensure isProcessing is cleared when monitoring ends.
358
578
  // handleClaudeResult should have already done this, but edge cases
359
579
  // (nudge race, missed result event) can leave the flag stuck.
@@ -364,44 +584,48 @@ export class OrchestratorChildManager {
364
584
  }
365
585
  }
366
586
  /**
367
- * Check whether the session completed the expected final step (PR, push, deploy).
368
- * If not, send a follow-up instruction and return true so monitoring continues.
369
- * Only nudges once per child to avoid infinite loops.
587
+ * Ground-truth check for the child's expected final step. Instead of
588
+ * sniffing the transcript for keywords (which both false-positives on
589
+ * mentions and false-negatives on terse output), ask the real systems:
590
+ * - 'pr': does an open/merged PR exist for the branch? (gh pr list)
591
+ * - 'merge': does the branch exist on the remote? (git ls-remote)
592
+ * - 'commit-only': nothing remote to verify — never missing.
593
+ * Falls back to transcript keyword sniffing when the command fails
594
+ * (e.g. gh not installed, no remote configured).
370
595
  */
371
- ensureFinalStep(child, session, text, nudgedIds, supersededMsgs) {
372
- // Only nudge once per child
373
- if (nudgedIds.has(child.id))
374
- return false;
596
+ async isFinalStepMissing(child, text) {
375
597
  const policy = child.request.completionPolicy;
376
- const lowerText = text.toLowerCase();
377
- let missing = false;
378
- let instruction = '';
598
+ if (policy === 'commit-only')
599
+ return false;
600
+ const cwd = child.worktreePath ?? child.request.repo;
601
+ const branch = child.request.branchName;
379
602
  if (policy === 'pr') {
380
- // Check if a PR was created
381
- const prCreated = lowerText.includes('pull request') || lowerText.includes('created a pr') || lowerText.includes('gh pr create');
382
- if (!prCreated) {
383
- missing = true;
384
- instruction = 'You completed the code changes but did not create a Pull Request. Please push your branch and create a PR now with a clear description of what was changed and why.';
603
+ try {
604
+ const out = await this.exec('gh', ['pr', 'list', '--head', branch, '--state', 'all', '--json', 'number', '--limit', '1'], cwd);
605
+ const parsed = JSON.parse(out);
606
+ return !(Array.isArray(parsed) && parsed.length > 0);
385
607
  }
386
- }
387
- else if (policy === 'merge') {
388
- // Check if changes were pushed
389
- const pushed = lowerText.includes('git push') || lowerText.includes('pushed');
390
- if (!pushed) {
391
- missing = true;
392
- instruction = 'You completed the code changes but did not push them. Please push your changes to the remote now.';
608
+ catch {
609
+ const lower = text.toLowerCase();
610
+ return !(lower.includes('pull request') || lower.includes('created a pr') || lower.includes('gh pr create'));
393
611
  }
394
612
  }
395
- if (missing && instruction && session.claudeProcess?.isAlive()) {
396
- nudgedIds.add(child.id);
397
- // Track the result message as superseded locally rather than mutating history entries
398
- const resultMsg = session.outputHistory.find(m => m.type === 'result');
399
- if (resultMsg)
400
- supersededMsgs.add(resultMsg);
401
- this.sessions.sendInput(child.id, instruction);
402
- return true;
613
+ // policy === 'merge' verify the branch was pushed to the remote
614
+ try {
615
+ const out = await this.exec('git', ['ls-remote', '--heads', 'origin', branch], cwd);
616
+ return out.trim().length === 0;
617
+ }
618
+ catch {
619
+ const lower = text.toLowerCase();
620
+ return !(lower.includes('git push') || lower.includes('pushed'));
621
+ }
622
+ }
623
+ /** Follow-up instruction sent (once) when the final step is missing. */
624
+ buildNudgeInstruction(policy) {
625
+ if (policy === 'pr') {
626
+ return 'You completed the code changes but no Pull Request exists for your branch yet. Please push your branch and create a PR now with a clear description of what was changed and why.';
403
627
  }
404
- return false;
628
+ return 'You completed the code changes but your branch has not been pushed to the remote. Please push your changes now.';
405
629
  }
406
630
  /**
407
631
  * Extract assistant text from session output history.
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator-children.js","sourceRoot":"","sources":["../orchestrator-children.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAGnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EACL,4BAA4B,GAE7B,MAAM,0BAA0B,CAAA;AAoCjC,sEAAsE;AACtE,MAAM,iBAAiB,GAA6B,IAAI,GAAG,CAAC;IAC1D,WAAW;IACX,QAAQ;IACR,WAAW;CACZ,CAAC,CAAA;AAwBF,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,cAAc,GAAG,CAAC,CAAA;AACxB,MAAM,kBAAkB,GAAG,OAAO,CAAA,CAAE,aAAa;AACjD,MAAM,kBAAkB,GAAG,SAAS,CAAA,CAAE,4CAA4C;AAClF,MAAM,qBAAqB,GAAG,GAAG,CAAA,CAAI,4BAA4B;AAEjE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,8DAA8D;IAC9D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IACvC,qDAAqD;IACrD,aAAa;IACb,4CAA4C;IAC5C,YAAY;IACZ,oDAAoD;IACpD,cAAc;IACd,mBAAmB;IACnB,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa;IAC3E,4BAA4B;IAC5B,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB;IACnE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa;IAC5D,yCAAyC;IACzC,YAAY,E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AS,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAA;YACnF,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAA;QAChC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;YAChC,OAAO,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;QAClE,CAAC;IACH,CAAC;IAED,wEAAwE;IAChE,qBAAqB,CAAC,MAA+C;QAC3E,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,OAAO,kLAAkL,CAAA;QAC3L,CAAC;QACD,OAAO,iHAAiH,CAAA;IAC1H,CAAC;IAED;;OAEG;IACK,WAAW,CAAC,OAA0B;QAC5C,OAAO,OAAO;aACX,MAAM,CAAC,CAAC,CAAC,EAAqD,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;aACrF,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;aAChB,IAAI,CAAC,EAAE,CAAC,CAAA;IACb,CAAC;CACF"}
@@ -7,8 +7,18 @@
7
7
  */
8
8
  import type { SessionManager } from './session-manager.js';
9
9
  export declare const ORCHESTRATOR_DIR: string;
10
+ /**
11
+ * Bump this whenever CLAUDE_MD_TEMPLATE changes. Already-seeded CLAUDE.md
12
+ * files carrying an older (or no) version stamp are refreshed on boot —
13
+ * without this, installs keep running on stale orchestrator instructions
14
+ * forever. CLAUDE.md is system-managed; user memory lives in PROFILE.md,
15
+ * REPOS.md and journal/, which are never overwritten.
16
+ */
17
+ export declare const CLAUDE_MD_TEMPLATE_VERSION = 2;
10
18
  /** Ensure the orchestrator workspace directory exists with starter files. */
11
19
  export declare function ensureOrchestratorDir(): void;
20
+ /** Parse the template version stamp from a seeded CLAUDE.md; 0 when absent. */
21
+ export declare function readTemplateVersion(path: string): number;
12
22
  /** Get or create a stable session UUID that persists across restarts. */
13
23
  export declare function getOrCreateOrchestratorId(): string;
14
24
  /** Check if a session is the orchestrator session. */