fix(gateway): guard trim crashes in subagent flow

This commit is contained in:
Peter Steinberger
2026-02-22 13:20:53 +01:00
parent 52d1ece262
commit 1152b25866
4 changed files with 5 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- Gateway/Subagents: guard gateway and subagent session-key/message trim paths against undefined inputs to prevent early `Cannot read properties of undefined (reading 'trim')` crashes during subagent spawn and wait flows.
- Agents/Workspace: guard `resolveUserPath` against undefined/null input to prevent `Cannot read properties of undefined (reading 'trim')` crashes when workspace paths are missing in embedded runner flows.
- Auth/Profiles: keep active `cooldownUntil`/`disabledUntil` windows immutable across retries so mid-window failures cannot extend recovery indefinitely; only recompute a backoff window after the previous deadline has expired. This resolves cron/inbound retry loops that could trap gateways until manual `usageStats` cleanup. (#23516, #23536) Thanks @arosstale.
- Channels/Security: fail closed on missing provider group policy config by defaulting runtime group policy to `allowlist` (instead of inheriting `channels.defaults.groupPolicy`) when `channels.<provider>` is absent across message channels, and align runtime + security warnings/docs to the same fallback behavior (Slack, Discord, iMessage, Telegram, WhatsApp, Signal, LINE, Matrix, Mattermost, Google Chat, IRC, Nextcloud Talk, Feishu, and Zalo user flows; plus Discord message/native-command paths). (#23367) Thanks @bmendonca3.

View File

@@ -502,7 +502,7 @@ function resolveRequesterStoreKey(
cfg: ReturnType<typeof loadConfig>,
requesterSessionKey: string,
): string {
const raw = requesterSessionKey.trim();
const raw = (requesterSessionKey ?? "").trim();
if (!raw) {
return raw;
}

View File

@@ -217,7 +217,7 @@ export const agentHandlers: GatewayRequestHandlers = {
}
const normalizedAttachments = normalizeRpcAttachmentsToChatAttachments(request.attachments);
let message = request.message.trim();
let message = (request.message ?? "").trim();
let images: Array<{ type: "image"; data: string; mimeType: string }> = [];
if (normalizedAttachments.length > 0) {
try {
@@ -695,7 +695,7 @@ export const agentHandlers: GatewayRequestHandlers = {
return;
}
const p = params;
const runId = p.runId.trim();
const runId = (p.runId ?? "").trim();
const timeoutMs =
typeof p.timeoutMs === "number" && Number.isFinite(p.timeoutMs)
? Math.max(0, Math.floor(p.timeoutMs))

View File

@@ -430,7 +430,7 @@ export function resolveSessionStoreKey(params: {
cfg: OpenClawConfig;
sessionKey: string;
}): string {
const raw = params.sessionKey.trim();
const raw = (params.sessionKey ?? "").trim();
if (!raw) {
return raw;
}