Repository navigation
[STALE: REBASE FROM NEW FORK] fix(gateway): enforce Anthropic send ceilings and gate quota regressions - #43
Open
vadymhimself wants to merge 1 commit into
Conversation
… regressions Reserve Anthropic OAuth inference at the existing physical dispatch boundary. Share inherited request ledgers and pending-hop permits instead of bypassing ceilings or double charging helper reports. Preserve the fork default pool walk without widening custom policies. Add hard zero/one-send, funded replacement, inherited budget, continuation and image-sidecar regression cases, stable cache-prefix control and pinned quota-400 isolation. Correct direct-handler terminal fixtures to own the spend ledger. Run the offline gateway suite inside the existing required CI gates job; fork publication retains its exact-SHA push-CI requirement. Co-Authored-By: Claude Code <noreply@anthropic.com>
Collaborator
Author
|
This PR is based on the superseded 2.65 gateway line. Rebuild the change from |
This branch has not been deployed
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
.27(d0f166aca5): an explicit one-send Anthropic OAuth budget dispatched 3 mocked inference requests on both extra-usage HTTP 400 and HTTP 429; a zero-send budget still dispatched once.oauthDispatchboundary, including continuation and image/search sidecar paths. Reuse the existing adapter budget view/pending permit, omit duplicate helper charges, and check remaining allowance before replacing the preceding refusal. No new credential store or live provider calls.transientRetryOn5xxremains scoped to the existing supported key adapters; this PR does not add an Anthropic OAuth setting.bun run test:gateway-quota, reusing 11 existing regression files, as a step in the existinggatesCI job. The required aggregateciand fork release's exact-SHA successful push-CI requirement already exist; no permissions, branch rules, publish capability, workflow triggers or action pins change.Verification
Pinned Bun 1.4.4, isolated
HOMEandOPENCODEX_HOME, synthetic provider traffic only. Original dirty worktree and running laptop/hosted gateways are untouched. Local loopback HTTP and real child gateway process exercise are included inagentradar-account-pin-e2e.test.ts; the quota tests use the real Responses handler and count actual mock inference dispatches.3 / 3 / 1instead of ceilings1 / 1 / 0for quota-400, quota-429 and zero-budget cases.bun run test:gateway-quota: 213 pass, 0 fail across 11 files. Covers the budget cases, refusal preservation, exact-once funded replacement, existing default pool walking, pin/helper isolation, cache prefix stability and per-account usage.bun run typecheck,bun run structure:check,bun run privacy:scan,git diff --check: pass.bun test tests/responses/responses-core-modules.test.ts tests/ci-workflows/file-size-ratchet.test.ts tests/ci-workflows/ci-workflows.test.ts tests/ci-workflows/release-pipeline-contract.test.ts: 167 pass, 0 fail before the terminal-fixture-only follow-up.bun test tests/server/terminal-guard-server.test.ts: 16 pass after its lease fix, also included in the final gateway gate.bun scripts/test.ts --changed=v2.65.0-vadymhimself.27: 19,011 pass, 8 skip, 12 fail across 896 files. This is not a green full-suite claim. The initial run exposed 2 direct-handler terminal fixtures missing spend ownership; fixed. All 12 remaining failure names also appear in a pristine.27control (8,060 pass, 3 skip, 12 fail across 295 selected files), not a paired full-suite proof:tests/cli/cli-connect-readiness.test.ts: rejected preferred runtime lacks 2 expected model probes.tests/codex-integration/native-codex-toggle.test.ts: off/on round-trip reportsabsentinstead ofcurrent.tests/server/server-auth.test.ts: connection error spellsECONNREFUSEDinstead ofConnectionRefused.tests/service/service-claim.test.ts: sandbox service paths do not all belong to the temporary home.tests/service/service-sqlite-home.test.ts: 3 home-binding assertions.tests/service/service-wsl-home-ownership.test.ts: 3 home-ownership assertions.tests/service/service.test.ts: 2 stale service-path assertions.pull_request_target, write token, egress credential, dynamic shell interpolation or new third-party action. The physical dispatch reuses the existing reservation ledger and its durable ownership checks; no log/response fields or tenant authorization changes.The workflow itself has not yet passed on GitHub for this commit. No release tag, merge or deployment is performed by this PR.
Checklist
🤖 Generated with Claude Code