agents-relay 2.0.13 → 2.0.14

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/pool.js CHANGED
@@ -108,9 +108,14 @@ export class RepositoryWorkerPool {
108
108
  }
109
109
  const seedKey = `${target.repository}#${target.prNumber}:${jobId}`;
110
110
  const mayConsumeSeed = signals.some(signal => signal.reason === 'target.request' || signal.reason.startsWith('github.webhook:'));
111
- const seed = mayConsumeSeed ? this.targetSeeds.get(seedKey) ?? null : null;
111
+ let seed = mayConsumeSeed ? this.targetSeeds.get(seedKey) ?? null : null;
112
112
  if (mayConsumeSeed)
113
113
  this.targetSeeds.delete(seedKey);
114
+ const needsFreshPullRequestFacts = signals.some(signal => !signal.event || signal.event.type === 'task.completed');
115
+ if (!seed && needsFreshPullRequestFacts && this.refreshWebhookSnapshot && !this.isRateLimited()) {
116
+ const trigger = `coordinator.${signals.map(signal => signal.reason).join('+') || 'reconcile'}`;
117
+ seed = (await this.refreshWebhookSnapshot(target.repository, target.prNumber, trigger)).seed;
118
+ }
114
119
  const store = this.makeStore(target.repository, target.prNumber, seed);
115
120
  const reconciler = this.makeReconciler(store, Math.max(1, this.concurrency));
116
121
  let shouldReconcile = false;
@@ -289,7 +289,11 @@ export class ProjectedDurableStore {
289
289
  });
290
290
  }
291
291
  async ensurePullRequestFacts() {
292
- const local = await localPullRequestFacts(this.relay, this.seededFacts);
292
+ const local = await this.relay.loadPullRequestFacts();
293
+ if (this.seededFacts && (!local || this.seededFacts.observedAt >= local.observedAt)) {
294
+ await this.relay.savePullRequestFacts(structuredClone(this.seededFacts));
295
+ return this.seededFacts;
296
+ }
293
297
  if (local)
294
298
  return local;
295
299
  if (!this.github.pullRequestState || !this.github.pullRequestHead)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "2.0.13",
3
+ "version": "2.0.14",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "type": "module",
6
6
  "bin": {