mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 23:10:24 +00:00
fix(agents): prevent false billing error replacing valid response text (#40616)
Merged via squash.
Prepared head SHA: 05179362b4
Co-authored-by: ingyukoh <6015960+ingyukoh@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
@@ -245,7 +245,9 @@ export function extractAssistantText(msg: AssistantMessage): string {
|
||||
}) ?? "";
|
||||
// Only apply keyword-based error rewrites when the assistant message is actually an error.
|
||||
// Otherwise normal prose that *mentions* errors (e.g. "context overflow") can get clobbered.
|
||||
const errorContext = msg.stopReason === "error" || Boolean(msg.errorMessage?.trim());
|
||||
// Gate on stopReason only — a non-error response with an errorMessage set (e.g. from a
|
||||
// background tool failure) should not have its content rewritten (#13935).
|
||||
const errorContext = msg.stopReason === "error";
|
||||
return sanitizeUserFacingText(extracted, { errorContext });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user