agents-relay 1.0.131 → 1.0.132

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,5 @@
1
1
  import { storySizeTimeoutMs, taskOverallTimeoutMs } from './types.js';
2
- import { schedule, transitionTaskEvent, transitionJobEvent } from './scheduler.js';
2
+ import { schedule, transitionTaskEvent, transitionJobEvent, tryTransitionTaskEvent } from './scheduler.js';
3
3
  import { implementationComplete, implementationTasks } from './runtime-status.js';
4
4
  import { eventFor } from './events.js';
5
5
  import { routeWorker, workerCandidates } from './worker-routing.js';
@@ -154,6 +154,16 @@ export class ReconcilerReviewBase extends ReconcilerRuntimeBase {
154
154
  const currentHeadSha = await this.store.headSha?.();
155
155
  if ((currentHeadSha && currentHeadSha !== headSha) || (job.headSha && job.headSha !== headSha))
156
156
  return;
157
+ const taskDecision = tryTransitionTaskEvent(task, event.type);
158
+ if (!taskDecision.accepted || !taskDecision.target)
159
+ return;
160
+ task.error = null;
161
+ if (taskDecision.target !== 'RUNNING') {
162
+ task.leaseOwner = null;
163
+ task.leaseExpiresAt = null;
164
+ task.executionId = null;
165
+ }
166
+ await this.store.saveTask(task);
157
167
  const evidence = { summary: event.message || `Review ${outcome}`, data: { ...(event.data ?? {}), review: reviewData ?? { headSha }, headSha, outcome } };
158
168
  job.review = { outcome, headSha, taskId: task.id, evidence, updatedAt: event.timestamp || new Date().toISOString() };
159
169
  if (outcome === 'changes_required') {
@@ -14,7 +14,10 @@ export const WORKFLOW_EVENT_NAMES = [
14
14
  'reconcile',
15
15
  'release',
16
16
  'retry',
17
+ 'review.started',
17
18
  'review.approved',
19
+ 'review.changes_required',
20
+ 'review.blocked',
18
21
  'task.blocked',
19
22
  'task.cancelled',
20
23
  'task.completed',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "1.0.131",
3
+ "version": "1.0.132",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,6 +11,10 @@ stateDiagram-v2
11
11
  QUEUED --> QUEUED: reconcile [runnable] / mutation.clearError,mutation.clearFailureReason
12
12
  QUEUED --> QUEUED: dispatch [dispatchable] / effect.launchTask
13
13
  QUEUED --> RUNNING: task.started / mutation.clearError,mutation.clearFailureReason
14
+ QUEUED --> RUNNING: review.started / mutation.clearError,mutation.clearFailureReason
15
+ QUEUED --> SUCCEEDED: review.approved / mutation.clearError,mutation.clearFailureReason
16
+ QUEUED --> SUCCEEDED: review.changes_required / mutation.clearError,mutation.clearFailureReason
17
+ QUEUED --> BLOCKED: review.blocked
14
18
  QUEUED --> BLOCKED: block
15
19
  QUEUED --> FAILED: fail
16
20
  QUEUED --> FAILED: effect.launchTask.failed
@@ -20,6 +24,9 @@ stateDiagram-v2
20
24
  QUEUED --> CANCELLED: cancel
21
25
 
22
26
  RUNNING --> BLOCKED: task.blocked
27
+ RUNNING --> SUCCEEDED: review.approved / mutation.clearError,mutation.clearFailureReason
28
+ RUNNING --> SUCCEEDED: review.changes_required / mutation.clearError,mutation.clearFailureReason
29
+ RUNNING --> BLOCKED: review.blocked
23
30
  RUNNING --> SUCCEEDED: task.completed / mutation.clearError,mutation.clearFailureReason
24
31
  RUNNING --> FAILED: task.failed
25
32
  RUNNING --> FAILED: watchdog.failed