Skip to content

Fix #18937: Don't leak API errors to user channel#18970

Closed
jwchmodx wants to merge 1 commit intoopenclaw:mainfrom
jwchmodx:fix/issue-18937
Closed

Fix #18937: Don't leak API errors to user channel#18970
jwchmodx wants to merge 1 commit intoopenclaw:mainfrom
jwchmodx:fix/issue-18937

Conversation

@jwchmodx
Copy link
Copy Markdown
Contributor

@jwchmodx jwchmodx commented Feb 17, 2026

Problem

API error messages (e.g. 401 User not found) were being sent directly to users' WhatsApp/Telegram channels instead of being kept internal.

Changes

  1. Heartbeat error suppression (agent-runner-execution.ts): When a heartbeat run fails, return an empty payload instead of forwarding the error text to the user channel. Errors are still logged via defaultRuntime.error().

  2. Auth error sanitization (errors.ts):

    • formatRawAssistantErrorForUi: HTTP 401/403 errors now return a generic "Authentication error" message instead of the raw error body
    • formatAssistantErrorText: Added early auth error detection before the generic fallback

Fixes #18937

Greptile Summary

This PR prevents API error messages from leaking to user channels by sanitizing authentication errors and suppressing heartbeat failures.

Changes:

  • formatRawAssistantErrorForUi now returns a generic "Authentication error" message for HTTP 401/403 errors instead of exposing raw error bodies like "401 User not found"
  • formatAssistantErrorText adds early auth error detection before the generic fallback
  • Heartbeat runs that fail now return empty payload instead of forwarding error text to user channel (errors still logged via defaultRuntime.error())

The implementation correctly addresses the security issue by catching auth errors in multiple places and preventing sensitive API error details from reaching end users.

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues
  • The changes are focused security improvements that prevent API error leakage. The implementation leverages existing error detection patterns (isAuthErrorMessage already includes 401/403 patterns), adds appropriate sanitization in two key locations, and maintains backward compatibility by only affecting error display logic without changing error handling behavior. Errors are still logged internally for debugging.
  • No files require special attention

Last reviewed commit: 3774c38

- Heartbeat errors are now silently logged instead of being sent to the
  user's WhatsApp/Telegram channel
- Auth errors (401/403) in formatRawAssistantErrorForUi return a generic
  message instead of raw HTTP error body
- formatAssistantErrorText catches auth errors early with a safe message

Fixes openclaw#18937
@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: XS labels Feb 17, 2026
@aldoeliacim

This comment was marked as spam.

@steipete
Copy link
Copy Markdown
Contributor

Closing as AI-assisted stale-fix triage.

Linked issue #18937 ("Bug: API error messages (401 User not found) leaked to user channel") is CLOSED and was closed on 2026-02-22T19:04:58Z with state reason COMPLETED.
Given that issue status, this fix PR is no longer needed in the active queue and is being closed as stale.

If the behavior is still reproducible on current main, reopen #18970 (or open a new focused fix PR) and reference #18937.

@steipete steipete closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: API error messages (401 User not found) leaked to user channel

3 participants