Skip to content

Return user-facing message if API reuturn 429 API rate limit reached #2202#10415

Merged
steipete merged 3 commits intoopenclaw:mainfrom
vincenthsin:fix/2202-response-user-facing-message-for-API-429
Feb 14, 2026
Merged

Return user-facing message if API reuturn 429 API rate limit reached #2202#10415
steipete merged 3 commits intoopenclaw:mainfrom
vincenthsin:fix/2202-response-user-facing-message-for-API-429

Conversation

@vincenthsin
Copy link
Contributor

@vincenthsin vincenthsin commented Feb 6, 2026

Fix #2202 with Google Antigravity. Manually local tests have done and passed.
This PR only fix the case of API 429 error. The 402 error should be fixed in a separate branch.

Greptile Overview

Greptile Summary

  • Adds explicit handling for rate-limit (HTTP 429) assistant errors, formatting them into a friendlier user-facing message.
  • Threads config and sessionKey through embedded runner/subscribe plumbing so error formatting can use sandbox/tool policy context.
  • Tracks the last assistant message during streaming and emits a lifecycle:error event on agent_end when the final assistant message ended in error.
  • Adds/extends unit tests covering 429 formatting and lifecycle error emission.

Confidence Score: 4/5

  • This PR is likely safe to merge after addressing the user-facing error copy inconsistencies for 429 handling.
  • Core changes are localized and covered by tests, but there are two confirmed places where 429 errors can be mislabeled or described inaccurately (credits vs throttling; sanitizeUserFacingText mapping 429 to overload), which would regress UX for some error paths.
  • src/agents/pi-embedded-helpers/errors.ts

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

@openclaw-barnacle openclaw-barnacle bot added the agents Agent runtime and tooling label Feb 6, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 6, 2026

Additional Comments (1)

src/agents/pi-embedded-helpers/errors.ts
Wrong message for 429

In sanitizeUserFacingText, the ERROR_PREFIX_RE branch collapses both overloaded and rate-limit errors into the overloaded message ("temporarily overloaded"). This means a user-facing Error: 429 ... string will be mislabeled as overload even though formatAssistantErrorText now has a specific rate-limit message. If sanitizeUserFacingText is used on these errors (e.g., for non-assistant/raw error paths), 429s won’t show the intended rate-limit copy.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/pi-embedded-helpers/errors.ts
Line: 425:428

Comment:
**Wrong message for 429**

In `sanitizeUserFacingText`, the `ERROR_PREFIX_RE` branch collapses *both* overloaded and rate-limit errors into the overloaded message (`"temporarily overloaded"`). This means a user-facing `Error: 429 ...` string will be mislabeled as overload even though `formatAssistantErrorText` now has a specific rate-limit message. If `sanitizeUserFacingText` is used on these errors (e.g., for non-assistant/raw error paths), 429s won’t show the intended rate-limit copy.

How can I resolve this? If you propose a fix, please make it concise.

@vincenthsin
Copy link
Contributor Author

Hi @mkbehr , can you please review this ?

@steipete steipete self-assigned this Feb 14, 2026
@steipete steipete force-pushed the fix/2202-response-user-facing-message-for-API-429 branch from 643c466 to c6ce808 Compare February 14, 2026 16:31
@steipete steipete force-pushed the fix/2202-response-user-facing-message-for-API-429 branch from c6ce808 to 5a4a509 Compare February 14, 2026 16:33
@steipete steipete merged commit 478af81 into openclaw:main Feb 14, 2026
23 checks passed
mverrilli pushed a commit to mverrilli/openclaw that referenced this pull request Feb 14, 2026
…penclaw#2202 (openclaw#10415)

* Return user-facing message if API reuturn 429 API rate limit reached

* clarify the error message

* fix(agents): improve 429 user messaging (openclaw#10415) (thanks @vincenthsin)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
akoscz pushed a commit to akoscz/openclaw that referenced this pull request Feb 15, 2026
…penclaw#2202 (openclaw#10415)

* Return user-facing message if API reuturn 429 API rate limit reached

* clarify the error message

* fix(agents): improve 429 user messaging (openclaw#10415) (thanks @vincenthsin)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
GwonHyeok pushed a commit to learners-superpumped/openclaw that referenced this pull request Feb 15, 2026
…penclaw#2202 (openclaw#10415)

* Return user-facing message if API reuturn 429 API rate limit reached

* clarify the error message

* fix(agents): improve 429 user messaging (openclaw#10415) (thanks @vincenthsin)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
snowzlm pushed a commit to snowzlm/openclaw that referenced this pull request Feb 15, 2026
…penclaw#2202 (openclaw#10415)

* Return user-facing message if API reuturn 429 API rate limit reached

* clarify the error message

* fix(agents): improve 429 user messaging (openclaw#10415) (thanks @vincenthsin)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
@vincenthsin vincenthsin deleted the fix/2202-response-user-facing-message-for-API-429 branch February 21, 2026 16:00
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…penclaw#2202 (openclaw#10415)

* Return user-facing message if API reuturn 429 API rate limit reached

* clarify the error message

* fix(agents): improve 429 user messaging (openclaw#10415) (thanks @vincenthsin)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
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: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gateway sends empty messages on persistent API errors (429/402) instead of user-facing explanation

2 participants