Skip to content

Commit c53342d

Browse files
committed
perf(opencode): stop retaining every message of a loaded OpenCode thread
The legacy OpenCode adapter copied each assistant message and each subagent prompt into a per-thread map that nothing read. Snapshots fetch messages from OpenCode itself, so the map only grew for the life of the session. Remove the field, its two initialisations and its two writes.
1 parent c77a7b7 commit c53342d

1 file changed

Lines changed: 0 additions & 5 deletions

File tree

‎packages/provider-opencode/src/server/adapter.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ interface OpenCodeThreadState {
384384
appThread: OrchestrationV2AppThread | null;
385385
activeTurn: ActiveOpenCodeTurn | null;
386386
readonly providerTurns: Map<string, OrchestrationV2ProviderTurn>;
387-
readonly messages: Map<string, OrchestrationV2ConversationMessage>;
388387
readonly runtimeRequests: Map<string, OrchestrationV2RuntimeRequest>;
389388
readonly messageRoles: Map<string, "user" | "assistant">;
390389
readonly userMessageIds: Array<string>;
@@ -1257,7 +1256,6 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
12571256
createdAt: startedAt,
12581257
updatedAt: emittedAt,
12591258
};
1260-
state.messages.set(String(message.id), message);
12611259
yield* emitProviderEvent({
12621260
type: "message.updated",
12631261
driver: OPENCODE_PROVIDER,
@@ -1428,7 +1426,6 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
14281426
appThread: childThread,
14291427
activeTurn: null,
14301428
providerTurns: new Map(),
1431-
messages: new Map(),
14321429
runtimeRequests: new Map(),
14331430
messageRoles: new Map(),
14341431
userMessageIds: [],
@@ -2336,7 +2333,6 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
23362333
createdAt: turn.startedAt,
23372334
updatedAt: now,
23382335
};
2339-
state.messages.set(String(messageId), projected);
23402336
yield* emitProviderEvent({
23412337
type: "message.updated",
23422338
driver: OPENCODE_PROVIDER,
@@ -2834,7 +2830,6 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
28342830
appThread,
28352831
activeTurn: null,
28362832
providerTurns: new Map(),
2837-
messages: new Map(),
28382833
runtimeRequests: new Map(),
28392834
messageRoles: new Map(),
28402835
userMessageIds: [],

0 commit comments

Comments
 (0)