Skip to content

fix(config): add missing params field to AgentEntrySchema#26138

Open
moliendocode wants to merge 2 commits intoopenclaw:mainfrom
moliendocode:fix/agent-entry-params-schema
Open

fix(config): add missing params field to AgentEntrySchema#26138
moliendocode wants to merge 2 commits intoopenclaw:mainfrom
moliendocode:fix/agent-entry-params-schema

Conversation

@moliendocode
Copy link

@moliendocode moliendocode commented Feb 25, 2026

Summary

  • Add params to AgentEntrySchema Zod validation — PR feat(cache): per-agent params for cacheRetention control (#17112) #17470 added per-agent params overrides to the TypeScript type (AgentConfig) and runtime logic (extra-params.ts) but missed updating the Zod schema. Because AgentEntrySchema uses .strict(), any params key in agent config is silently rejected at parse time, making the feature unusable.
  • Add regression test — validates the schema accepts params in agent entries and still rejects truly unknown fields via .strict().

Closes #25903

What changed

src/config/zod-schema.agent-runtime.ts — one line:

params: z.record(z.string(), z.unknown()).optional(),

This matches the existing TypeScript type definition at types.agents.ts:33:

params?: Record<string, unknown>;

Test plan

  • pnpm build — passes
  • pnpm check (format + types + lint) — 0 errors
  • pnpm test — 10,485 passed (53 preexisting network timeout failures unrelated to this change)
  • All 76 config test files (607 tests including 2 new) pass
  • All 26 extra-params tests pass
  • New test: schema accepts params in agent entries
  • New test: schema still rejects unknown fields in agent entries

AI-assisted PR 🤖

  • AI-assisted: Built with Claude Code (Claude Opus 4.6)
  • Testing: Fully tested — build, check, lint, and all config/extraparams tests pass
  • Context: Discovered while investigating issue v2026.2.23 changelog lists features not present in published npm build (b817600) #25903 (filed by @moliendocode). Traced the root cause to PR feat(cache): per-agent params for cacheRetention control (#17112) #17470 which updated the TypeScript type and runtime logic but missed the Zod schema.
  • Understanding: The fix adds a single optional field (params) to the Zod validation schema for agent entries. The field accepts an arbitrary record of string keys to unknown values, matching the existing TypeScript type. The .strict() mode on AgentEntrySchema was causing Zod to reject the params key since it wasn't declared in the schema, even though the runtime code already supported it.

🤖 Generated with Claude Code

Greptile Summary

Adds the missing params field to AgentEntrySchema Zod validation. PR #17470 introduced per-agent params overrides to the TypeScript type (AgentConfig at src/config/types.agents.ts:33) and runtime logic (extra-params.ts:34-36) but missed updating the Zod schema. Since AgentEntrySchema uses .strict() mode, any params key in agent config was silently rejected at parse time, making the feature unusable.

The fix adds a single line to the Zod schema matching the existing TypeScript type:

params: z.record(z.string(), z.unknown()).optional()

The regression test validates that:

  • The schema now accepts params in agent entries
  • The .strict() mode still rejects truly unknown fields

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is a single-line schema addition that exactly matches the existing TypeScript type definition. The change has comprehensive test coverage (new regression test plus existing runtime tests from PR feat(cache): per-agent params for cacheRetention control (#17112) #17470), and the PR description indicates all build, check, lint, and test suites pass (10,485 tests). The fix directly addresses a schema validation bug that was preventing a documented feature from working.
  • No files require special attention

Last reviewed commit: 71167e1

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

@openclaw-barnacle
Copy link

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Mar 3, 2026
@moliendocode
Copy link
Author

Still active — the bug persists as of v2026.3.2 (see #27173 comment #27173 (comment)).

The fix is minimal (XS), CI is green, and the branch is still mergeable. Would appreciate a review when possible.

moliendocode and others added 2 commits March 3, 2026 09:49
PR openclaw#17470 added per-agent `params` overrides to the TypeScript type
(`AgentConfig`) and runtime logic (`extra-params.ts`) but missed adding
the field to the Zod validation schema.  Because `AgentEntrySchema` uses
`.strict()`, any `params` key in the agent config is silently rejected
at parse time, making the feature unusable.

Add `params: z.record(z.string(), z.unknown()).optional()` to
`AgentEntrySchema` to match the existing type definition.

Closes openclaw#25903

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Regression test ensuring `AgentEntrySchema` accepts the `params` field
and still rejects truly unknown fields via `.strict()`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@moliendocode moliendocode force-pushed the fix/agent-entry-params-schema branch from 71167e1 to 246d93c Compare March 3, 2026 12:49
@openclaw-barnacle openclaw-barnacle bot removed the stale Marked as stale due to inactivity label Mar 4, 2026
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.

v2026.2.23 changelog lists features not present in published npm build (b817600)

1 participant