iterate.com / cloud

git clone https://git.iterate.com/repos/cloud

cloud-rehearsal install: the wait for the commit's outcome reads payload.trigger.commitOid (#2)

The install script waited with `payload: { commitOid }, afterOffset: 0`, which never matches the outcome events as they are now. It reads where the root log ends before the commit and takes each outcome after it until one names the commit.

Checked: the generated script parses. Not run against a mind. No deploy: an operator script.

Card: tasks/make-four-code-callers-read-worker-updated-s-payload-trigger.md

Via: /agents/claude/run-guide-wait-example-mx0wxfcb-5a973d
Session: claude 7ba4426c-d452-4c93-804a-9c3c1791d4c7 on beelink

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01Wq8CaYLKDR5JeKxYYoJYJp

Iterate-Run: /@1906397

jonas, 2026-11-28 21:32 UTC · aacbc7450ff23fffc9210accd6c881bcf2f08113 · parent cd0b1dd

1 file changed

M scripts/cloud-rehearsal/install.ts
@@ -69,8 +69,17 @@
 const before = { "apps/cloud-rehearsal/mind.ts": mind, "apps/cloud-rehearsal/backend.ts": backend, "api.ts": api, "agents.ts": agents };
 const changes = Object.entries(files).filter(([path, content]) => before[path] !== content).map(([path, content]) => ({ path, content }));
 if (changes.length === 0) return "The rehearsal app is installed already, and nothing differs.";
+// where the root log ends now: the outcome of the commit lands after it
+const head = (await itx.readEvents(Number.MAX_SAFE_INTEGER, 1)).scannedThroughOffset;
 const { commitOid } = await repo.commitFiles({ message: "apps/cloud-rehearsal: a rehearsal of iterate Cloud's sign-up, with its agent's rows and tools and a fake Cloudflare\\n\\nCopied from iterate/iterate-config apps/cloud.\\n\\nVia: scripts/cloud-rehearsal/install.ts", parent: tip, changes });
-const outcome = await itx.waitForEvent({ type: ["events.iterate.com/mind/worker-updated", "events.iterate.com/mind/worker-update-failed"], payload: { commitOid }, afterOffset: 0, timeoutMs: 120000 });
+// An outcome names its commit in payload.trigger.commitOid, and a payload filter compares
+// top-level fields alone: take each outcome after the head until one names this commit.
+let outcome;
+let after = head;
+do {
+  outcome = await itx.waitForEvent({ type: ["events.iterate.com/mind/worker-updated", "events.iterate.com/mind/worker-update-failed"], afterOffset: after, timeoutMs: 120000 });
+  after = outcome.offset;
+} while (outcome.payload.trigger?.commitOid !== commitOid);
 if (outcome.payload.error) throw new Error(outcome.payload.error);
 return "Installed in commit " + commitOid + ": " + changes.map((change) => change.path).join(", ");`;