fix(chat): map lab 429 to upstream_rate_limited (not upstream_bad_request) - #29
Merged
Merged
Conversation
…ad_request The lab chat ingress now rate-limits POST /chat/messages and /chat/confirm (429), but TradingLabChatConnector folded every 4xx into upstream_bad_request, so the operator saw a bad-request failure for what is actually throttling. Add an `upstream_rate_limited` code and map 429 explicitly (before the generic >= 400 catch) in both send() and confirm(). The code flows through TradingLabOperatorResponder's `failed(err.office.code, ...)` as the operator- facing failure code — no exhaustive switch to update. TDD: 429 → upstream_rate_limited for send() and confirm(). apps/server suite 226 passed, typecheck clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cross-repo follow-up to trdlabs/lab#165 (chat rate limiter). The lab chat ingress now returns 429 on
POST /chat/messagesand/chat/confirmwhen throttling, butTradingLabChatConnectorfolded every 4xx intoupstream_bad_request— so the operator saw a bad-request failure for what is actually rate limiting.Fix
upstream_rate_limitedtoChatUpstreamError['office']['code'].429explicitly (before the generic>= 400catch) in bothsend()andconfirm().The code flows through
TradingLabOperatorResponder'sfailed(err.office.code, …)as the operator-facing failure code — no exhaustive switch to update; the other error unions (platform / read paths) are separate types and untouched.Testing (TDD)
429 → upstream_rate_limitedforsend()andconfirm().apps/serversuite 226 passed,tsc --noEmitclean.🤖 Generated with Claude Code