-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(responses): carry the transient send budget across combo children (#4546) #4608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,8 +25,14 @@ describe("transient send budget stays request-scoped", () => { | |
| test("every transient-retry call site draws from the shared counter", () => { | ||
| const core = source("server/responses/core.ts"); | ||
|
|
||
| // One owner per request, declared before any leg can send. | ||
| expect(core.match(/let transientSendsUsed = 0;/g)).toHaveLength(1); | ||
| // One holder per LOGICAL request, read before any leg can send and inherited by combo | ||
| // children through the options spread rather than recreated per child turn. | ||
| expect(core.match(/const sendBudget = options\.sendBudget \?\? createTransientSendBudget\(\);/g)) | ||
| .toHaveLength(1); | ||
| // Genuine ingress mints it; a child arrives with the parent's and must not replace it. | ||
| expect(core).toContain("sendBudget: options.sendBudget ?? createTransientSendBudget(),"); | ||
| // The regressed shape: a counter local to one call frame, which a combo child restarts. | ||
| expect(core).not.toContain("let transientSendsUsed = 0;"); | ||
|
Comment on lines
+30
to
+35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win Add a runtime regression test for shared retry accounting. These assertions only inspect source text. They do not verify that combo children share the budget during execution. Add a focused Bun test that drives two combo children through transient failures and verifies that later children cannot re-arm transient retries after earlier children consume the allowance. Include the direct Google adapter path. As per coding guidelines, “A behavior change in src should come with a focused regression test near the existing tests for that subsystem.” As per path instructions, “Tests are flat Bun tests under tests/.” 🤖 Prompt for AI Agents |
||
| expect(core.match(/const remainingTransientSendBudget = \(budget: number\): number =>/g)).toHaveLength(1); | ||
|
|
||
| // Seven legs report into the same counter: the adapter initial send, the 429/rotation | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces a request-wide retry invariant spanning combo dispatch and
src/lib/upstream-retry.ts, but the commit leaves the applicable architecture documentation unchanged. In particular,structure/transports/responses.mdowns both source areas and already describes upstream retry and combo behavior, so it should document how the mutable budget is created, inherited by combo children, and consumed; otherwise the repository's designated source of truth omits the new constraint future transport changes must preserve.AGENTS.md reference: src/AGENTS.md:L10-L11
Useful? React with 👍 / 👎.