-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
Delivery layer: posts raw errorMessage verbatim when assistant message has stopReason=error #69737
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
OpenClaw's chat delivery layer (Slack verified; Telegram suspected same code path) posts the raw upstream API
errorMessageverbatim to the user-facing channel when an assistant message hasstopReason=errorand the provider populateserrorMessagewith raw upstream error text (e.g., an OpenAI 500 with a request ID and ahelp.openai.comURL).Environment
2026.4.14(originally observed); upstream/main confirmed by community trace atcfda375bb6(2026-04-22) and7ddd815e469e(2026-04-28)openai-codex(usingapi: openai-codex-responses)gpt-5.4Evidence
A scheduled cron fire hit an OpenAI 500. The assistant message written to the session store had:
The delivery layer posted the
errorMessagetext verbatim to the end user's Slack DM.Source trace (per community trace, 2026-04-22)
Delivery-side fallback chain at
src/agents/pi-embedded-subscribe.handlers.lifecycle.ts:76(line:65per Codex re-check on7ddd815e469e):Three levels: (a)
formatAssistantErrorText(lastAssistant, …)— the sanitization hook atsrc/agents/pi-embedded-helpers/errors.ts:925(line:1142per re-check), (b) rawlastAssistant.errorMessage, (c)"LLM request failed.".formatAssistantErrorTextonly sanitizes a specific list of error patterns —unknown tool,disk space,auth_refresh,refresh_contention,refresh_timeout. A generic OpenAI 5xx with a request ID andhelp.openai.comURL matches none of those, so it falls through to position (b) and the raw upstream text reaches the user-facing channel.Payload builder at
src/agents/pi-embedded-runner/run/payloads.ts:210pusheserrorTextwithisError: truefor terminal assistant errors, so this is on the user-facing delivery path.Expected behavior
When
stopReason=errorand the provider's error doesn't match a known friendly classification:"Temporary issue — will retry shortly.")errorMessageverbatim to end usersProposed fix — minimal-blast-radius
Per @martingarramon's recommendation in the trace comment:
Option A (smallest): Remove position (b) from the fallback chain — let unmatched errors land on
"LLM request failed.". Preserves the existing structured/HTTP-shaped/billing/timeout/schema/transport friendly cases handled earlier informatAssistantErrorText.Option B: Keep position (b) but route it through
buildTextObservationFields(...).textPreview(already used for the admin log atlifecycle.ts:80-83) so at least URL/PII scrubbing applies before user delivery.Test caveat
Per Codex re-check (2026-04-28):
src/agents/pi-embedded-subscribe.handlers.lifecycle.test.ts:145currently asserts the sanitized-raw behavior on a secret-like unclassified error (expectsx-api-key: ***in the emitted lifecycle error text). Any fix that replaces raw error text with a generic fallback or suppression needs that test updated alongside.Acceptance
help.openai.comURL), the user-facing channel never sees the rawerrorMessagetext.Retry-with-backoff
A separate / larger feature — not requested here; this issue focuses on the delivery-layer fallback only.
Offer
Happy to test a PR against our production deployment and provide additional evidence (scrubbed of user data) if useful.
Related