Skip to content

Commit 702fd0e

Browse files
committed
fix(config): address review comments on PR #29208
- Use safe fallback for Info decode ({} as Info) instead of Schema.decodeSync - Use Cause.pretty for plugin resolution error logging - Strengthen test assertion with specific value
1 parent 6378082 commit 702fd0e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

packages/opencode/src/config/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ export const layer = Layer.effect(
431431
Effect.catchCause((cause) =>
432432
Effect.sync(() => {
433433
log.error("invalid config: config file could not be parsed", { path: source, cause: Cause.pretty(cause) })
434-
return Schema.decodeSync(Info)({})
434+
return {} as Info
435435
}),
436436
),
437437
)
@@ -440,7 +440,7 @@ export const layer = Layer.effect(
440440
yield* Effect.promise(() => resolveLoadedPlugins(data, options.path)).pipe(
441441
Effect.catchCause((cause) =>
442442
Effect.sync(() => {
443-
log.error("plugin resolution failed", { path: source, cause })
443+
log.error("plugin resolution failed", { path: source, cause: Cause.pretty(cause) })
444444
}),
445445
),
446446
)

packages/opencode/test/config/config.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,11 @@ it.instance("handles invalid schema gracefully without crashing", () =>
585585
const test = yield* TestInstance
586586
yield* writeConfigEffect(test.directory, {
587587
$schema: "https://opencode.ai/config.json",
588+
model: "test/model",
588589
invalid_field: "should cause error",
589590
})
590591
const config = yield* Config.use.get()
591-
expect(config.username).toBeDefined()
592+
expect(config.model).toBe("test/model")
592593
expect("invalid_field" in config).toBe(false)
593594
}),
594595
)

0 commit comments

Comments
 (0)