Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client-runtime): threads no longer stay on "Syncing messages..." after a failed resume #19570

Closedshivamhwp(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/19570/headopened View on GitHub

Showing 2 changed files with 126 additions and 3 deletions (loading 1).

x
0 of 2 viewed, 2 left
126 additions and 3 deletionspackages/client-runtime/src/state/threads-sync.test.tsModified
View file
@@ -67,7 +67,15 @@
thread: { ...v2Projection.thread, title: "Cached thread" },
};
​
-type TestThreadInput = OrchestrationV2ThreadStreamItem | Error;
+/** Ends the stream with a defect, like a chunk the client cannot decode. */
+class TestStreamDefect {
+ readonly message: string;
+ constructor(message: string) {
+ this.message = message;
+ }
+}
+​
+type TestThreadInput = OrchestrationV2ThreadStreamItem | Error | TestStreamDefect;
​
function testSession(
client: WsRpcProtocolClient,
@@ -118,6 +126,8 @@
const latest = yield* Ref.make<EnvironmentThreadState>(EMPTY_ENVIRONMENT_THREAD_STATE);
const retryCount = yield* Ref.make(0);
const subscriptionCount = yield* Ref.make(0);
+ const subscriptions = yield* Queue.unbounded<number | undefined>();
+ const streamsEnded = yield* Queue.unbounded<void>();
const loaderCalls = yield* Ref.make(0);
const lastSubscribeAfterSequence = yield* Ref.make<number | undefined>(undefined);
const lastRequestCompletionMarker = yield* Ref.make(false);
@@ -132,7 +142,11 @@
const streamFrom = (queue: Queue.Queue<TestThreadInput>) =>