Skip to content
TypeScript

perf(opencode): stop retaining every message of a loaded OpenCode thread (#17784)

Tristan Knightb467be4ea7bb
diff --git a/packages/provider-opencode/src/server/adapter.ts b/packages/provider-opencode/src/server/adapter.ts
index 327d4d8cef4..b0b7f0ad29a 100644
--- a/packages/provider-opencode/src/server/adapter.ts
+++ b/packages/provider-opencode/src/server/adapter.ts
@@ -384,7 +384,6 @@ interface OpenCodeThreadState {
appThread: OrchestrationV2AppThread | null;
activeTurn: ActiveOpenCodeTurn | null;
readonly providerTurns: Map<string, OrchestrationV2ProviderTurn>;
- readonly messages: Map<string, OrchestrationV2ConversationMessage>;
readonly runtimeRequests: Map<string, OrchestrationV2RuntimeRequest>;
readonly messageRoles: Map<string, "user" | "assistant">;
readonly userMessageIds: Array<string>;
@@ -1257,7 +1256,6 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
createdAt: startedAt,
updatedAt: emittedAt,
};
- state.messages.set(String(message.id), message);
yield* emitProviderEvent({
type: "message.updated",
driver: OPENCODE_PROVIDER,
@@ -1428,7 +1426,6 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
appThread: childThread,
activeTurn: null,
providerTurns: new Map(),
- messages: new Map(),
runtimeRequests: new Map(),
messageRoles: new Map(),
userMessageIds: [],
@@ -2336,7 +2333,6 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
createdAt: turn.startedAt,
updatedAt: now,
};
- state.messages.set(String(messageId), projected);
yield* emitProviderEvent({
type: "message.updated",
driver: OPENCODE_PROVIDER,
@@ -2834,7 +2830,6 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
appThread,
activeTurn: null,
providerTurns: new Map(),
- messages: new Map(),
runtimeRequests: new Map(),
messageRoles: new Map(),
userMessageIds: [],