Skip to content

Commit b1351e0

Browse files
authored
🤖 fix: remove duplicate caught-up event in onChat subscription (#949)
## Summary The `onChat` handler was pushing a `caught-up` event after `replayHistory`, but `replayHistory` already sends `caught-up` at the end of `emitHistoricalEvents`. This resulted in two `caught-up` events being sent to the client. ## Changes - Removed the duplicate `push({ type: "caught-up" })` from the router since `session.replayHistory()` already sends it ## Testing - Existing integration tests pass (`resumeStream.test.ts`) - `WorkspaceStore.test.ts` passes - Typecheck passes --- _Generated with `mux`_
1 parent 75cacba commit b1351e0

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/node/orpc/router.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,11 @@ export const router = (authToken?: string) => {
370370
push(message);
371371
});
372372

373-
// 2. Replay history
373+
// 2. Replay history (sends caught-up at the end)
374374
await session.replayHistory(({ message }) => {
375375
push(message);
376376
});
377377

378-
// 3. Signal that subscription is established and history replay is complete
379-
// This allows clients to know when they can safely send messages without
380-
// missing events due to async generator setup timing
381-
push({ type: "caught-up" });
382-
383378
try {
384379
yield* iterate();
385380
} finally {

0 commit comments

Comments
 (0)