Skip to content

Commit ceaca29

Browse files
Apply PR #24229: fix: lazy session error schema
2 parents 0ec57ac + d704110 commit ceaca29

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
@@ -302,7 +302,8 @@ export const Event = {
302302
sessionID: Schema.optional(SessionID),
303303
// Reuses MessageV2.Assistant.fields.error (already Schema.optional) so
304304
// the derived zod keeps the same discriminated-union shape on the bus.
305-
error: MessageV2.Assistant.fields.error,
305+
// Schema.suspend defers access to break circular init in compiled binaries.
306+
error: Schema.suspend(() => MessageV2.Assistant.fields.error),
306307
}),
307308
),
308309
}

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)