Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): bound legacy thread projection requests #10512

Mergedcjavad(GitHub profile, opens in a new tab)merged 1 commit intot3code/codex-turn-mapping fromrefs/pull/10512/headmerged by juliusmarminge View on GitHub

Showing 1 changed file with 25 additions and 11 deletions.

x
0 of 1 viewed, 1 left
25 additions and 11 deletionsapps/server/src/ws.tsModified
View file
@@ -138,8 +138,9 @@
THREAD_RESUME_MAX_REPLAY_EVENTS,
} from "./orchestration-v2/ThreadStream.ts";
import {
- THREAD_HISTORY_SNAPSHOT_ROW_LIMIT,
+ buildBoundedThreadProjection,
THREAD_HISTORY_PAGE_POLICY,
+ THREAD_HISTORY_SNAPSHOT_ROW_LIMIT,
} from "./orchestration-v2/threadHistoryPaging.ts";
import {
projectDomainEventForWire,
@@ -1811,17 +1812,30 @@
[ORCHESTRATION_V2_WS_METHODS.getThreadProjection]: (input) =>
observeRpcEffect(
ORCHESTRATION_V2_WS_METHODS.getThreadProjection,
- threadManagement.getThreadProjection(input.threadId).pipe(
- Effect.map(projectThreadProjectionForWire),
- Effect.mapError(
- (cause) =>
- new OrchestrationV2GetThreadProjectionError({
- threadId: input.threadId,
- message: `Failed to load orchestration V2 thread ${input.threadId}`,
- cause,
- }),
+ // Pre-pagination clients still call this compatibility endpoint.
+ // Keep stale clients from materializing an unbounded transcript.
+ threadManagement
+ .getThreadSnapshotWindow(input.threadId, {
+ rowLimit: THREAD_HISTORY_SNAPSHOT_ROW_LIMIT,