Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): resumed OpenCode subagents no longer fail the parent turn on a duplicate turn ordinal #19888

Closedlageorgem(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/19888/headopened View on GitHub

Showing 2 changed files with 129 additions and 41 deletions.

x
0 of 2 viewed, 2 left
99 additions and 0 deletionspackages/provider-opencode/src/server/adapter.test.tsModified
View file
@@ -902,6 +902,105 @@
​
+ it.effect("continues child turn ordinals when a later Task call resumes the same session", () =>
+ Effect.gen(function* () {
+ const nativeEvents = asyncEventStream();
+ const push = (event: unknown) => Effect.promise(() => nativeEvents.push(event));
+ const root = "ses_root";
+ const child = "ses_child";
+ let promptId = "";
+ const harness = yield* makeOpenCodeRuntimeHarness("resumed-child", root, {
+ event: { subscribe: async () => ({ stream: nativeEvents.stream }) },
+ session: {
+ create: async () => ({ data: { id: root, time: { created: 1, updated: 1 } } }),
+ get: async () => ({
+ data: { id: child, parentID: root, permission: [], time: { created: 2, updated: 2 } },
+ }),
+ update: async () => ({ data: { id: child, parentID: root } }),
+ promptAsync: async (input: { messageID: string }) => {
+ promptId = input.messageID;
+ return { data: true };
+ },
+ abort: async () => ({ data: true }),
+ children: async () => ({ data: [] }),
+ },
+ });
+ yield* harness.startTurn();
+ const received = yield* harness.runtime.events.pipe(
+ Stream.filter((event) => event.type === "provider_turn.updated"),