mirror of
https://github.com/openclaw/nix-openclaw.git
synced 2026-07-25 05:35:30 -04:00
Generated config options broken: oneOf-of-consts should collapse to single enum #19
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jakehemmerle on GitHub (Jan 31, 2026).
Summary
nix/generated/openclaw-config-options.nixproduces invalid Nix types for any schema field backed by a Zod enum. This makesprograms.openclaw.configunusable for most configuration — setting any enum-typed field (e.g.gateway.bind,gateway.auth.mode,models.mode,channels.telegram.dmPolicy) causes a Nix evaluation error:Since
configdefaults to{}, everydarwin-rebuild switch/home-manager switchoverwrites~/.openclaw/openclaw.jsonwith{}, destroying the user's runtime config.Root Cause
In
nix/scripts/generate-config-options.ts, theoneOfandconsthandlers interact badly:z.enum(["auto", "lan", "tailnet"])become JSON SchemaoneOfwith individual{ const: "auto" },{ const: "lan" }, etc.oneOfhandler maps each entry throughtypeForSchema:{ const: "value" }hits theconsthandler:t.oneOfexpects a list of instantiated types (attribute sets withcheck,merge, etc.).t.enum [ "auto" ]is a valid type, but Nix evaluatest.oneOf [ t.enum [ "auto" ] t.enum [ "lan" ] ... ]as passing the functiont.enumas a list element (due to how Nix tokenizes), not calling it.The correct output should be:
Suggested Fix
In
baseTypeForSchema, detect whenoneOf/anyOfcontains onlyconstentries and collapse them into a singlet.enum:Same pattern needed for the
anyOfhandler.Then regenerate
nix/generated/openclaw-config-options.nix.Impact
Every user who runs
darwin-rebuild switchorhome-manager switchgets their~/.openclaw/openclaw.jsonreplaced with{}becauseprograms.openclaw.configcan't hold any meaningful values. The only workaround is manual backup/restore of the config file after every rebuild.Reproduction
Environment
616bbdf0acabe7559b577fda6c63036d518b3ac8@avanderbergh commented on GitHub (Feb 1, 2026):
+1
I have the same issue, @zsoerenm will you make a PR with your commit?
@zsoerenm commented on GitHub (Feb 1, 2026):
I don't think it will accepted see
From the Readme
@avanderbergh commented on GitHub (Feb 1, 2026):
Aaah, I see... 😅
So you're just installing from your fork then? It's kinda broken since it can't set gateway.mode which is required for starting... 🙄
@jakehemmerle commented on GitHub (Feb 1, 2026):
my hunch is that if the pr is small enough and actually solves the problem then they may accept it but safest route is talking to them upfront. sometimes its hard to reproduce the bug. not sure if there would be other side effects, and there isnt massive e2e testing to see if it breaks things.
ANyway, here is what I did to prevent the overwriting of the file locally for now:
longer explination:
Hope that helps for now.
@imrane commented on GitHub (Feb 1, 2026):
Ran into the same problem and noted it in the Discord - I find thats the best way to get their attention.
https://discord.gg/clawd -->
golden-path-deployments@joshp123 commented on GitHub (Feb 2, 2026):
thanks for the heads up! i am aware, currently adding CI to catch all of these problems. passing all these issues to my clankers to patch it. we will get the build green!
@joshp123 commented on GitHub (Feb 3, 2026):
[🤖 this message brought to you by codex] should be fixed in
065ddf16+887e58b4(fix oneOf enum parsing + regen options). Closing for now — come and yell at me in #golden-path-deployments on discord if you're still having issues! Stability work continues; we are making this better every week.