Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a subagent's events are no longer stored twice across runs #14665

Mergedjuliusmarmingemerged 1 commit intot3code/codex-turn-mapping fromrefs/pull/14665/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 93 additions and 4 deletions.

x
0 of 3 viewed, 3 left
14 additions and 0 deletionsapps/server/src/orchestration-v2/testkit/fixtures/shared.tsModified
View file
@@ -1156,6 +1156,20 @@
assert.isNotEmpty(roots, `child ${childThreadId} must have a root turn`);
for (const root of roots) assert.isNull(root.runId);
+ // One run ingests a child thread at a time, so no update is stored by two.
+ const runByChildUpdate = new Map<string, string | undefined>();
+ for (const event of result.domainEvents) {
+ if (event.threadId !== childThreadId) continue;
+ const update = `${event.type}:${JSON.stringify(event.payload)}`;
+ const storedBy = runByChildUpdate.get(update);
+ if (runByChildUpdate.has(update) && storedBy !== event.runId) {
+ assert.fail(
+ `child ${childThreadId} stored ${event.type} in ${storedBy} and ${event.runId}`,
+ );
+ }
+ runByChildUpdate.set(update, event.runId);
+ }
+​
const rootEvents = result.domainEvents.flatMap((event, index) =>
event.type === "node.updated" &&
event.payload.threadId === childThreadId &&
64 additions and 2 deletionsapps/server/src/orchestration-v2/RunExecutionService.test.tsModified
View file
@@ -168,6 +168,67 @@
}),
​
+it("leaves a child thread created after the root turn ended to the run that is live then", () => {