Skip to content

Commit 025e430

Browse files
Apply PR #24229: fix: lazy session error schema
2 parents 058c428 + d704110 commit 025e430

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

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)