Skip to content

Commit 2c974e0

Browse files
Apply PR #24229: fix: lazy session error schema
2 parents e72328f + d704110 commit 2c974e0

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

packages/opencode/src/session/session.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ export const Event = {
293293
sessionID: Schema.optional(SessionID),
294294
// Reuses MessageV2.Assistant.fields.error (already Schema.optional) so
295295
// the derived zod keeps the same discriminated-union shape on the bus.
296-
error: MessageV2.Assistant.fields.error,
296+
// Schema.suspend defers access to break circular init in compiled binaries.
297+
error: Schema.suspend(() => MessageV2.Assistant.fields.error),
297298
}),
298299
),
299300
}

packages/opencode/src/util/effect-zod.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ function body(ast: SchemaAST.AST): z.ZodTypeAny {
256256
return array(ast)
257257
case "Declaration":
258258
return decl(ast)
259+
case "Suspend":
260+
return z.lazy(() => walk(ast.thunk()))
259261
default:
260262
return fail(ast)
261263
}

0 commit comments

Comments
 (0)