authorgravatar for me@t3.ggTheo Browne <me@t3.gg> 2026-09-04 07:19:43-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-04 07:19:43-07:00
logf2e3764c257a7e27c8171d7dd1e38d4383074206
treead794389b79503d4a175e4ecab98061bee5cfca5
parent2263e13fda8c9a4f1b6f4dee32e3c9020195e2aa
signature Signed by PGP key B5690EEEBB952194

perf(server): stop retaining unused OpenCode tool history (#9684)


1 files changed, 0 insertions(+), 28 deletions(-)

apps/server/src/provider/Layers/OpenCodeAdapter.ts-28
...@@ -338,7 +338,6 @@ interface OpenCodeSessionContext {...@@ -338,7 +338,6 @@ interface OpenCodeSessionContext {
338 readonly partById: Map<string, Part>;338 readonly partById: Map<string, Part>;
339 readonly emittedTextByPartId: Map<string, string>;339 readonly emittedTextByPartId: Map<string, string>;
340 readonly completedAssistantPartIds: Set<string>;340 readonly completedAssistantPartIds: Set<string>;
341 readonly turns: Array<OpenCodeTurnSnapshot>;
342 activeTurnId: TurnId | undefined;341 activeTurnId: TurnId | undefined;
343 activeAgent: string | undefined;342 activeAgent: string | undefined;
344 activeVariant: string | undefined;343 activeVariant: string | undefined;
...@@ -476,31 +475,6 @@ function mapPermissionDecision(reply: "once" | "always" | "reject"): string {...@@ -476,31 +475,6 @@ function mapPermissionDecision(reply: "once" | "always" | "reject"): string {
476 }475 }
477}476}
478477
479function resolveTurnSnapshot(
480 context: OpenCodeSessionContext,
481 turnId: TurnId,
482): OpenCodeTurnSnapshot {
483 const existing = context.turns.find((turn) => turn.id === turnId);
484 if (existing) {
485 return existing;
486 }
487
488 const created: OpenCodeTurnSnapshot = { id: turnId, items: [] };
489 context.turns.push(created);
490 return created;
491}
492
493function appendTurnItem(
494 context: OpenCodeSessionContext,
495 turnId: TurnId | undefined,
496 item: unknown,
497): void {
498 if (!turnId) {
499 return;
500 }
501 resolveTurnSnapshot(context, turnId).items.push(item);
502}
503
504const ensureSessionContext = Effect.fn("ensureSessionContext")(function* (478const ensureSessionContext = Effect.fn("ensureSessionContext")(function* (
505 sessions: ReadonlyMap<ThreadId, OpenCodeSessionContext>,479 sessions: ReadonlyMap<ThreadId, OpenCodeSessionContext>,
506 threadId: ThreadId,480 threadId: ThreadId,
...@@ -2365,7 +2339,6 @@ export function makeOpenCodeAdapter(...@@ -2365,7 +2339,6 @@ export function makeOpenCodeAdapter(
2365 : "item.updated",2339 : "item.updated",
2366 payload,2340 payload,
2367 };2341 };
2368 appendTurnItem(context, turnId, part);
2369 yield* emit(runtimeEvent);2342 yield* emit(runtimeEvent);
2370 }2343 }
2371 break;2344 break;
...@@ -2853,7 +2826,6 @@ export function makeOpenCodeAdapter(...@@ -2853,7 +2826,6 @@ export function makeOpenCodeAdapter(
2853 emittedTextByPartId: new Map(),2826 emittedTextByPartId: new Map(),
2854 messageRoleById: new Map(),2827 messageRoleById: new Map(),
2855 completedAssistantPartIds: new Set(),2828 completedAssistantPartIds: new Set(),
2856 turns: [],
2857 activeTurnId: undefined,2829 activeTurnId: undefined,
2858 activeAgent: undefined,2830 activeAgent: undefined,
2859 activeVariant: undefined,2831 activeVariant: undefined,