openclaw - ✅(Solved) Fix [Bug]: GroupChatSchema historyLimit rejects 0 (uses .positive() instead of .min(0)) [3 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#65305Fetched 2026-04-12 13:24:54
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×2referenced ×2

GroupChatSchema.historyLimit in src/config/zod-schema.core.ts uses .positive() which rejects 0, while every other historyLimit schema in the codebase uses .min(0). Setting messages.groupChat.historyLimit: 0 causes a silent config reload failure — the Zod validation rejects the value, and the runtime falls back to the previously cached config with no prominent error.

Error Message

GroupChatSchema.historyLimit in src/config/zod-schema.core.ts uses .positive() which rejects 0, while every other historyLimit schema in the codebase uses .min(0). Setting messages.groupChat.historyLimit: 0 causes a silent config reload failure — the Zod validation rejects the value, and the runtime falls back to the previously cached config with no prominent error. Zod validation rejects 0 because .positive() requires > 0. The config reload fails silently — the runtime keeps using the previously cached config. There is no prominent error surfaced to the user.

Root Cause

For comparison:

  1. Set channels.whatsapp.historyLimit: 0 — this works correctly because the channel-level schema uses .min(0).

Fix Action

Fixed

PR fix notes

PR #65306: fix(docs): update AGENTS.md gateway launch mechanism (fixes #61615)

Description (problem / solution / changelog)

Bug

AGENTS.md line 271 stated Gateway only runs as macOS menubar app - outdated. GroupChatSchema.historyLimit uses .positive() which rejects 0 (issue #65305). Avatar docs missing 2MB limit note (issue #65312).

Fix

  • Reflect that openclaw daemon install is recommended path
  • Replace .positive() with .min(0) to allow historyLimit: 0
  • Add max 2MB note to --avatar flag documentation

Closes #61615, #65305, #65312

Changed files

  • AGENTS.md (modified, +1/-1)

Code Example

// Line 364-370: GroupChatSchema — uses .positive(), rejects 0
export const GroupChatSchema = z
  .object({
    mentionPatterns: z.array(z.string()).optional(),
    historyLimit: z.number().int().positive().optional(),  // <-- BUG: .positive() rejects 0
  })
  .strict()
  .optional();

// Line 372-376: DmConfigSchema — uses .min(0), accepts 0
export const DmConfigSchema = z
  .object({
    historyLimit: z.number().int().min(0).optional(),      // <-- correct
  })
  .strict();
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

GroupChatSchema.historyLimit in src/config/zod-schema.core.ts uses .positive() which rejects 0, while every other historyLimit schema in the codebase uses .min(0). Setting messages.groupChat.historyLimit: 0 causes a silent config reload failure — the Zod validation rejects the value, and the runtime falls back to the previously cached config with no prominent error.

Steps to reproduce

  1. Set messages.groupChat.historyLimit: 0 in openclaw.json (intending to disable group chat history).
  2. Trigger a config reload (or restart).
  3. Observe that the config change is silently rejected — the runtime continues with the previous config value (default 50).

For comparison:

  1. Set channels.whatsapp.historyLimit: 0 — this works correctly because the channel-level schema uses .min(0).

Expected behavior

messages.groupChat.historyLimit: 0 should be accepted, consistent with DmConfigSchema.historyLimit (line 374, same file) and all channel-level historyLimit schemas, which use .min(0) and accept 0 to mean "no history."

Actual behavior

Zod validation rejects 0 because .positive() requires > 0. The config reload fails silently — the runtime keeps using the previously cached config. There is no prominent error surfaced to the user.

OpenClaw version

2026.4.11

Operating system

Linux (Ubuntu)

Install method

pnpm dev (source checkout)

Model

N/A — config schema validation bug, not model-specific

Provider / routing chain

N/A — config schema validation bug, not provider-specific

Logs, screenshots, and evidence

The inconsistency in src/config/zod-schema.core.ts:

// Line 364-370: GroupChatSchema — uses .positive(), rejects 0
export const GroupChatSchema = z
  .object({
    mentionPatterns: z.array(z.string()).optional(),
    historyLimit: z.number().int().positive().optional(),  // <-- BUG: .positive() rejects 0
  })
  .strict()
  .optional();

// Line 372-376: DmConfigSchema — uses .min(0), accepts 0
export const DmConfigSchema = z
  .object({
    historyLimit: z.number().int().min(0).optional(),      // <-- correct
  })
  .strict();

All historyLimit occurrences in the file:

  • Line 367: GroupChatSchema.positive() (rejects 0) ← the only outlier
  • Line 374: DmConfigSchema.min(0) (accepts 0)
  • Line 433: channel-level schema — .min(0) (accepts 0)

Impact and severity

  • Affected: Any user trying to disable group chat history via messages.groupChat.historyLimit: 0 or per-agent groupChat.historyLimit: 0
  • Severity: Medium — the config is silently ignored, which is confusing and hard to debug
  • Frequency: 100% reproducible when setting the value to 0
  • Consequence: Users cannot disable group chat history through the group chat config path, and the silent failure makes it hard to understand why the setting has no effect

Additional information

The fix is a one-line change: replace .positive() with .min(0) on line 367 of src/config/zod-schema.core.ts. Happy to open a PR if this is confirmed as unintentional.

extent analysis

TL;DR

Replace .positive() with .min(0) in the GroupChatSchema.historyLimit validation to allow a value of 0.

Guidance

  • Identify the inconsistent validation in src/config/zod-schema.core.ts where GroupChatSchema.historyLimit uses .positive() instead of .min(0).
  • Update the GroupChatSchema.historyLimit validation to use .min(0) to match the validation used in DmConfigSchema.historyLimit and other channel-level schemas.
  • Verify the fix by setting messages.groupChat.historyLimit: 0 in openclaw.json and triggering a config reload to ensure the change is accepted.
  • Test the fix by checking that the group chat history is disabled when the value is set to 0.

Example

export const GroupChatSchema = z
  .object({
    mentionPatterns: z.array(z.string()).optional(),
    historyLimit: z.number().int().min(0).optional(),  // Fix: replaced .positive() with .min(0)
  })
  .strict()
  .optional();

Notes

The provided fix is a one-line change and should resolve the issue. However, it's essential to test the fix thoroughly to ensure it doesn't introduce any other issues.

Recommendation

Apply the workaround by replacing .positive() with .min(0) in the GroupChatSchema.historyLimit validation, as this change is consistent with the validation used in other parts of the codebase and fixes the silent config reload failure.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

messages.groupChat.historyLimit: 0 should be accepted, consistent with DmConfigSchema.historyLimit (line 374, same file) and all channel-level historyLimit schemas, which use .min(0) and accept 0 to mean "no history."

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING