fix: rate limiter retry counting + stub agents use AgentError#77
Merged
Conversation
…omainInputError Codex review MEDIUM #1 + MEDIUM #4. MEDIUM #1 — booking/api-abstraction rate limiter undercounting - Previously the rate-limit counter incremented once per execute() call, before the retry loop. Each retry to the upstream provider therefore went uncounted, under-reporting traffic against provider quotas and letting agents sail past per-window limits while believing they were still in budget. - Move the increment INSIDE the retry loop, before each requestHandler call. Move the rate-limit guard inside the loop too, so an attempt that would exceed the quota short-circuits cleanly without burning another outbound request. - New test: 1 initial + 2 retries on a retryable failure → request_count ends at 3, not 1. MEDIUM #4 — stub agents throw raw Error - New @otaip/core class UnimplementedDomainInputError(agentId, detail) with code 'UNIMPLEMENTED_DOMAIN_INPUT'. Callers can catch by class instead of string-matching. - Replace `throw new Error(...)` in 4 stub agents with `throw new UnimplementedDomainInputError(...)`: DisruptionResponseAgent (5.4) DynamicPricingAgent (2.6) RevenueManagementAgent (2.7) InterlineSettlementAgent (7.4) - Tests updated to assert on the typed error (instance + agentId + code). - The other 'placeholder' agents called out in the original review (self-service-rebooking, waitlist-management) were since fully built out and no longer throw raw Errors. Verification: 3,085 tests pass, lint + typecheck clean. Co-Authored-By: Claude Opus 4.6 <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.
Summary
Codex review MEDIUM #1 + MEDIUM #4.
MEDIUM #1 — booking/api-abstraction rate limiter undercounted retries
The rate-limit counter incremented once per `execute()` call, before the retry loop. Each retry fired `requestHandler` again without incrementing the counter, under-reporting upstream traffic against provider quotas.
Fix: move the increment inside the retry loop, before each `requestHandler` call. The rate-limit guard also moves inside the loop so an attempt that would exceed the quota short-circuits cleanly without burning another outbound request.
New test verifies: 1 initial attempt + 2 retries on a retryable failure → `request_count` ends at 3 (not 1).
MEDIUM #4 — stub agents threw raw `Error`
Test plan
🤖 Generated with Claude Code