agents-relay 1.0.10 → 1.0.12

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.
@@ -1,5 +1,6 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { schedule, transitionTask } from './scheduler.js';
3
+ import { LaunchFailure } from './adapters.js';
3
4
  import { eventFor } from './events.js';
4
5
  import { parsePlannerResult, plannerInput } from './planner.js';
5
6
  const PRIORITY_RANK = { P0: 0, P1: 1, P2: 2, P3: 3 };
@@ -245,7 +246,9 @@ export class Reconciler {
245
246
  this.detach(this.timeoutTask(job.id, task.id, durableExecutionId), job.id, task.id, 'worker terminal-event timeout');
246
247
  }, Math.max(1, task.timeoutMs));
247
248
  this.terminalTimers.set(task.id, terminalTimer);
248
- this.detach(execution.promise.then(result => this.runtimeSettled(job.id, task.id, durableExecutionId, result, null), error => this.runtimeSettled(job.id, task.id, durableExecutionId, null, error instanceof Error ? error.message : String(error))), job.id, task.id, 'worker runtime completion');
249
+ this.detach(execution.promise.then(result => this.runtimeSettled(job.id, task.id, durableExecutionId, result, null), error => error instanceof LaunchFailure
250
+ ? this.failLaunch(job.id, task.id, durableExecutionId, error.message, 'delivery')
251
+ : this.runtimeSettled(job.id, task.id, durableExecutionId, null, error instanceof Error ? error.message : String(error))), job.id, task.id, 'worker runtime completion');
249
252
  }
250
253
  async launchPlanner(job, task) {
251
254
  const planner = this.options.planner;
@@ -344,12 +347,12 @@ export class Reconciler {
344
347
  clearTimeout(timer);
345
348
  this.terminalTimers.delete(taskId);
346
349
  }
347
- async failLaunch(jobId, taskId, executionId, message) {
350
+ async failLaunch(jobId, taskId, executionId, message, phase = 'launch') {
348
351
  const job = await this.store.load(jobId);
349
352
  const task = job.tasks.find(item => item.id === taskId);
350
353
  if (!task || task.executionId !== executionId || task.state !== 'RUNNING')
351
354
  return;
352
- const event = eventFor(jobId, taskId, task.parentTaskId, 'task.failed', 'failed', `Worker launch failed: ${message}`, 'user', { phase: 'launch' });
355
+ const event = eventFor(jobId, taskId, task.parentTaskId, 'task.failed', 'failed', `Worker ${phase} failed: ${message}`, 'user', { phase });
353
356
  await this.applyTerminalEvent(event);
354
357
  await this.emit(event);
355
358
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "type": "module",
6
6
  "bin": {