fix(config): prevent RangeError in merged schema cache key generation

Fix merged schema cache key generation for high-cardinality plugin/channel metadata by hashing incrementally instead of serializing one large aggregate string.

Includes changelog entry for the user-visible regression fix.

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Co-authored-by: Bill <gsamzn@gmail.com>
This commit is contained in:
Bill 2026-03-06 06:45:07 +08:00 committed by GitHub
parent 60d33637d9
commit a0b731e2ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 1 deletions

View File

@ -27,6 +27,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- Agents/compaction safeguard pre-check: skip embedded compaction before entering the Pi SDK when a session has no real conversation messages, avoiding unnecessary LLM API calls on idle sessions. (#36451) thanks @Sid-Qin.
- Config/schema cache key stability: build merged schema cache keys with incremental hashing to avoid large single-string serialization and prevent `RangeError: Invalid string length` on high-cardinality plugin/channel metadata. (#36603) Thanks @powermaster888.
- iMessage/cron completion announces: strip leaked inline reply tags (for example `[[reply_to:6100]]`) from user-visible completion text so announcement deliveries do not expose threading metadata. (#24600) Thanks @vincentkoc.
- Sessions/daily reset transcript archival: archive prior transcript files during stale-session scheduled/daily resets by capturing the previous session entry before rollover, preventing orphaned transcript files on disk. (#35493) Thanks @byungsker.
- Feishu/group slash command detection: normalize group mention wrappers before command-authorization probing so mention-prefixed commands (for example `@Bot/model` and `@Bot /reset`) are recognized as gateway commands instead of being forwarded to the agent. (#35994) Thanks @liuxiaopai-ai.

View File

@ -1,3 +1,4 @@
import crypto from "node:crypto";
import { CHANNEL_IDS } from "../channels/registry.js";
import { VERSION } from "../version.js";
import type { ConfigUiHint, ConfigUiHints } from "./schema.hints.js";
@ -322,7 +323,24 @@ function buildMergedSchemaCacheKey(params: {
configUiHints: channel.configUiHints ?? null,
}))
.toSorted((a, b) => a.id.localeCompare(b.id));
return JSON.stringify({ plugins, channels });
// Build the hash incrementally so we never materialize one giant JSON string.
const hash = crypto.createHash("sha256");
hash.update('{"plugins":[');
plugins.forEach((plugin, index) => {
if (index > 0) {
hash.update(",");
}
hash.update(JSON.stringify(plugin));
});
hash.update('],"channels":[');
channels.forEach((channel, index) => {
if (index > 0) {
hash.update(",");
}
hash.update(JSON.stringify(channel));
});
hash.update("]}");
return hash.digest("hex");
}
function setMergedSchemaCache(key: string, value: ConfigSchemaResponse): void {