Skip to content

Commit c633ea7

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

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
@@ -316,7 +316,8 @@ export const Event = {
316316
sessionID: Schema.optional(SessionID),
317317
// Reuses MessageV2.Assistant.fields.error (already Schema.optional) so
318318
// the derived zod keeps the same discriminated-union shape on the bus.
319-
error: MessageV2.Assistant.fields.error,
319+
// Schema.suspend defers access to break circular init in compiled binaries.
320+
error: Schema.suspend(() => MessageV2.Assistant.fields.error),
320321
}),
321322
),
322323
}

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)