fix(config): preserve config data when validation fails
When readConfigFileSnapshot encounters validation errors, it now: 1. Returns the resolved config data instead of empty object 2. Uses passthrough() on main schema to preserve unknown fields This prevents config loss when: - User has custom/unknown fields - Legacy config issues are detected but config is otherwise valid - Zod schema does not recognize newer fields Fixes config being overwritten with empty object on validation failure.
This commit is contained in:
committed by
Peter Steinberger
parent
b32f6a0e00
commit
20ba8d4891
@@ -1757,6 +1757,7 @@ export const ClawdbotSchema = z
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.passthrough()
|
||||
.superRefine((cfg, ctx) => {
|
||||
const agents = cfg.agents?.list ?? [];
|
||||
if (agents.length === 0) return;
|
||||
|
||||
Reference in New Issue
Block a user