Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): Cursor item ordinals no longer copy a session-wide map per item #13866

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

Showing 1 changed file with 12 additions and 23 deletions.

x
0 of 1 viewed, 1 left
12 additions and 23 deletionsapps/server/src/orchestration-v2/Adapters/CursorAdapterV2.tsModified
View file
@@ -858,6 +858,8 @@
readonly providerTurnId: OrchestrationV2ProviderTurn["id"];
readonly startedAt: DateTime.Utc;
readonly completed: Deferred.Deferred<void, never>;
+ // Item ordinals allocated in this turn. No later turn looks items up here.
+ readonly itemOrdinals: Map<string, number>;
readonly tools: Map<string, ActiveCursorToolCall>;
readonly subagents: Map<string, ActiveCursorSubagent>;
readonly assistant: ActiveCursorTextStream;
@@ -908,35 +910,21 @@
const events = yield* Queue.unbounded<ProviderAdapterV2Event>();
const liveAgent = yield* Ref.make<CursorLiveAgent | null>(null);
const activeTurn = yield* Ref.make<ActiveCursorTurn | null>(null);
- const itemOrdinals = yield* Ref.make(new Map<string, number>());
- const nextItemOrdinalsByTurn = yield* Ref.make(new Map<string, number>());
const planIds = yield* Ref.make(new Map<string, OrchestrationV2PlanArtifact["id"]>());
​
const emitProviderEvent = (event: ProviderAdapterV2Event) =>
Queue.offer(events, event).pipe(Effect.asVoid);
​
- const resolveItemOrdinal = Effect.fnUntraced(function* (
- context: ActiveCursorTurn,
- nativeItemId: string,
- ) {
- const existing = (yield* Ref.get(itemOrdinals)).get(nativeItemId);
- if (existing !== undefined) {
- return existing;
- }
- const nextWithinTurn = yield* Ref.modify(nextItemOrdinalsByTurn, (current) => {