Skip to content

fix(config): add missing params field to agents.list[] validation schema#41171

Merged
altaywtf merged 2 commits intoopenclaw:mainfrom
atian8179:fix/config-validate-agent-params
Mar 13, 2026
Merged

fix(config): add missing params field to agents.list[] validation schema#41171
altaywtf merged 2 commits intoopenclaw:mainfrom
atian8179:fix/config-validate-agent-params

Conversation

@atian8179
Copy link
Contributor

Problem

openclaw config validate rejects agents.list[].params even though this field is defined in the AgentConfig TypeScript type and documented as a per-agent override for stream parameters like cacheRetention, temperature, and maxTokens.

The root cause is that AgentEntrySchema (Zod validation) uses .strict() but does not include the params field, so any config containing it fails validation.

Fix

Add params: z.record(z.string(), z.unknown()).optional() to AgentEntrySchema, matching the existing TypeScript type:

params?: Record<string, unknown>;

One-line change in src/config/zod-schema.agent-runtime.ts.

Testing

Verified the Zod schema change aligns with the existing AgentConfig type definition in src/config/types.agents.ts.

Fixes #41160

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 9, 2026

Greptile Summary

This PR fixes a validation gap where agents.list[].params was silently rejected by AgentEntrySchema because the field was present in the AgentConfig TypeScript type but absent from the Zod schema that used .strict().

The one-line addition of params: z.record(z.string(), z.unknown()).optional() to AgentEntrySchema is exactly consistent with:

  • The existing TypeScript type (params?: Record<string, unknown> in types.agents.ts, line 86)
  • The analogous pattern already used in AgentDefaultsSchema (line 31 of zod-schema.agent-defaults.ts)

The .strict() constraint on the schema (line 752) ensures that any unrecognized fields are rejected, which is why params was being rejected before this fix. Adding it to the schema definition now allows configurations with agent-specific parameter overrides (for stream settings like cacheRetention, temperature, maxTokens) to pass validation.

No other changes are needed: the fix is a targeted schema-to-type alignment with minimal risk and no behavioural impact.

Confidence Score: 5/5

  • Safe to merge — minimal, targeted fix that aligns the Zod validation schema with the existing TypeScript type definition.
  • The change is a single-line addition that corrects a clear schema-type mismatch. The Zod type used (z.record(z.string(), z.unknown()).optional()) exactly mirrors the TypeScript type pattern, and the same pattern is already used elsewhere in the codebase (AgentDefaultsSchema). There is no risk of behavioural regression — the change only permits configurations that were previously rejected. No tests, logic, or other schema definitions require changes.
  • No files require special attention.

Last reviewed commit: 2701b2b

@altaywtf altaywtf self-assigned this Mar 13, 2026
atian8179 and others added 2 commits March 13, 2026 14:07
The AgentConfig TypeScript type already declares params as
Record<string, unknown>, but the Zod validation schema in
AgentEntrySchema omits it. Because the schema uses .strict(),
any agents.list[] entry containing params (e.g. cacheRetention,
temperature, maxTokens) is rejected by `openclaw config validate`.

Add the params field to AgentEntrySchema to match the type definition.

Fixes openclaw#41160
@altaywtf altaywtf force-pushed the fix/config-validate-agent-params branch from 2701b2b to 9522761 Compare March 13, 2026 11:27
@altaywtf altaywtf merged commit b72c877 into openclaw:main Mar 13, 2026
29 checks passed
@altaywtf
Copy link
Member

Merged via squash.

Thanks @atian8179!

1 similar comment
@altaywtf
Copy link
Member

Merged via squash.

Thanks @atian8179!

Jerry-Xin pushed a commit to Jerry-Xin/openclaw that referenced this pull request Mar 13, 2026
…ema (openclaw#41171)

Merged via squash.

Prepared head SHA: 9522761
Co-authored-by: atian8179 <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 13, 2026
* main: (168 commits)
  fix: stabilize macos daemon onboarding
  fix(ui): keep shared auth on insecure control-ui connects (openclaw#45088)
  docs(plugins): clarify workspace shadowing
  fix(node-host): harden perl approval binding
  fix(node-host): harden pnpm approval binding
  fix(discovery): add missing domain to wideArea Zod config schema (openclaw#35615)
  chore(gitignore): add docker-compose override (openclaw#42879)
  feat(ios): add onboarding welcome pager (openclaw#45054)
  fix(signal): add groups config to Signal channel schema (openclaw#27199)
  fix: restore web fetch firecrawl config in runtime zod schema (openclaw#42583)
  fix: polish Android QR scanner onboarding (openclaw#45021)
  fix(android): use Google Code Scanner for onboarding QR
  fix(config): add missing params field to agents.list[] validation schema (openclaw#41171)
  docs(contributing): update Android app ownership
  fix(agents): rephrase session reset prompt to avoid Azure content filter (openclaw#43403)
  test(config): cover requiresOpenAiAnthropicToolPayload in compat schema fixture
  fix(agents): respect explicit user compat overrides for non-native openai-completions (openclaw#44432)
  Android: fix HttpURLConnection leak in TalkModeVoiceResolver (openclaw#43780)
  Docker: add OPENCLAW_TZ timezone support (openclaw#34119)
  fix(agents): avoid injecting memory file twice on case-insensitive mounts (openclaw#26054)
  ...
z-hao-wang pushed a commit to z-hao-wang/openclaw that referenced this pull request Mar 13, 2026
…ema (openclaw#41171)

Merged via squash.

Prepared head SHA: 9522761
Co-authored-by: atian8179 <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
hougangdev pushed a commit to hougangdev/clawdbot that referenced this pull request Mar 14, 2026
…ema (openclaw#41171)

Merged via squash.

Prepared head SHA: 9522761
Co-authored-by: atian8179 <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
ecochran76 pushed a commit to ecochran76/openclaw that referenced this pull request Mar 14, 2026
…ema (openclaw#41171)

Merged via squash.

Prepared head SHA: 9522761
Co-authored-by: atian8179 <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: config validate rejects documented agents.list[].params field

2 participants