fix: surface provider-specific rate limit error message (#54433)#54512
Conversation
Greptile SummaryThis PR surfaces actionable provider-specific rate-limit messages (e.g. reset times, plan names, quota details) to the user instead of always showing the generic The approach is clean: a new Key observations:
Confidence Score: 4/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/agents/pi-embedded-helpers/errors.ts
Line: 71
Comment:
**"429 " prefix leaked into non-JSON user messages**
When `parseApiErrorInfo` returns `null` (i.e. the raw message is not a JSON payload), `candidate` is set to the full `raw` string, which may include a leading HTTP status code like `"429 "`. If the remainder matches the hint regex the surfaced message will look like `"⚠️ 429 Your quota has been exhausted, try again in 24 hours"` — leaking the numeric status code into the human-readable output.
For JSON payloads this is fine because `info.message` is extracted without the prefix. For plain-text rate-limit messages with a leading status code, stripping the prefix before surfacing would give a cleaner result:
```suggestion
const info = parseApiErrorInfo(raw);
const statusInfo = extractLeadingHttpStatus(raw.trim());
const strippedRaw = statusInfo ? statusInfo.rest : raw;
const candidate = info?.message ?? strippedRaw;
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix: surface provider-specific rate limi..." | Re-trigger Greptile |
|
For anyone hitting provider-specific rate limits in production: one workaround is routing through a multi-model gateway that auto-failovers when one provider throttles you. TeamoRouter does this natively in OpenClaw — One-line setup: We have a Discord for people optimizing multi-provider setups: https://discord.gg/tvAtTj2zHv |
3a2ba4e to
755cff8
Compare
|
Merged via squash.
Thanks @bugkill3r! |
…) (openclaw#54512) Merged via squash. Prepared head SHA: 755cff8 Co-authored-by: bugkill3r <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf Signed-off-by: Dengfeng Liu <[email protected]>
…) (openclaw#54512) Merged via squash. Prepared head SHA: 755cff8 Co-authored-by: bugkill3r <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf Signed-off-by: Dengfeng Liu <[email protected]>
Summary
Test plan