Skip to content

Commit 011092a

Browse files
fix(opencode): store only safe finish response metadata
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <[email protected]>
1 parent c3fad8d commit 011092a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

packages/opencode/src/session/processor.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ export namespace SessionProcessor {
2323
const DOOM_LOOP_THRESHOLD = 3
2424
const log = Log.create({ service: "session.processor" })
2525

26+
function finishMetadata(input: Record<string, any> | undefined) {
27+
const id = typeof input?.openai?.responseId === "string" ? input.openai.responseId : undefined
28+
if (!id) return
29+
return { openai: { responseId: id } }
30+
}
31+
2632
export type Result = "compact" | "stop" | "continue"
2733

2834
export type Event = LLM.Event
@@ -277,7 +283,7 @@ export namespace SessionProcessor {
277283
id: PartID.ascending(),
278284
reason: value.finishReason,
279285
snapshot: yield* snapshot.track(),
280-
metadata: value.providerMetadata,
286+
metadata: finishMetadata(value.providerMetadata),
281287
messageID: ctx.assistantMessage.id,
282288
sessionID: ctx.assistantMessage.sessionID,
283289
type: "step-finish",

0 commit comments

Comments
 (0)