From 460e537b38648a67d609f6cd764865a15906f1ca Mon Sep 17 00:00:00 2001 From: femzyomos Date: Sun, 9 Aug 2026 07:35:23 -0400 Subject: [PATCH] fix(cli): bound cold subscribe so large channels can post Full-history syncRoom (since_seq 0) can exceed ProtocolClient's 5s inter-frame wait on large channels, timing out post/status/inbox. Pass hydrate_limit on cold subscribe and raise the sync frame wait. --- packages/cli/src/program.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/program.ts b/packages/cli/src/program.ts index e22324ce..22ace3a2 100644 --- a/packages/cli/src/program.ts +++ b/packages/cli/src/program.ts @@ -226,14 +226,25 @@ interface RoomSnapshot { } // harn:assume cli-waits-consume-only-matching-deliveries ref=collaboration-room-sync +// Cold subscribe without a bound replays the full channel history. On large +// channels that can exceed ProtocolClient's default 5s inter-frame wait and +// fail `codor post` / `status` / `inbox` with "timed out waiting for server +// frame". Use the protocol hydrate_limit cold bound and a longer frame wait. +const SYNC_HYDRATE_LIMIT = 500; +const SYNC_FRAME_TIMEOUT_MS = 60_000; async function syncRoom(client: ProtocolClient, room: string): Promise { let self: string | undefined; const members = new Map(); const messages = new Map(); const deliveries = new Map(); - client.send({ type: 'subscribe', room, since_seq: 0 }); + client.send({ + type: 'subscribe', + room, + since_seq: 0, + hydrate_limit: SYNC_HYDRATE_LIMIT, + }); for (;;) { - const frame = await client.next(); + const frame = await client.next(SYNC_FRAME_TIMEOUT_MS); if (frame.type === 'error') throw new Error(frame.message); if (frame.type === 'self') self = frame.member_id; else if (frame.type === 'member') members.set(frame.member.id, frame.member);