Skip to content

fix(chat): map lab 429 to upstream_rate_limited (not upstream_bad_request) - #29

Merged
alexnikolskiy merged 1 commit into
mainfrom
fix/office-chat-429-rate-limited
Jul 13, 2026
Merged

fix(chat): map lab 429 to upstream_rate_limited (not upstream_bad_request)#29
alexnikolskiy merged 1 commit into
mainfrom
fix/office-chat-429-rate-limited

Conversation

@alexnikolskiy

Copy link
Copy Markdown
Collaborator

Cross-repo follow-up to trdlabs/lab#165 (chat rate limiter). The lab chat ingress now returns 429 on POST /chat/messages and /chat/confirm when throttling, but TradingLabChatConnector folded every 4xx into upstream_bad_request — so the operator saw a bad-request failure for what is actually rate limiting.

Fix

  • Add upstream_rate_limited to ChatUpstreamError['office']['code'].
  • 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; the other error unions (platform / read paths) are separate types and untouched.

Testing (TDD)

  • 429 → upstream_rate_limited for send() and confirm().
  • apps/server suite 226 passed, tsc --noEmit clean.

🤖 Generated with Claude Code

…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>
@alexnikolskiy
alexnikolskiy merged commit 20eb32e into main Jul 13, 2026
1 check passed
@alexnikolskiy
alexnikolskiy deleted the fix/office-chat-429-rate-limited branch July 13, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant