agents-relay 1.0.142 → 1.0.143

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/blockers.js CHANGED
@@ -62,9 +62,10 @@ export async function resolveBlockerDependencies(options) {
62
62
  return { resumed: 0, obsolete: 0, waiting };
63
63
  }
64
64
  const now = options.now ?? new Date().toISOString();
65
+ const relations = blocker.unblocks ?? [];
65
66
  let resumed = 0;
66
67
  let obsolete = 0;
67
- for (const relation of blocker.unblocks ?? []) {
68
+ for (const relation of relations) {
68
69
  if (relation.state !== 'waiting')
69
70
  continue;
70
71
  const store = options.dependentStore(relation.repository, relation.prNumber);
@@ -110,8 +111,16 @@ export async function resolveBlockerDependencies(options) {
110
111
  relation.note = 'dependent task requeued';
111
112
  resumed += 1;
112
113
  }
114
+ const remaining = relations.filter(relation => relation.state === 'waiting');
115
+ const consumed = remaining.length !== relations.length;
116
+ if (!consumed)
117
+ return { resumed, obsolete, waiting: remaining.length };
118
+ if (remaining.length > 0)
119
+ blocker.unblocks = remaining;
120
+ else
121
+ delete blocker.unblocks;
113
122
  blocker.blockerResolvedAt = now;
114
123
  blocker.updatedAt = now;
115
124
  await options.blockerStore.saveJob(blocker);
116
- return { resumed, obsolete, waiting: (blocker.unblocks ?? []).filter(item => item.state === 'waiting').length };
125
+ return { resumed, obsolete, waiting: remaining.length };
117
126
  }
@@ -275,10 +275,13 @@ export class GitHubStore {
275
275
  const conflicts = jobComments.filter(comment => parseJob(comment.body)?.id !== job.id);
276
276
  if (conflicts.length > 0)
277
277
  throw new Error(`PR #${this.prNumber} already has a different ${JOB_MARKER} marker`);
278
- await this.updatePullRequestBody(renderJobBody(job));
279
- const persisted = parseJob(await this.pullRequestBody());
280
- if (!persisted || persisted.id !== job.id)
281
- throw new Error(`Failed to persist ${JOB_MARKER} marker in PR #${this.prNumber} body for job ${job.id}`);
278
+ const nextBody = renderJobBody(job);
279
+ if (currentBody !== nextBody) {
280
+ await this.updatePullRequestBody(nextBody);
281
+ const persisted = parseJob(await this.pullRequestBody());
282
+ if (!persisted || persisted.id !== job.id)
283
+ throw new Error(`Failed to persist ${JOB_MARKER} marker in PR #${this.prNumber} body for job ${job.id}`);
284
+ }
282
285
  for (const legacy of jobComments.filter(comment => parseJob(comment.body)?.id === job.id))
283
286
  await this.deleteComment(legacy);
284
287
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "1.0.142",
3
+ "version": "1.0.143",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "type": "module",
6
6
  "bin": {