Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): Codex item maps no longer grow and copy for the whole session #13876

Mergedjuliusmarmingemerged 1 commit intot3code/codex-turn-mapping fromrefs/pull/13876/headmerged by juliusmarminge View on GitHub

Showing 1 changed file with 21 additions and 29 deletions.

x
0 of 1 viewed, 1 left
21 additions and 29 deletionsapps/server/src/orchestration-v2/Adapters/CodexAdapterV2.tsModified
View file
@@ -1030,6 +1030,13 @@
readonly rootNodeId: OrchestrationV2ExecutionNode["id"];
readonly subagent: CodexSubagentThreadContext | null;
readonly startedAt: DateTime.Utc;
+ // Item positions allocated in this turn. Later turns never look items up
+ // here: late background items resolve their settled turn's context, and a
+ // subagent's approvals allocate on the owning root turn.
+ readonly itemPositions: Map<
+ string,
+ { readonly ordinal: number; readonly startedAt: DateTime.Utc }
+ >;
interface ActiveCodexProviderRetry {
@@ -1639,14 +1646,11 @@
new Map<string, ReadonlyArray<PendingCodexSubagentTurnStarted>>(),
const nextProviderTurnOrdinals = yield* Ref.make(new Map<string, number>());
- const itemPositions = yield* Ref.make(
- new Map<string, { readonly ordinal: number; readonly startedAt: DateTime.Utc }>(),
- );
- const nextItemOrdinalsByTurn = yield* Ref.make(new Map<string, number>());
const providerRetries = yield* Ref.make(
new Map<ProviderTurnId, ActiveCodexProviderRetry>(),
- const planDeltas = yield* Ref.make(new Map<string, string>());
+ // Streamed plan text per plan item, dropped when the item completes.
+ const planDeltas = new Map<string, string>();
const planIds = yield* Ref.make(new Map<string, OrchestrationV2PlanArtifact["id"]>());