Skip to content

fix(config): allow historyLimit: 0 in GroupChatSchema - #65311

Closed
hclsys wants to merge 1 commit into
openclaw:mainfrom
hclsys:fix/groupchat-history-limit-zero
Closed

hclsys wants to merge 1 commit into
openclaw:mainfrom
hclsys:fix/groupchat-history-limit-zero

Conversation

@hclsys

@hclsys hclsys commented Apr 12, 2026

Copy link
Copy Markdown

Summary

GroupChatSchema.historyLimit uses .positive() which rejects 0, while every other historyLimit in the codebase uses .min(0). Setting messages.groupChat.historyLimit: 0 (meaning "disable group chat history") causes a silent config reload failure — Zod rejects the value and the runtime falls back to the previously cached config with no prominent error.

Fixes #65305

Root cause

// zod-schema.core.ts:357 (before fix)
historyLimit: z.number().int().positive().optional(),  // rejects 0

// zod-schema.core.ts:364 (sibling — correct)
historyLimit: z.number().int().min(0).optional(),      // accepts 0

Fix

.positive() → .min(0) on line 357. One token changed.

Scope

  • Files: src/config/zod-schema.core.ts (+3/-1)
  • oxlint clean
  • Zero competing PRs

Credit to @maxreith for identifying the inconsistency in #65305.

GroupChatSchema.historyLimit used .positive() which rejects 0, while
every other historyLimit in the codebase (DmConfigSchema, channel
account schemas) uses .min(0). Setting messages.groupChat.historyLimit
to 0 (meaning "no history") caused a silent config reload failure —
Zod rejected the value and the runtime fell back to the previously
cached config with no prominent error.

Fix: change .positive() to .min(0), consistent with all sibling
historyLimit schemas in the same file.

Fixes openclaw#65305
@greptile-apps

greptile-apps Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Changes .positive() to .min(0) on GroupChatSchema.historyLimit in src/config/zod-schema.core.ts, bringing it in line with every other historyLimit field in the codebase. A brief inline comment was also added explaining the intent. The fix is minimal, targeted, and correct.

Confidence Score: 5/5

Safe to merge — single-token schema fix with no side effects.

The change is a one-line correction that aligns GroupChatSchema.historyLimit with every other historyLimit field in the codebase. No logic beyond schema validation is touched, and the fix directly resolves the reported silent config-reload failure.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(config): allow historyLimit: 0 in Gr..." | Re-trigger Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c6c2efe2d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// Use .min(0) not .positive() — 0 is a valid value meaning "no history".
// Consistent with DmConfigSchema.historyLimit and all other historyLimit
// fields in this file (#65305).
historyLimit: z.number().int().min(0).optional(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Regenerate config schema artifacts for historyLimit

After changing GroupChatSchema.historyLimit to min(0), the generated base schema artifacts were not updated, so messages.groupChat.historyLimit still appears as exclusiveMinimum: 0 in src/config/schema.base.generated.ts (around line 6020). Any consumer that validates/edit-configs via GENERATED_BASE_CONFIG_SCHEMA (for example schema-driven UI/CLI flows) will continue to reject 0, leaving runtime validation and published schema behavior inconsistent.

Useful? React with 👍 / 👎.

@hclsys

This comment was marked as low quality.

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]: GroupChatSchema historyLimit rejects 0 (uses .positive() instead of .min(0))

1 participant