mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 22:18:27 +00:00
fix: gate Telegram exec tool warnings behind verbose mode (#20560)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 7ce94931f0
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
@@ -29,6 +29,23 @@ function normalizeToolErrorText(text: string): string | undefined {
|
||||
: firstLine;
|
||||
}
|
||||
|
||||
function isErrorLikeStatus(status: string): boolean {
|
||||
const normalized = status.trim().toLowerCase();
|
||||
if (!normalized) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
normalized === "0" ||
|
||||
normalized === "ok" ||
|
||||
normalized === "success" ||
|
||||
normalized === "completed" ||
|
||||
normalized === "running"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return /error|fail|timeout|timed[_\s-]?out|denied|cancel|invalid|forbidden/.test(normalized);
|
||||
}
|
||||
|
||||
function readErrorCandidate(value: unknown): string | undefined {
|
||||
if (typeof value === "string") {
|
||||
return normalizeToolErrorText(value);
|
||||
@@ -59,7 +76,10 @@ function extractErrorField(value: unknown): string | undefined {
|
||||
return direct;
|
||||
}
|
||||
const status = typeof record.status === "string" ? record.status.trim() : "";
|
||||
return status ? normalizeToolErrorText(status) : undefined;
|
||||
if (!status || !isErrorLikeStatus(status)) {
|
||||
return undefined;
|
||||
}
|
||||
return normalizeToolErrorText(status);
|
||||
}
|
||||
|
||||
export function sanitizeToolResult(result: unknown): unknown {
|
||||
|
||||
Reference in New Issue
Block a user