[WRONG BRANCH] fix(chat-native): share transient send budget across recovery - #386
[WRONG BRANCH] fix(chat-native): share transient send budget across recovery#386luvs01 wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1716f4917
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| expect(chat.match(/let transientSendsUsed = 0;/g)).toHaveLength(1); | ||
| expect(chat).toContain("transientPolicy.attempts - transientSendsUsed"); | ||
| expect(chat).toContain("onSendsConsumed: (sends: number) => { transientSendsUsed += Math.max(0, sends); }"); |
There was a problem hiding this comment.
Exercise the native request path instead of matching source
These assertions only match implementation strings, so they can remain green even if the counter or guards are placed on a path that does not constrain dispatches. The existing tests/chat-completions-endpoint.test.ts recovery test exercises 429 retry and key rotation without enabling transientRetryOn5xx, leaving the changed interaction untested. Add an endpoint regression with transient retry enabled, a 429/5xx recovery sequence, and an assertion that actual upstream calls never exceed attempts.
AGENTS.md reference: AGENTS.md:L336-L339
Useful? React with 👍 / 👎.
⏳ DRAFT
What to do
Its title has been prefixed with |
Motivation
transientRetryOn5xx.attemptstotal-send budget so a single inbound request cannot amplify upstream sends beyond the configured per-request ceiling.Description
transientSendsUsed) insrc/server/chat-native.tsand compute the remaining allowance before each fetch call so every recovery leg draws from the same budget.fetchWithTransientRetryand wireonSendsConsumedso the helper reports actual sends back into the shared counter.transientSendAvailable()check.tests/transient-budget-scope-source.test.tsthat asserts the native-chat wiring draws from the shared counter and that both recovery loops observe the budget, alongside existingtests/upstream-transient-retry.test.tscoverage.Testing
bun test tests/transient-budget-scope-source.test.ts tests/upstream-transient-retry.test.tsand both focused test files passed.bun run typecheckandbun run privacy:scan, both succeeded.bun run test; focused regressions are green but the full PR-ready suite run was aborted after unrelated, pre-existing failures in other tests, so only the focused tests and typecheck/privacy checks were relied on for verification.Codex Task