Auto-reply: send timeout fallback and tests

This commit is contained in:
Peter Steinberger
2025-11-25 17:52:57 +01:00
parent e4076d14c0
commit 46be5eac7d
3 changed files with 70 additions and 1 deletions

View File

@@ -386,6 +386,14 @@ export async function getReplyFromConfig(
console.error(
`Command auto-reply timed out after ${elapsed}ms (limit ${timeoutMs}ms)`,
);
const baseMsg = `Command timed out after ${timeoutSeconds}s. Try a shorter prompt or split the request.`;
const partial = errorObj.stdout?.trim();
const partialSnippet =
partial && partial.length > 800 ? `${partial.slice(0, 800)}...` : partial;
const text = partialSnippet
? `${baseMsg}\n\nPartial output before timeout:\n${partialSnippet}`
: baseMsg;
return { text };
} else {
logError(
`Command auto-reply failed after ${elapsed}ms: ${String(err)}`,