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

@@ -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))