@zq-silk/yui 0.11.0 → 0.11.2

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.
@@ -1485,9 +1485,10 @@ export class SqliteTaskStore {
1485
1485
  if (round === null) {
1486
1486
  throw new StorageRecordError(`Agent run ReviewRound not found: ${run.reviewRoundId}.`);
1487
1487
  }
1488
+ const roundWorkItemId = round.workItemId ?? round.legacyAnchor?.workItemId;
1488
1489
  const laneRole = round.executionGroup?.lanes
1489
1490
  .find(({ id }) => id === run.executionLaneId)?.roleName;
1490
- if (round.workItemId !== run.workItemId
1491
+ if (roundWorkItemId !== run.workItemId
1491
1492
  || (round.reviewerRoleName !== run.roleName && laneRole !== run.roleName)) {
1492
1493
  throw new StorageRecordError(`Agent run does not match ReviewRound: ${run.id}.`);
1493
1494
  }
@@ -998,8 +998,9 @@ export class FileTaskStore {
998
998
  if (round === undefined) {
999
999
  throw new StorageRecordError(`Agent run ReviewRound not found: ${stored.reviewRoundId}.`);
1000
1000
  }
1001
+ const roundWorkItemId = round.workItemId ?? round.legacyAnchor?.workItemId;
1001
1002
  const laneRole = round.executionGroup?.lanes.find(({ id }) => id === stored.executionLaneId)?.roleName;
1002
- if (round.workItemId !== stored.workItemId
1003
+ if (roundWorkItemId !== stored.workItemId
1003
1004
  || (round.reviewerRoleName !== stored.roleName && laneRole !== stored.roleName)) {
1004
1005
  throw new StorageRecordError(`Agent run does not match ReviewRound: ${stored.id}.`);
1005
1006
  }
@@ -275,12 +275,16 @@ export function populateSqliteFromState(home, state, databaseFilename) {
275
275
  for (const snapshot of Object.values(stored.contextSnapshots)) {
276
276
  store.saveContextSnapshot(snapshot);
277
277
  }
278
- for (const run of Object.values(stored.agentRuns)) {
279
- store.saveAgentRun(run);
280
- }
278
+ // Review Agent Runs carry a strict reference to their ReviewRound, so
279
+ // persist the parent records before any Run that belongs to one. A
280
+ // ReviewRound may name its Reviewer Run, but saveReviewRound deliberately
281
+ // accepts that forward reference while the fresh database is populated.
281
282
  for (const round of Object.values(stored.reviewRounds)) {
282
283
  store.saveReviewRound(taskId, round);
283
284
  }
285
+ for (const run of Object.values(stored.agentRuns)) {
286
+ store.saveAgentRun(run);
287
+ }
284
288
  for (const changeSet of Object.values(stored.changeSets)) {
285
289
  store.saveChangeSet(taskId, changeSet);
286
290
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zq-silk/yui",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Local control plane for long-running native agent CLI sessions backed by tmux.",
5
5
  "license": "MIT",
6
6
  "private": false,