fix(clients): older clients skip event types they don't know instead of breaking #13941
Mergedjuliusmarmingemerged 2 commits into
t3code/codex-turn-mapping fromrefs/pull/13941/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- @@ -442,6 +445,16 @@442- const fresh = items.filter((item) => {443- if (item.sequence <= sequence) return false;445+ const appliedSequence = yield* SubscriptionRef.get(lastSequence);446+ let sequence = appliedSequence;447+ const fresh: EventItem[] = [];448+ for (const item of items) {449+ if (item.sequence <= sequence) continue;450+ // An event type from a newer server still moves the resume cursor past it.444451 sequence = item.sequence;445- return true;446- });447- if (fresh.length === 0) return;452+ if (item.kind === "event") {453+ fresh.push(item);454+ continue;455+ }456+ yield* Effect.logDebug("Skipped a thread event type this client does not know.").pipe(457+ Effect.annotateLogs({458+ environmentId,459+ threadId,460+ eventType: item.eventType,
- @@ -443,5 +445,17 @@443- if (item.sequence <= sequence) return false;445+ const appliedSequence = yield* SubscriptionRef.get(lastSequence);446+ let sequence = appliedSequence;447+ const fresh: EventItem[] = [];448+ for (const item of items) {449+ if (item.sequence <= sequence) continue;450+ // An event type from a newer server still moves the resume cursor past it.444451 sequence = item.sequence;445- return true;446- });447- if (fresh.length === 0) return;452+ if (item.kind === "event") {453+ fresh.push(item);454+ continue;455+ }456+ yield* Effect.logDebug("Skipped a thread event type this client does not know.").pipe(457+ Effect.annotateLogs({458+ environmentId,459+ threadId,460+ // Bounded: the type comes from a newer server and is not validated here.461+ eventType: item.eventType.slice(0, 64),
juliusmarminge merged thisb222464
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed